PIC-1で行う制御とファームウェア
|
|||
このPICはD7200がC2の15秒の連写後に、USB-PICがTeraTermから信号"D"を受けてコロナの偏光撮像を開始します。 偏光撮像は、
ステッピングモーターでフィルターを回して単純停止すると大きな振動が出るため、ゆっくりと停止するようにしてみました。 |
|||
ここでは5Vで動くユニポーラーステッピングモータ(ST-42BYG0506H)を使用します。定格5Vのはずなのですが、USBからの給電ではパワートランジスタでの降圧もあり、また、5.5Vくらいあるとそれなりに動いてくれることが分かったので、昇圧モジュールを取り付けています。1相0.5+αA食うので2相がOnになると1A強の電流を食う事になります。出力1.4A以上のDC-DCとPICに流す電流を考えると1口1.5A~の出力を持つモバイルバッテリが必要です。駆動回路の回路図・部品配置図はこちらにあります。 で、作ってきたのですが…なぜか脱調と普通に動く事を繰り返すため、最初はファームウェアを疑い、色々調整してみましたがダメ。PICからは下のようなきれいな波形が出ているのですが… と、9月1日、ふと何気に出力のパワートランジスタのコネクタピンから信号をとってみると… レレレ、4番目のパワートランジスタから出力がない!?これが原因…という事は半田不良か!という事で、トランジスタ周辺の半田付けした部分を再度はんだを熔かしてきちんと導通や絶縁が出来ていることを確認したら、 こんな感じで思った通りに信号がトランジスタのコレクタから出力をきちんと得られるようになりました。そしてきちんと動く事が確認できました。 偏光撮像の機材はコロナのアップとともにスカイメモSに同架することを考えているので、フィルターターレットが止まるときのショックがどれくらいコロナのアップに響くかの実験を行い、危険を感じる結果であれば別に用意したスカイメモTに載せて使うことを検討します。…が、重量的に合計5㎏を超えるので、初めから止めたほうが良いかな? |
|||
|
|||
1 /* 2 * PolarizationCapture 3 * Author: M_shi 4 * ForPIC-1+E-PL5 5 * Startedat 2018/Apr/22 6 * Tentativecompletionat 2018/May/26 7 * Completionforeclipsat 2018/Sep/02 8 */ 9 10 11 #include <xc.h> 12 #include <stdlib.h> 13 #include <stdio.h> 14 #pragma config FOSC = HS 15 #define _XTAL_FREQ 12000000 16 #pragma config MCLRE = OFF 17 #pragma config WDTE = OFF 18 #pragma config PWRTE = ON 19 #pragma config CP = OFF 20 #pragma config CPD = OFF 21 22 void Captor(void); 23 24 void main(void) 25 { 26 ANSEL = 0b00000000; 27 TRISA = 0b10000000; 28 TRISB = 0b00001001; 29 30 PORTBbits.RB0 = 1; 31 PORTB = 0b11000000; 32 33 while(1) 34 { 35 if(PORTBbits.RB0 == 0) 36 { 37 Captor(); 38 } 39 } 40 } 41 42 void Captor(void) 43 { 44 int i, j; 45 46 for(j=0; j<=24; j++) 47 { 48 PORTBbits.RB1 = 1; 49 __delay_ms(50); 50 PORTBbits.RB2 = 1; 51 __delay_ms(1100); 52 PORTBbits.RB2 = 0; 53 __delay_ms(50); 54 PORTBbits.RB1 = 0; 55 56 __delay_ms(50); 57 PORTB = 0b11000000; 58 __delay_ms(10); 59 PORTB = 0b01100000; 60 __delay_ms(10); 61 PORTB = 0b00110000; 62 __delay_ms(10); 63 PORTB = 0b10010000; 64 __delay_ms(10); 65 for(i=1;i<=10;i++) 66 { 67 PORTB = 0b11000000; 68 __delay_ms(10); 69 PORTB = 0b01100000; 70 __delay_ms(10); 71 PORTB = 0b00110000; 72 __delay_ms(10); 73 PORTB = 0b10010000; 74 __delay_ms(10); 75 } 76 PORTB = 0b11000000; 77 __delay_ms(20); 78 PORTB = 0b01100000; 79 __delay_ms(30); 80 PORTB = 0b00110000; 81 __delay_ms(30); 82 PORTB = 0b10010000; 83 __delay_ms(30); 84 PORTB = 0b1100000; 85 __delay_ms(30); 86 PORTB = 0b01100000; 87 88 __delay_ms(100); 89 90 PORTBbits.RB1 = 1; 91 __delay_ms(50); 92 PORTBbits.RB2 = 1; 93 __delay_ms(1100); 94 PORTBbits.RB2 = 0; 95 __delay_ms(50); 96 PORTBbits.RB1 = 0; 97 98 __delay_ms(50); 99 PORTB = 0b00110000; 100 __delay_ms(10); 101 PORTB = 0b10010000; 102 __delay_ms(10); 103 for(i=1;i<=10;i++) 104 { 105 PORTB = 0b11000000; 106 __delay_ms(10); 107 PORTB = 0b01100000; 108 __delay_ms(10); 109 PORTB = 0b00110000; 110 __delay_ms(10); 111 PORTB = 0b10010000; 112 __delay_ms(10); 113 } 114 PORTB = 0b11000000; 115 __delay_ms(10); 116 PORTB = 0b01100000; 117 __delay_ms(10); 118 PORTB = 0b00110000; 119 __delay_ms(20); 120 PORTB = 0b10010000; 121 __delay_ms(30); 122 PORTB = 0b11000000; 123 __delay_ms(30); 124 PORTB = 0b01100000; 125 __delay_ms(30); 126 PORTB = 0b00110000; 127 __delay_ms(30); 128 PORTB = 0b10010000; 129 130 __delay_ms(100); 131 } 132 return; 133 } 134 |