Line 20... |
Line 20... |
20 |
#include <lcd.c> |
20 |
#include <lcd.c> |
21 |
|
21 |
|
22 |
int16 of=0; // count of overflow |
22 |
int16 of=0; // count of overflow |
23 |
int1 flag; // flag for a blinking dot |
23 |
int1 flag; // flag for a blinking dot |
24 |
|
24 |
|
- |
|
25 |
// GPS setup for frequency measurement |
- |
|
26 |
const char cmd[40]={0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x80, 0x84, 0x1E, 0x00, 0xE0, 0xC8, 0x10, 0x00, 0x40, 0x42, 0x0F, 0x00, 0xA0, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0x00, 0x00, 0x00, 0x12, 0x03}; |
- |
|
27 |
|
- |
|
28 |
|
25 |
#int_EXT // Interrupt from 1PPS |
29 |
#int_EXT // Interrupt from 1PPS |
26 |
void EXT_isr(void) |
30 |
void EXT_isr(void) |
27 |
{ |
31 |
{ |
28 |
unsigned int16 countH; |
32 |
unsigned int16 countH; |
29 |
unsigned int8 countL; |
33 |
unsigned int8 countL; |
Line 82... |
Line 86... |
82 |
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1); |
86 |
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1); |
83 |
setup_timer_2(T2_DISABLED,0,1); |
87 |
setup_timer_2(T2_DISABLED,0,1); |
84 |
setup_ccp1(CCP_OFF); |
88 |
setup_ccp1(CCP_OFF); |
85 |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
89 |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
86 |
|
90 |
|
87 |
output_toggle(BEEP); // cvak... |
91 |
output_toggle(BEEP); // cvak... |
88 |
printf("Cvak...."); |
- |
|
89 |
|
92 |
|
90 |
ext_int_edge( L_TO_H ); // set 1PPS active edge |
93 |
ext_int_edge( L_TO_H ); // set 1PPS active edge |
91 |
enable_interrupts(INT_TIMER1); |
94 |
enable_interrupts(INT_TIMER1); |
92 |
enable_interrupts(INT_EXT); |
95 |
enable_interrupts(INT_EXT); |
93 |
enable_interrupts(GLOBAL); |
96 |
enable_interrupts(GLOBAL); |
94 |
|
97 |
|
95 |
lcd_init(); |
98 |
lcd_init(); |
- |
|
99 |
delay_ms(100); |
- |
|
100 |
lcd_putc("\f ACOUNTER02A\n (c)mlab.cz 2014\n"); |
- |
|
101 |
|
- |
|
102 |
|
- |
|
103 |
delay_ms(1000); //wait for GPS init. |
- |
|
104 |
int n; |
- |
|
105 |
for (n=0;n<40;n++) putc(cmd[n]); // send setup to GPS |
96 |
|
106 |
|
97 |
lcd_putc("\fCvak...\nHmmm...\n"); |
107 |
lcd_putc("\fCvak...\nHmmm...\n"); |
98 |
|
108 |
|
99 |
while(true) |
109 |
while(true) |
100 |
{ |
110 |
{ |