main.c
1 | /*
| 2 | * RS485.c
| 3 | *
| 4 | * Created: 09.09.2016 20:37:38
| 5 | * Author: Bone
| 6 | */
| 7 |
| 8 | #ifndef F_CPU
| 9 | #define F_CPU 8000000UL
| 10 | #endif
| 11 |
| 12 |
| 13 |
| 14 | #include <avr/io.h>
| 15 | #include <avr/interrupt.h>
| 16 | #include <util/delay.h>
| 17 | #include <stdio.h>
| 18 | #include <stdbool.h>
| 19 | #include <stdlib.h>
| 20 | #include <string.h>
| 21 |
| 22 | //#include "uart.h"
| 23 | //#include "crc.h"
| 24 | #include "service.h"
| 25 |
| 26 |
| 27 |
| 28 |
| 29 | void blink_led(void)
| 30 | {
| 31 | PORTB |= (1<<PINB0);
| 32 | _delay_ms(500);
| 33 | PORTB &= ~(1<<PINB0);
| 34 | _delay_ms(500);
| 35 | }
| 36 |
| 37 |
| 38 |
| 39 |
| 40 | int main(void) {
| 41 | unsigned char buf[20];
| 42 | DDRB = (1<< PINB5) | (1<< PINB2); // set PINB0 and PINB2 as output
| 43 |
| 44 | NetInit();
| 45 | _delay_ms(200);
| 46 | sei();
| 47 |
| 48 | while (1) {
| 49 |
| 50 |
| 51 | _delay_ms(1000);
| 52 | sprintf(buf,"LED");
| 53 | Net_SendChar(0x44,&buf[0],3);
| 54 |
| 55 |
| 56 | } // while
| 57 |
| 58 | } // main
|
|