Simple PIC to PIC UART problem mikroC

Thread Starter

lloydi12345

Joined Aug 15, 2010
103
Hi, My circuit is not working properly on Proteus. Can you help me with my code? I think I have alot of mistake because I'm not yet familiar with mikroC.

Here's my code.

Transmitter:

Rich (BB code):
void main() {
          ADCON1 = 6;

          UART1_Init(9600);           // initialize USART module
          while(1){                               //  (8 bit, 9600 baud rate, no parity bit...)
          UART1_Write(0x0F);    //make RB0-RB3 light
          Delay_ms(100);
          
          UART1_Write(0xF0);     //make RB4-RB7 light
          Delay_ms(100);
          }
}
Receiver:

Rich (BB code):
unsigned char i;

void main(){
      adcon1 = 6;
      trisd = 0;

            while(1){
                     if (UART1_Data_Ready()) {
                     i = UART1_Read();                  // read the received data
                     PORTD = i;
                     Delay_ms(100);      //light the appropriate LEDs

                     }
            }
}
I am new also to UART. I hope someone can help me. Thank you.
Schematic is attached below.
 

Attachments

Top