Strings......and how to join them


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gringobomba14 View Post
    I sent to the LCD display whats being sent by the radio,
    WHOA! When did the RF come into the mix here?
    Do a search on manchester encoding and come back when you get something written.

  2. #2


    Did you find this post helpful? Yes | No

    Talking Manchester? are they the 3rd best team in England or something?

    Ski, I spent yesterday and Sunday encoding my data with the Manchester coding, and it is a very bulky way of getting information from point A to B via RF. I did a lot of playing around and I found that if I send what I want at 4800 bps and inverted (mode 16752) or 2400 bps and inverted it will arrive fine EVERY TIME. HOWEVER, if you try and send the data NON-INVERTED it just arrives muddled and messed up. Here is the TX and RX code. There is no need for synching because the the temp/hum sender only sends the data when asked, and sends it individually.

    (PC Based 16F877)

    transmit: 'Send commands
    let i=0 ' Set i to 0
    for i = 0 to 1 ' 2 pass loop
    portd.1=1 ' Switch on TX module
    pause 125 ' wait 125 ms to slew TX
    serout2 PORTd.0,16572,[25,25,25,25] ' send command to get Temp
    pause 25 ' pause
    next i ' Next pass
    portd.1=0 ' switch off TX module
    portc.3=1 ' switch on RX module
    pause 113 ' pause to allow RX to slew
    SERIN2 PORTc.4,16572,250,programstart,[STR temp\25\13] 'receive temp up to 25 bits, ending with char 13
    HSEROUT [str temp\21,13,10,32,CR] ' display temp
    clear ' clear array
    pause 10000 ' wait 10 seconds
    let i=0 ' set i to 0
    for i = 0 to 1 ' start 2 pass loop
    portd.1=1 ' switch on TX module
    pause 125 ' allow time for TX module to switch on
    serout2 PORTd.0,16572,[35,35,35,35] ' send command to get Humidity
    pause 25 ' pause
    next i ' next pass
    portd.1=0 ' switch off TX module
    portc.3=1 ' switch on RX module
    pause 113 ' pause
    SERIN2 PORTc.4,16572,250,programstart ,[STR hum\25\13] 'receive humidity up to 25 bits, ending with char 13
    HSEROUT [" ",str hum\21,13,10,32,CR] ' Display result
    CLEAR ' Clear array
    pause 125 ' Pause
    portc.3=0 ' switch off RX module
    pause 10 ' Pause
    goto programstart


    (Temp / Humidity module)
    receive: ' receive
    portc.1 = 1 ' switch on port
    pause 25
    SERIN2 PORTC.0,16572,250,main,[command]
    if command = 25 then goto tempsend
    if command = 35 then goto humsend
    goto main

    '*********************** Send the Temperature *********************'

    tempsend:
    portc.1=0 :
    portc.3=1
    for c =0 to 2
    pause 150 'pause 150 mS
    SEROUT2 PORTc.2,16572,["**Temperature ",dec2(temp/100),".",dec1 (Temp),13]
    PAUSE 100 ' Pause 100mS
    next c ' next pass
    portc.3=0 : goto main

    '********************** Send the Humidity ***********************'
    humsend:
    portc.1=0 ' Back to main
    portc.3=1 ' switch on tx
    for c =0 to 2 ' start 4 pass loop
    pause 150
    SEROUT2 PORTc.2,16572,["**Humidity ",DEC2 (RHtc/10),".",DEC1 RHtc,13]
    PAUSE 100 ' Pause 100uS
    next c
    portc.3=0
    goto main ' next pass

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    So is it working good then?

  4. #4


    Did you find this post helpful? Yes | No

    Thumbs up funny enough.........

    Yes. I have added the following to avoid any garbage(from my car alarm fob):

    SERIN2 PORTc.4,16572,250,programstart,[wait("*"),STR temp\25\13]

    so that unless the string begins with a * then nothing is received

    and this on the TX side of the temp/hum module to help synching

    SEROUT2 PORTc.2,16572,[$55,$55,$55,"**Temperature ",dec2(temp/100),".",dec1 (Temp),"+"]
    Last edited by gringobomba14; - 22nd July 2008 at 16:34.

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