Line 7... |
Line 7... |
7 |
// |
7 |
// |
8 |
// Counter gives 32 bit value: |
8 |
// Counter gives 32 bit value: |
9 |
// I2C register address 0 = LSB |
9 |
// I2C register address 0 = LSB |
10 |
// I2C register address 3 = MSB |
10 |
// I2C register address 3 = MSB |
11 |
|
11 |
|
12 |
#define ID "$Id: main.c 2916 2013-04-14 17:42:03Z kaklik $" |
12 |
#define ID "$Id: main.c 3741 2014-10-25 22:30:12Z kakl $" |
13 |
#include "main.h" |
13 |
#include "main.h" |
14 |
#use i2c(SLAVE, Fast, sda=PIN_C4, scl=PIN_C3, force_hw, address=0xA2) |
14 |
#use i2c(SLAVE, Fast, sda=PIN_C4, scl=PIN_C3, force_hw, address=0xA2) |
15 |
|
15 |
|
16 |
#include <string.h> |
16 |
#include <string.h> |
17 |
|
17 |
|
- |
|
18 |
#define LED PIN_B3 // heartbeat indicator |
18 |
#define SEL0 PIN_E0 // external counter division ratio |
19 |
#define SEL0 PIN_E0 // external counter division ratio |
19 |
#define SEL1 PIN_E1 // external counter division ratio |
20 |
#define SEL1 PIN_E1 // external counter division ratio |
20 |
#define MR PIN_E2 // external counter master reset |
21 |
#define MR PIN_E2 // external counter master reset |
21 |
#define CLKI PIN_C0 // internal counter input |
22 |
#define CLKI PIN_C0 // internal counter input |
22 |
|
23 |
|
Line 133... |
Line 134... |
133 |
countL|=input(CLKI)<<2; // read bit 2 of external counter |
134 |
countL|=input(CLKI)<<2; // read bit 2 of external counter |
134 |
output_high(SEL0); |
135 |
output_high(SEL0); |
135 |
// output_high(SEL1); |
136 |
// output_high(SEL1); |
136 |
countL|=input(CLKI)<<3; // read bit 3 of external counter |
137 |
countL|=input(CLKI)<<3; // read bit 3 of external counter |
137 |
|
138 |
|
- |
|
139 |
output_toggle(LED); // heartbeat |
138 |
output_low(MR); // External counter Master Reset |
140 |
output_low(MR); // External counter Master Reset |
139 |
output_high(MR); |
141 |
output_high(MR); |
140 |
set_timer1(0); // Internal counter reset |
142 |
set_timer1(0); // Internal counter reset |
141 |
of=0; // Overflow counter reset |
143 |
of=0; // Overflow counter reset |
142 |
|
144 |
|
Line 192... |
Line 194... |
192 |
if (fire_setup) |
194 |
if (fire_setup) |
193 |
{ |
195 |
{ |
194 |
setup_GPS(); // Write configuration to the GPS |
196 |
setup_GPS(); // Write configuration to the GPS |
195 |
fire_setup = 0; |
197 |
fire_setup = 0; |
196 |
} |
198 |
} |
- |
|
199 |
output_toggle(LED); // heartbeat |
197 |
//printf("%X %X %X %X\r\n", buffer[0],buffer[1],buffer[2],buffer[3]); |
200 |
//printf("%X %X %X %X\r\n", buffer[0],buffer[1],buffer[2],buffer[3]); |
198 |
//printf("%010Lu\r\n", count); |
201 |
//printf("%010Lu\r\n", count); |
199 |
} |
202 |
} |
200 |
} |
203 |
} |