PIC-1で行う制御とファームウェアの改2型
|
|||
このPICはD7200がC2の15秒の連写後に、USB-PICがTeraTermから信号"D"を受けてコロナの偏光撮像を開始します。 偏光撮像は、
E-PL5はスリープの設定は出来ますが、スリープしない事に出来ない(最長5分でスリープする)ので、3分毎にフォーカス信号を送信するファームウェアに変更しました。 加えて回数が増えるとバッファがきつくなる現象を起こすので撮像後500ms待ち時間を入れました。 |
|||
駆動回路の回路図・部品配置図はこちらにあります。 | |||
|
|||
1 /* 2 * PolarizationCapture 3 * Author: M_shi_Lab 4 * ForPIC-1+E-PL5 5 * Startedat 2018/Apr/22 6 * Tentativecompletionat 2018/May/26 7 * Completionforeclipsat 2019/Feb/23 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 int i; 31 32 PORTBbits.RB0 = 1; 33 PORTB = 0b11000000; 34 35 while(1) 36 { 37 PORTBbits.RB2 = 1; 38 __delay_ms(30); 39 PORTBbits.RB2 = 0; 40 for(i=0; i<=18000; i++) 41 { 42 __delay_ms(10); 43 if(PORTBbits.RB0 == 0) 44 { 45 Captor(); 46 } 47 } 48 } 49 } 50 51 void Captor(void) 52 { 53 int i, j; 54 55 for(j=0; j<=18; j++) 56 { 57 PORTBbits.RB2 = 1; 58 __delay_ms(50); 59 PORTBbits.RB1 = 1; 60 __delay_ms(2200); 61 PORTBbits.RB1 = 0; 62 __delay_ms(50); 63 PORTBbits.RB2 = 0; 64 __delay_ms(500); 65 for(i=1;i<=12;i++) 66 { 67 PORTB = 0b11000000; 68 __delay_ms(15); 69 PORTB = 0b01100000; 70 __delay_ms(15); 71 PORTB = 0b00110000; 72 __delay_ms(15); 73 PORTB = 0b10010000; 74 __delay_ms(15); 75 } 76 PORTB = 0b1100000; 77 __delay_ms(15); 78 PORTB = 0b01100000; 79 80 __delay_ms(1000); 81 82 PORTBbits.RB1 = 1; 83 __delay_ms(50); 84 PORTBbits.RB2 = 1; 85 __delay_ms(2200); 86 PORTBbits.RB2 = 0; 87 __delay_ms(50); 88 PORTBbits.RB1 = 0; 89 __delay_ms(500); 90 PORTB = 0b00110000; 91 __delay_ms(15); 92 PORTB = 0b10010000; 93 __delay_ms(15); 94 for(i=1;i<=12;i++) 95 { 96 PORTB = 0b11000000; 97 __delay_ms(15); 98 PORTB = 0b01100000; 99 __delay_ms(15); 100 PORTB = 0b00110000; 101 __delay_ms(15); 102 PORTB = 0b10010000; 103 __delay_ms(15); 104 } 105 106 __delay_ms(1000); 107 } 108 return; 109 } 110 |