2 PIC,serial communication

Discussion in 'Programmer's Corner' started by lightgreen, Oct 6, 2009.

  1. lightgreen

    Thread Starter New Member

    Feb 28, 2009
    hi,good day to everyone...
    I had struggle throughout the process of learning serial communication, but gained nothing at last.
    I tried with 2 PIC where each of the PIC will control the LED that connected with it.
    There are 2 PIC in the drawing. Let the left PIC = A, right PIC = B.
    What i want to have is....A control the LED that connected with B, and B control the LED that connected with A.
    I started a bit of the coding but stuck somewhere in the middle. I don't know how to use HSERIN and HSEROUT even though I went through the manual.
    I know there should be 2 sets of similar coding which i can download it into PIC while doing the simulation in Proteus Isis. But at this moment, I can't even write my coding with HSERIN and HSEROUT.
    Attachment below shows the connection in Proteus. I only had problem with my coding.
    So any help.....I will be so grateful....Thanks in advance...
    Coding as below:
    Define osc 8
    define HSER_RCSTA 90H 'Enable serial port and continous receive
    DEFINE HSER_TXTSTA 24H 'Enable transmit
    DEFINE HSER_CLROERR 1 'Clear overflow automatically
    ADCON1 = 7

    TRISB.0 = 1 'switch
    TRISB.2 = 0 'LED
    TRISC.6 = 0 'set TX(portC.6) to out
    TRISC.7 = 1 'set RX(portC.7) to in

    led1 var portb.2
    Hserout [