xbee transmitter & receiver


Results 1 to 11 of 11

Threaded View

  1. #9
    Join Date
    Jun 2006
    Posts
    37


    Did you find this post helpful? Yes | No

    Default files

    'Receiver side code

    DEFINE OSC 8


    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_SPBRG 12 ' 9600 Baud @ 8MHz, 0.16%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically



    TRISB = %00000000 ' Set RX (PortB.4) to output

    char var byte
    i var byte
    TrisA= %00000000 'All PORTA pins configured as output
    ADCON1= %11111111 'All PORTA pins configured as digital




    loop:
    'RCSTA = $90 ' Enable serial port & continuous receive
    'TXSTA = $20 ' Enable transmit, BRGH = 0
    'SPBRG = 12 ' 9600 Baud @ 8MHz, 0.16%


    for i=1 to 6
    Hserin [char] ' Get a char from serial port
    next i

    Pause 850 ' Delay for 1 usec,use larger delay for real device


    'RCSTA = $90 ' Enable serial port & continuous receive
    'TXSTA = $24 ' Enable transmit, BRGH = 1
    'SPBRG = 25 ' 19200 Baud @ 8MHz, 0.16%

    for i=1 to 6
    Hserout [char]
    next i
    Pause 850
    Goto loop ' Go back to loop and blink LED forever
    ;End
    Attached Images Attached Images  

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts