PIC-1で行う制御とファームウェア
|
|||
このPICはUSB-PICがTeraTermからに“D”を受け取ってD7200が15秒の連写後に、信号を受けてコロナの偏光撮像を開始します。 偏光撮像は、
ステッピングモーターでフィルターを回して工夫なく停止すると大きな振動が出るため、ゆっくりと停止するようにしてみました。 |
|||
ここでは5Vで動くユニポーラーステッピングモータ(ST-42BYG0506H)を使用します。定格5Vのはずなのですが、USBからの給電ではパワートランジスタでの降圧もあり、また、5.5Vくらいあるとそれなりに動いてくれることが分かったので、昇圧モジュールを取り付けています。1相0.6A食うので2相がOnになると1.2A食う事になります。出力1.4A以上のDC-DCとPICに流す電流を考えると1口1.5A~の出力を持つモバイルバッテリが必要です。駆動回路の回路図・部品配置図はこちらにあります。 2018年5月26日現在、具体的に何処に観測地が求められるかが不明のため、下記のファームウェア、DL可能なソースコードは仮稼働状態のものです。また、フィルターターレットがゆっくり静止するときどれくらい振動が出るかの実験をしなくてはなりません。 |
|||
|
|||
1 /* 2 * Polarization Capture 3 * Author: M_shi_Lab 4 * For PIC-1+E-PL5 5 * Started at 2018/Apr/22 6 * Tentative completion at 2018/May/26 7 * Completion for eclips at 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 TRISB = 0b00000001; 27 PORTB = 0b00000000; 28 29 while(1) 30 { 31 if(PORTBbits.RB0 == 0) 32 { 33 Captor(); 34 } 35 } 36 } 37 38 void Captor(void) 39 { 40 int i, j; 41 42 for(j=0; j<=4; j++) 43 { 44 PORTBbits.RB1 = 1; 45 __delay_ms(50); 46 PORTBbits.RB2 = 1; 47 __delay_ms(1100); 48 PORTBbits.RB2 = 0; 49 PORTBbits.RB1 = 0; 50 __delay_ms(50); 51 52 for(i=1;i<=11;i++) 53 { 54 PORTB = 0b11000000; 55 __delay_ms(20); 56 PORTB = 0b01100000; 57 __delay_ms(20); 58 PORTB = 0b00110000; 59 __delay_ms(20); 60 PORTB = 0b10010000; 61 __delay_ms(20); 62 } 63 PORTB = 0b11000000; 64 __delay_ms(30); 65 PORTB = 0b01100000; 66 __delay_ms(40); 67 PORTB = 0b00110000; 68 __delay_ms(50); 69 PORTB = 0b10010000; 70 __delay_ms(60); 71 PORTB = 0b11000000; 72 __delay_ms(70); 73 PORTB = 0b01100000; 74 __delay_ms(20); 75 76 PORTBbits.RB1 = 1; 77 __delay_ms(50); 78 PORTBbits.RB2 = 1; 79 __delay_ms(1100); 80 PORTBbits.RB2 = 0; 81 PORTBbits.RB1 = 0; 82 __delay_ms(50); 83 84 PORTB = 0b00110000; 85 __delay_ms(20); 86 PORTB = 0b10010000; 87 __delay_ms(20); 88 89 for(i=1;i<=10;i++) 90 { 91 PORTB = 0b11000000; 92 __delay_ms(20); 93 PORTB = 0b01100000; 94 __delay_ms(20); 95 PORTB = 0b00110000; 96 __delay_ms(20); 97 PORTB = 0b10010000; 98 __delay_ms(20); 99 } 100 PORTB = 0b11000000; 101 __delay_ms(20); 102 PORTB = 0b01100000; 103 __delay_ms(20); 104 PORTB = 0b00110000; 105 __delay_ms(30); 106 PORTB = 0b10010000; 107 __delay_ms(40); 108 109 PORTB = 0b11000000; 110 __delay_ms(50); 111 PORTB = 0b01100000; 112 __delay_ms(60); 113 PORTB = 0b00110000; 114 __delay_ms(70); 115 PORTB = 0b10010000; 116 __delay_ms(20); 117 } 118 return; 119 } 120 |