RX / TX duo


Results 1 to 20 of 20

Thread: RX / TX duo

Threaded View

  1. #1
    Join Date
    Jul 2006
    Posts
    76

    Default RX / TX duo

    I am fairly new to PIC's so I would love if I got some help to see if this code would work. I am making a remote control car and I have a receiver and transmitter that both use the 16f84. The four pushbuttons on the transmitter control two motors that are connected to an H-Bridge (on the receiving end) which in turn control both directions for the motors. Can someone tell me if this code is valid for the schematics? Thanks a million...

    Both schematics are attached and the code is below...

    Transmitter Code

    ------------------------------------------

    INCLUDE "modedefs.bas"

    output PORTB.4

    start:
    'Check if buttons are pressed
    if (PORTB.0 = 1) then one
    if (PORTB.1 = 1) then two
    if (PORTB.2 = 1) then three
    if (PORTB.3 = 1) then four

    goto start

    one:
    serout PORTB.4,N2400,["1"]
    goto start

    two:
    serout PORTB.4,N2400,["2"]
    goto start

    three:
    Serout PORTB.4,N2400,["3"]
    goto start

    four:
    serout PORTB.4,N2400,["4"]
    goto start

    Receiver Code

    ----------------------

    INCLUDE "modedefs.bas"

    output PORTA.0
    output PORTA.1
    output PORTA.2
    output PORTA.3

    start:

    in VAR BYTE

    serin PORTB.1,N2400,in
    'PORTA.0 receives signal at 2400 baud rate and places
    'input at variable in

    'Testing serial input
    if in == "1" then one

    if in == "2" then two

    if in == "3" then three

    if in == "4" then four

    goto start

    'Turn on PORTA.x for 100 milliseconds and then turn off (motors)
    one:
    high PORTA.2
    PAUSE 100
    low PORTA.2
    goto start

    two:
    high PORTA.3
    PAUSE 100
    low PORTA.3
    goto start

    three:
    high PORTA.1
    PAUSE 100
    low PORTA.1
    goto start

    four:
    high PORTA.0
    PAUSE 100
    low PORTA.0
    goto start

    --------------------------------
    Thanks again!!!

    -Mike
    Attached Images Attached Images   
    Last edited by mbw123; - 17th July 2006 at 17:44.

Similar Threads

  1. Replies: 67
    Last Post: - 8th December 2009, 02:27
  2. RX TX modules - intermitent communication
    By ruijc in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 11th June 2009, 00:13
  3. RX - TX timming
    By ruijc in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th February 2009, 00:06
  4. TX RX Buffer Question
    By shawn in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th January 2005, 01:49
  5. Tx and Rx of Single Pin PIC's
    By Dwayne in forum Code Examples
    Replies: 0
    Last Post: - 26th May 2004, 14:55

Members who have read this thread : 1

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