Rev 325 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 325 | Rev 355 | ||
|---|---|---|---|
| Line 13... | Line 13... | ||
| 13 | 13 | ||
| 14 | int main(void) |
14 | int main(void) |
| 15 | { |
15 | { |
| 16 | unsigned long time; |
16 | unsigned long time; |
| 17 | unsigned long time1 = bios->timebase_get(); |
17 | unsigned long time1 = bios->timebase_get(); |
| 18 | unsigned long time2 = bios->timebase_get(); |
- | |
| 19 | 18 | ||
| 20 | sei(); |
19 | sei(); |
| 21 | 20 | ||
| 22 | Serial_Init(); |
21 | Serial_Init(); |
| 23 | 22 | ||
| Line 36... | Line 35... | ||
| 36 | 35 | ||
| 37 | printf("AVR Test Application\n"); |
36 | printf("AVR Test Application\n"); |
| 38 | printf("Using AVR BIOS version %x\n", bios->version); |
37 | printf("Using AVR BIOS version %x\n", bios->version); |
| 39 | 38 | ||
| 40 | txMsg.Id = (CAN_TST << CAN_SHIFT_CLASS) | NODE_ID; |
39 | txMsg.Id = (CAN_TST << CAN_SHIFT_CLASS) | NODE_ID; |
| 41 | txMsg. |
40 | //txMsg.Data.dwords[0] = 0x01020304; |
| 42 | txMsg. |
41 | //txMsg.Data.dwords[1] = 0xfffefdfc; |
| 43 | txMsg.DataLength = |
42 | txMsg.DataLength = 4; |
| 44 | 43 | ||
| 45 | while (1) { |
44 | while (1) { |
| 46 | time = bios->timebase_get(); |
45 | time = bios->timebase_get(); |
| 47 | if ((time - time1) >= 2000) { |
46 | if ((time - time1) >= 2000) { |
| 48 | //test-send a canmessage |
47 | //test-send a canmessage |
| - | 48 | txMsg.Data.bytes[0] = time & 0x000000FF; |
|
| - | 49 | txMsg.Data.bytes[1] = (time & 0x0000FF00)>>8; |
|
| - | 50 | txMsg.Data.bytes[2] = (time & 0x00FF0000)>>16; |
|
| - | 51 | txMsg.Data.bytes[3] = (time & 0xFF000000)>>24; |
|
| 49 | bios->can_send(&txMsg); |
52 | bios->can_send(&txMsg); |
| 50 | time1 = time; |
53 | time1 = time; |
| 51 | printf("Two seconds passed, time is now %ld.\n", time); |
54 | printf("Two seconds passed, time is now %ld.\n", time); |
| 52 | } |
55 | } |
| 53 | } |
56 | } |