Rohith_elec
Full Member level 4
- Joined
- Dec 16, 2011
- Messages
- 198
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,296
- Activity points
- 2,470
my code for uart like below not working as expected in proteus
Code:
char receive ;
void main() {
CMCON |= 7;
TRISA = 0x04; // RA2 is analogue input
ADCON1 = 0x80;
TRISD =0; //
PORTD=0x00;
while (1) {
UART1_Init(9600); // Initialize UART1 module at 9600 bps
Delay_ms(100); // Wait for UART 1module to stabilize
UART1_Write_Text("Start");
UART1_Write(13);
UART1_Write(10);
while (!UART1_Data_Ready()); // wait for UART character in buffer
{receive = UART1_Read();
if (receive == 'a')
{
portd=0x00;
portd.f0=0;
portd.f1=0;
portd.f2=1;
}
if (receive == 'b')
portd=0x00;
portd.f0=1;
portd.f1=1;
portd.f2=1; }
}
}