Hi everybody!!!
I'm new and i need some help!!!
Nice to meet you!!!
I'm trying to connect my Aduc836 (8051 architecture) with a 4d systems display by Serial TTL.
What i want to do for this moment it's simply send a char by the display and turn on one led on my boards.... the problem I have is that I can not read properly the character sending by the display.
Below the code on my MCU:
#include <reg52.h> sbit P3_4 = P3^4; sbit P3_5 = P3^5; bit flag = 0; idata unsigned char rx; void UART_intialization(void) { SCON = 0x50; // 8 bit, variable baud rate + REN = 1; TMOD &= ~0xF0; // timer1 bit set to 0 TMOD |= 0x20; // timer 1, autoreload TL1 = 252; // baud rate 9600 TH1 = 252; ES = 1; // interrupt serial enable EA = 1; // all interrupt souce enabled; TR1 = 1; // start timer1 } void int_Serial(void) interrupt 4 { if(RI != 0 ) { RI = 0; rx = SBUF; flag = 1; } } void main(void) { UART_initialization(); while(1) { if( flag ) { if( rx == 'a' ) P3_4 = 0; // if i read the correct value ( i send by display the char 'a') // i turn on one led else P3_5 = 0; // else if the value that i read it's wrong i turn on another led } flag = 0; } }
the code send by the display it's a simple instruction serout('a') , that works correctly.
Any advice?