Manchester and baud [II]


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2006
    Posts
    76

    Default Manchester and baud [II]

    I apologize for repeatedly posting on this subject but I am continually running into problems. I am using the RX433 and TX33 modules for my project. My project essentially has four buttons that trigger four different ports on the receiving end. I am basically using a cheap version of Manchester by filling up the four extra bits within the byte (because there are only four buttons), every other "real bit" (the ones that trigger the ports). That way every other byte is at least a one. See the code below to understand what I mean. Unfortunately it does not work wirelessly. I hooked it up using a wire and it worked. Is their something wrong with my "Manchester"? Or am I messing something else up with the modules?

    I appreciate any responses.

    -----------------
    Transmitter Code:
    -----------------

    define HSER_TXSTA 20h
    define HSER_BAUD 4800

    cmcon = 7

    Current var byte
    Laststate var byte
    input PORTA.0
    input PORTA.1
    input PORTA.2
    input PORTA.3
    Current.0 = 1
    Current.2 = 1
    Current.4 = 1
    Current.6 = 1

    Main:

    current.1 = PORTA.0
    Current.3 = PORTA.1
    Current.5 = PORTA.2
    Current.7 = PORTA.3

    if (Current <> Laststate) then
    hserout [$A5,"~",Current]
    Laststate = Current
    endif

    goto main

    --------------
    Receiver Code:
    --------------

    define HSER_CLROERR 1
    define HSER_RCSTA 90h
    define HSER_BAUD 4800

    cmcon = 7

    Current var byte
    output PORTA.0
    output PORTA.1
    output PORTA.2
    output PORTA.3
    output PORTB.4
    low PORTA.0
    low PORTA.1
    low PORTA.2
    low PORTA.3
    low PORTB.4

    @ DEVICE PIC16F628A, MCLR_OFF
    @ DEVICE PIC16F628A, WDT_OFF
    @ DEVICE PIC16F628A, PROTECT_OFF
    @ DEVICE PIC16F628A, BOD_OFF
    @ DEVICE PIC16F628A, CPD_OFF

    Main:

    high PORTB.4 //this is just so I can debug whether the PIC is being "browned out" by the other components
    pause 250
    low PORTB.4
    goto loop

    loop:

    Hserin 20,loop,[WAIT("~"),Current]

    Current = ~ Current

    PORTA.0 = Current.1
    PORTA.1 = Current.3
    PORTA.2 = Current.5
    PORTA.3 = Current.7

    goto loop

    ============================
    Thank you.

    -Mike

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,116


    Did you find this post helpful? Yes | No

    Default

    if it works wired it SHOULD work wireless. If not, then something is not properly setup with the modules. Have checked with a scope?

    Ioannis

  3. #3
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    "Have checked with a scope?"
    No, unfortunately I don't have one. Is there any other way to check it?

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    We've been over this before, but I'll do it again....

    -----------------
    Transmitter Code:
    -----------------
    include "modedefs.bas"
    cmcon=7:current var byte:dataout var byte

    'pick a serial output pin and set it to an output here ---- ouput someregister.somepin

    input PORTA.0:input PORTA.1:input PORTA.2:input PORTA.3

    converts var byte[15]
    converts[0]=$55 : converts[1]=$56 : converts[2]=$59 : converts[3]=$5a : converts[4]=$65 : converts[5]=$66 : converts[6]=$69 : converts[7]=$6a
    converts[8]=$95 : converts[9]=$96 : converts[10]=$99 : converts[11]=$9a : converts[12]=$a5 : converts[13]=$a6 : converts[14]=$a9 : converts[15]=$aa

    Main:
    current=porta:dataout=converts[current]

    'pick your serial output pin and change it to match
    serout someport.somepin , n2400 , dataout

    goto main

    --------------
    Receiver Code:
    --------------
    cmcon = 7:Current var byte:datain var byte:temp var byte
    output PORTA.0 : output PORTA.1 : output PORTA.2 : output PORTA.3 : low PORTA.0 : low PORTA.1 : low PORTA.2 : low PORTA.3 : low PORTB.4

    'pick a serial input pin and set it to an input here ---- inut someregister.somepin

    converts var byte[15]
    converts[0]=$55 : converts[1]=$56 : converts[2]=$59 : converts[3]=$5a : converts[4]=$65 : converts[5]=$66 : converts[6]=$69 : converts[7]=$6a
    converts[8]=$95 : converts[9]=$96 : converts[10]=$99 : converts[11]=$9a : converts[12]=$a5 : converts[13]=$a6 : converts[14]=$a9 : converts[15]=$aa

    Main:

    'pick your serial input pin and change it
    serin someport.somepin , n2400 , datain

    for temp = 0 to 15
    if datain = converts[temp] then porta=temp
    next temp

    goto loop


    All the transmit program does is send out the present position of the inputs repeatedly to the receiver in manchester format. The receiver ends up getting trained eventually, but might 'freak out' a bit for the first few cycles.

    The reason why your other program didn't work is because you aren't sending the data in correct 'manchester format'. You lock bits to 1's and make others change. That won't work. The receiver won't get 'trained' right.

    And I've been a bit wrong in the past. Calling it 'manchester format' is wrong....it's actually called 'bi-phase encoding', but manchester is close enough.
    Last edited by skimask; - 23rd December 2006 at 22:39.

Similar Threads

  1. Help with RF transmittions
    By mbw123 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 11th December 2006, 04:09

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