-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
80 lines (72 loc) · 1.37 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/******************************************
Author : Kamal BABU
About : LCD+UART Demo Code
*******************************************/
#include "header.h"
#include "lcd.h"
#include "uart.h"
#ifndef F_CPU
# define F_CPU 16000000UL
#endif
int main(void)
{
char data0[11]="LCD TEST";
char txbuff[] = "kamal";
char rxbuffer[10];
signed int val = 0;
uint8_t byte_count = 0;
char id1[10] = "55000E2B86";
char id2[10] = "55000E209B";
/* Initialization start here */
_delay_ms(10);
lcd_init();
usart_init();
_delay_us(10);
printstring(data0);
_delay_ms(2000);
clear();
//home();
//while(1);
locate(1,1);
printstring("Loading System");
for(val=0;val<=100;val++)
{
locate(1,2);
printinteger(val);
printchar('%');
_delay_ms(200);
}
_delay_ms(1000);
clear();
//_delay_ms(2000);;
//clear();
//txbyte('a');
//txstring(txbuff,strlen(txbuff));
locate(1,1);
while(1)
{
//int check = ischarwaiting();
if (ischarwaiting() > 0)
{
rxbuffer[byte_count] = rxbyte();
byte_count++;
//clear();
//printchar(var);
}
if (byte_count > 9) {
*(rxbuffer + byte_count)= '\0';
byte_count = 0;
printstring(rxbuffer);
// string compare
if(strcmp(rxbuffer, id2) == 0){
printstring("match2");
}
if(strcmp(rxbuffer, id1) == 0){
printstring("match1");
}
*rxbuffer = '\0';
//asm ( "jmp 0x0000" );
}
}
return 0;
}