RF and Manchester


Closed Thread
Results 1 to 13 of 13
  1. #1

    Default RF and Manchester

    Hi,
    I open a new thread while nobody answered my old thread :-).
    Did someone have a working Manchester code Encoder and Decoder ?
    This what I find in forum dont work.


    Regard Pesti.

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Sorry I missed your thread

    Hi there,

    Could you please elaborate. I have worked with Manchester Encoding schemes but not with PBP really.

    Regards

    Sougata

  3. #3
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    Please give me some informations:

    How many Bytes do you want to transfer ?
    Are the receiver an Transmitter PICs ?
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Thanks people,yes the receiver is a pic and the transmitter is a pic,I have PIC16f870 and a UAA3201T.
    For the moment I want to send from 1 to 5 byte no more, just for tests when this work then i can do more.
    I attached the receiver to PortA.0 and I want to Decode the data for example 1 or more byte and then on PortA.1 send the data encoded to the transmitter.
    I need a working manchester code ?!
    And my second question is Are the binary data from receiver from left to right to be read or from right to left(I know that when I read binary data i starting from right 1,2,4,8,16,32 and so on) and to send did I send from left or right.
    I write this little example to test if this work:

    Main:
    Manchesterword = %1001101001010110

    For CounterA=0 to 7
    If ManchesterWord.15=0 then
    MyData=0
    endif
    If ManchesterWord.15=1 then

    MyData=1
    endif

    ManchesterWord=ManchesterWord<<2

    hserout[bin MyData]
    next

    pause 2000

    goto main

    Thanks people for the help.

    Regard Pesti.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Try searching the forum... code examples in this thread...

    http://www.picbasic.co.uk/forum/showthread.php?t=198

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Hi Melanie,
    I have just tryed this code but dont work,I'm tryed with this example just to see if this work:
    Define LOADER_USED 1


    Include "modedefs.bas" ' Mode definitions for Serout
    ADCON1=7
    define osc 4

    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_SPBRG 207 ' 1200 Bauds
    DEFINE HSER_CLOERR 1

    ''''''''''''''''''''''''''''''''''''''''''''''''De coder'''''''''''''''''''''''''''''''''''''''''
    Main:
    ManchesterWord = %1010101001010101


    ErrorFlag=0
    For CounterA=0 to 7
    If ManchesterWord.1=0 then
    MyData.7=0
    If ManchesterWord.0=0 then ErrorFlag=1
    else
    MyData.7=1
    If ManchesterWord.0=1 then ErrorFlag=1
    endif
    ManchesterWord=ManchesterWord>>2
    If CounterA<7 then MyData=MyData>1
    next
    hserout [Mydata]
    pause 2000
    goto Main

    I become all the time 255255255255127127...... and so on.

    Regard Pesti.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Here's a simple set of manchester encode/decode routines.
    Code:
    inbyte	VAR	BYTE
    outword	VAR	WORD
    inword	VAR	WORD
    outbyte	VAR	BYTE
    i	VAR	BYTE
    
    Begin:
        CLEAR
        inbyte = 12	       ' byte for test
        GoSub Encode       ' convert to Manchester word
        inword = outword
        GoSub Decode       ' convert from Manchester word
        outbyte = 0
        goto begin
        
    Encode:
    	For i = 0 to 7 ' loop for 8-bits
    	  outword.0[(i*2)] = ~inbyte.0[i] ' Get bit value for bits 0,2,4,6,8,10,14 in outword
    	  outword.0[(i*2)+1] = inbyte.0[i]' Get bit value for bits 1,3,5,7,9,11,13,15 in outword
      	Next i  ' 
    Return
    
    Decode::
    	For i = 0 to 7			' loop for 8-bits
    	  outbyte.0[i] = ~inword.0[i<<1]	' outbyte bits 0-7 = inword bits 0,2,4,6,8,10,14
    	Next i  ' Inverts each 2nd bit position in inword I.E. 01 = 0, 10 = 1
    Return
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8


    Did you find this post helpful? Yes | No

    Default

    HI,
    Bruce thank you verymuch,now I can good sleep :-).
    I must now this test !
    Now I understand how word modifier are working.
    Thank you .
    Thank you.

    Regard Pesti.

  9. #9


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I have another question Bruce how can I compare 2 or more bytes when I just a example receive from transmitter byte0 = 241 byte1= 246 on the decoder output?
    Can I do that like this:
    if (outbyte = $F1) & (outbyte = $F6) then hserout [outbyte]

    Thanks.
    regard Pesti.
    Last edited by Pesticida; - 1st November 2005 at 13:49.

  10. #10
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Pesti,

    Your example should work fine.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  11. #11


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce,
    I have analysed the data from my transmitter I become this when i push the button:
    24124625025424224224824225424124625025424224224824 2254

    But when I dont push the button ,the receiver send to PIC this"I think this is just noise or Alien data :-)" :
    24224224324124024025525524324124124024025525524324 32412402532402552412402552522472472502502492462552 49244253240244247255245244255255255249248255249244 25524124125524724324324924024024025525324025525424 72432432412402442552552412542552442552552542472432 41241240255250251241242255253246247243241241255253 24724724324124124025525325525125125524124225525325 52422402522492532472432432412412402552552552412402 55254255246247243249243244255240255255240248255252 25425425424324124124425525524925425425225524725524 32552522542462472432412412402552432412482552402482 55251252252254246255248255253244255240255241240255 24624324324124124825524124024325524124024025524025 5251244255244248247255244248"FromHERE2412462502542 42242248242254241246250254242242248242254ToHere"24 224224324124024.............

    I must to filter the data what I need :2412462502542422422482422542412462502542422422482 42254
    I try this: if (outbyte = $F1) & (outbyte = $F6) then hserout [outbyte] but dont work !


    How can I do this Bruce, simple as possible :-)

    Thanks.
    Regard Pesti
    Last edited by Pesticida; - 1st November 2005 at 15:02.

  12. #12
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    A few things to consider.

    1. If you do not clear a variable it will retain the last value placed in it.
    2. Most inexpensive or sensitive RF receivers will output random noise spikes when the transmitter is idle.

    Try sending data in packets of a specific size, and using some form of synchronization byte at the start of each packet. Receive your data in a specific number of bytes. If the first byte is not the synch value or character, dump the data packet.

    It's rare that you'll see a solid RF application just flinging random data at a receiver.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  13. #13


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Did some one know how can I separate from a word bytes,Example :
    I receive with serin 10 bytes,how can i show this bytes with serout.

    Regard Pesti.

Similar Threads

  1. 16F84/16F628 and Manchester
    By Navaidstech in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th March 2009, 15:28
  2. Manchester Coding / Decodeing for RF Modules
    By charudatt in forum Code Examples
    Replies: 23
    Last Post: - 31st January 2009, 10:51
  3. Serial rf communication
    By tazntex in forum General
    Replies: 8
    Last Post: - 2nd August 2008, 16:27
  4. Problem with manchester code for RF
    By Dhanushka in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 6th August 2007, 11:46
  5. Manchester coding question
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 5th May 2007, 17:35

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