Serial Wireless


Closed Thread
Results 1 to 5 of 5

Thread: Serial Wireless

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Serial Wireless

    I know there is a simple solution for this, but I can not find it.

    I have two 16F676 both running on external 4Mhz oscillators. A TXM-433-LR-S and a RXM-433-LR-S.

    I know the RF is working as I can send a "HIGH" and receive a "HIGH" and blink a LED.

    I know the serial works, send a signal and blink a LED.

    Problem is when serial is sent with RF.

    I am using hyper-terminal to monitor the receiver. With wires I will see what I send and with out wires the first few characters will be garbage with the remaining correct.
    Code:
    SERIN2 PORTC.4,16468,[WAIT("9"),DEC net]
    So I only want the last one.

    Send
    Code:
    DEFINE OSC 4
    Asm
        ERRORLEVEL -306
        Endasm
    include "modedefs.bas"
    
    ANSEL=%00000000
    CMCON=7
    PAUSE 2000
    
    LOOP:
    IF PORTC.1 = 1 THEN 
    SEROUT2 PORTC.4,16468,[DEC 01010101,DEC 9,DEC 3,10,13]
    HIGH PORTC.5
    PAUSE 100
    LOW PORTC.5
    PAUSE 100
    ELSE
    SEROUT2 PORTC.4,16468,[DEC 010101,DEC 9,DEC 5,10,13]
    PAUSE 200
    ENDIF
    GOTO LOOP
    
    END
    Receive
    Code:
    DEFINE OSC 20
    Asm
        ERRORLEVEL -306
        Endasm
    include "modedefs.bas"
    
    ANSEL=%00000000
    CMCON=7
    net 	VAR WORD
    PAUSE 2000
    
    LOOP: 
    SERIN2 PORTC.4,16468,[WAIT("9"),DEC net]
    IF net = 3 THEN
    HIGH PORTC.5
    PAUSE 100
    LOW PORTC.5
    PAUSE 100
    ELSE
    LOW PORTC.5
    PAUSE 200
    ENDIF
    GOTO LOOP
    
    END
    The last few characters are always the same with or with out wires on hyper-terminal.
    Why is the WAIT not working with RF.

    Tried different bauds, nothing.
    Tried different preambles, nothing.
    Dave
    Always wear safety glasses while programming.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Send
    Code:
    SEROUT2 PORTC.4,16468,[DEC 01010101,DEC 9,DEC 3,10,13]
    SEROUT2 PORTC.4,16468,[DEC 010101,DEC 9,DEC 5,10,13]
    You're going to have problems with those two lines. DEC 01010101 will try to send out the number '1 million, 10 thousand, one hundred and one'. Use BIN 01010101 instead of DEC, or just make it easy and use '$55' instead. Also, instead of sending 'DEC 3' or 'DEC 5', just send '3' or '5' and change the receive code to match.

    Receive
    Code:
    SERIN2 PORTC.4,16468,[WAIT(9),net]
    Try that change also and see what happens.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Hi Skimask,
    Tried your suggestions. Works with wires but not RF.

    Read http://www.picbasic.co.uk/forum/show...light=wireless
    Tried sending $55 five times in a row, with the next line sending $66, or DEC 3,or 3. I know $66 is not 3, also changed receiver to match. All works with wires, Not with RF.

    Hyper-terminal shows that the data I want is there with wires of RF. The first "training" is garbled with RF but the last two or three characters are correct.

    PIC will not pick up the last character with RF.

    Repeating myself, over and over, hoping to see my blunder.

    Hyper-terminal is showing the training in one column and the data I want in another.

    Wires:
    UUUUU heart shape

    RF:
    TUU heart shape
    UU heart shape
    PUU heart shape
    @UU heart shape
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    try serout...("UUUUU~~SYNCH",YourData)

    SERIN ...(WAIT("SYNCH"),YourData)

    don't forget Those UU are there only to balance the slicers, so not revealant to receive, ~~ here is just another character, You could still wait for only a part of SYNCH, let's say NCH.

    9600 could be a bit fast for testing, try 4800 or even 2400. When something work, you may need to increase and use some character pacing.

    For safety sake, on your transmitter, se the pin as output, clear it (=0) and add a few millisecond delay (~50) at the top of your code.

    In conjunction of a pull-down resistor on your receiver side as well.
    Last edited by mister_e; - 29th May 2007 at 15:22.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Thank you!!!!!!!!!!!!!!!!
    SERIN did the trick.
    Now I need to figure out why.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Wireless serial communication question
    By Ahmadabuomar in forum Serial
    Replies: 3
    Last Post: - 21st December 2009, 03:49
  2. Dynamic USB Serial Number (PIC18F4550)
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th July 2009, 17:03
  3. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  4. interfacing to the pc serial port
    By kelangfei in forum General
    Replies: 4
    Last Post: - 7th October 2007, 22:35
  5. wireless serial data?
    By Scott in forum Serial
    Replies: 0
    Last Post: - 13th January 2006, 01:44

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