2020/02/09

Arduino で2相ユニポーラPICステッピングモータで動かす

Arduino で2相ユニポーラPICステッピングモータで動かす
黒電話の回転ダイヤル式電話機を再現する.



void setup() {
  Serial.begin(9600);
  DDRB = B001111;    //PB0~PB5
}

int dly = 2;
int del = 400;

void loop() {
  if (Serial.available() > 0) {
    num(Serial.read());
    delay(del / 2);
  }
}

void num(int x) {
  switch (x) {
    case 1:
    case 49:
      step1(20 + 2, 3);
      delay(del);
      step2(20 + 2, 4);
      break;
    case 2:
    case 50:
      step1(20 + 8, 3);
      delay(del);
      step2(20 + 8, 4);
      break;
    case 3:
    case 51:
      step1(20 + 14, 3);
      delay(del);
      step2(20 + 14, 4);
      break;
    case 4:
    case 52:
      step1(20 + 20, 3);
      delay(del);
      step2(20 + 20, 4);
      break;
    case 5:
    case 53:
      step1(20 + 26, 3);
      delay(del);
      step2(20 + 26, 4);
      break;
    case 6:
    case 54:
      step1(20 + 32, 3);
      delay(del);
      step2(20 + 32, 4);
      break;
    case 7:
    case 55:
      step1(20 + 38, 3);
      delay(del);
      step2(20 + 38, 4);
      break;
    case 8:
    case 56:
      step1(20 + 44, 3);
      delay(del);
      step2(20 + 44, 4);
      break;
    case 9:
    case 57:
      step1(20 + 50, 3);
      delay(del);
      step2(20 + 50, 4);
      break;
    case 0:
    case 48:
      step1(20 + 56, 3);
      delay(del);
      step2(20 + 56, 4);
      break;
  }
}

void step2(int x, int spd) {
  for (int i = 0; i <= x; ++i) {
    PORTB = B0001;
    delay(spd);
    PORTB = B0010;
    delay(spd);
    PORTB = B0100;
    delay(spd);
    PORTB = B1000;
    delay(spd);
  }
}

void step1(int x, int spd) {
  for (int i = 0; i <= x; ++i) {
    PORTB = B1000;
    delay(spd);
    PORTB = B0100;
    delay(spd);
    PORTB = B0010;
    delay(spd);
    PORTB = B1001;
    delay(spd);
  }
}

2020/01/30

Arduino 簡易オシロスコープ

Arduino 簡易オシロスコープ

Arduino 簡易オシロスコープ | 国立大学法人 九州工業大学 情報工学部
https://www.iizuka.kyutech.ac.jp/faculty/physicalcomputing/pc_kitscope

下記はMiuzei MS18サーボモーター のテスト基板のパルス幅の確認画面です.





end

2020/01/27

PIC ICD2 PICKIT2 PICKIT3 プログラミングアダプター

PIC ICD2 PICKIT2 PICKIT3 プログラミングアダプター kit2 kit3 ユニバーサルプログラマーシート を注文して14日,ようやく届きました.

12f629 12f675 の場合,ジャンパーピン 以下のように設定し,
ゼロプレッシャーICソケットの30ピンから接続する.

J1   B
J2   2-3
J3   2-3

PIC ICD2 PICKIT2 PICKIT3 Programming adapter






end


2020/01/26

2020年1月24日 Arduinoの始まり記念日

Arduino を触ってみようと思います.
どうぞよろしくお願いします

取り敢えず部品の購入から始まります.


2020年1月24日




end



2020/01/12

PICkit3 Programmer Application v3.10.zip

PICkit3 Programmer Application v3.10.zip

https://microchipdeveloper.com/pickit3:scripttool

http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit3%20Programmer%20Application%20v3.10.zip



https://www.microchip.com/development-tools/pic-and-dspic-downloads-archive



end




2020/01/11

PIC12F675 値上がり

お久しぶりに秋葉原の秋月電子を言ってきました.

PIC12F675 値上がりですね。
現在は110円。



END

2020/01/05

Miuzei MS18サーボモーター

Miuzei MS18サーボモーター のテスト基板の作成


部品リスト
サーボモーター              MS18
PICマイコン                  PIC12F675
フォトトランジスター     L-51ROPT1D1
トランジスタ                 2SC1815GR  x2
抵抗                             10K x5
スイッチ                       タクトスイッチ x3
片面ガラス・ユニバーサル基板(ブレッドボード配線パターンタイプ)

回路図


GPIOの機能
GPIO5,4  Servo      パルス出力 (GPIO4未使用)
PIO 0,1  + -,1       パルス調整
GPIO 2  GPIO 0,1  設定したパルス(角度)をEEPROMに保存する。
GPIO 3  EEPROM   保存したパルス(角度)を実行






[ KC8801.PDF Datasheet ]
http://www.kcsemitech.com/upLoad/down/month_1403/201403091840435763.pdf



END