27,10 → 27,16 |
int8 address=0; |
|
unsigned int16 of=0; // count of overflow |
|
// configure GPS |
void setup_GPS() |
{ |
// 1x 100 us per 10 s UTC synchronised |
const char cmd[40]={0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x80, 0x96, 0x98, 0x00, 0xE0, 0xC8, 0x10, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0xC6, 0x51}; |
int n; |
for (n=0;n<40;n++) putc(cmd[n]); |
} |
|
// 1x 100 us per 10 s UTC synchronised |
const char cmd[40]={0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x80, 0x96, 0x98, 0x00, 0xE0, 0xC8, 0x10, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0xC6, 0x51}; |
|
#INT_SSP |
void ssp_interupt () |
{ |
76,6 → 82,8 |
if(state == 0x83) //Master is requesting data |
{ |
i2c_write(buffer[3]); // Prepare next byte to SSP buffer |
|
setup_GPS(); |
} |
|
if(state > 0x83) //Master is requesting data |
125,7 → 133,6 |
of++; |
} |
|
|
void main() |
{ |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
143,10 → 150,7 |
restart_wdt(); |
|
// setup GPS |
{ |
int n; |
for (n=0;n<40;n++) putc(cmd[n]); |
} |
setup_GPS(); |
|
ext_int_edge( L_TO_H ); // set 1PPS active edge |
enable_interrupts(INT_TIMER1); |