16F84/16F628 and Manchester


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Location
    Mississauga, Ontario, Canada
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    Obviously I missed a few posts.


    Thanks for the info there Ioannis.


    I searched the forum some more this morning and I was able to whip out a tx/rx pair that ALMOST works, based on code tidbits I found..
    At the moment the two modules are connected with wires but once I get the code rectified a bit, I'll move up to RF modules.

    I say "ALMOST" because the tx part seems to be working ok, however the receiver isn't quite there yet.

    Here is the code that I'm using for transmitting (I have observed it on the oscilloscope and it appears to be working):

    dataport var PORTB.0

    START:
    serout2 PORTB.0,813,[$55, $55, $55, $AA]
    mydata = "T"

    dataport = $00
    pause 1000
    goto start


    ENCODEMANCHESTER:
    ManchesterWord=0
    For CounterA=0 to 7
    If MyData.0=0 then
    ManchesterWord.14=1
    else
    ManchesterWord.15=1
    endif
    If CounterA<7 then ManchesterWord=ManchesterWord>>2
    MyData=MyData>>1
    Next CounterA
    serout2 dataport,396,[manchesterword.lowbyte, manchesterword.highbyte]

    Return



    And here is the receiver code:



    RECEPTION var PORTB.0
    INFO VAR PORTB.2
    ERROR var PORTB.1



    START:
    manchesterword=0

    SERIN2 reception, 813, [WAIT($AA),ManchesterWord.LowByte,ManchesterWord.Hi ghByte]
    gosub ManchesterDecode

    goto start

    ManchesterDecode:
    ErrorFlag=0
    For CounterA=0 to 7
    If ManchesterWord.1=0 then
    MyData.7=0
    ERROR = 0
    If ManchesterWord.0=0 then
    ErrorFlag=1
    ERROR = 1
    endif
    else
    MyData.7=1
    ERROR = 0
    If ManchesterWord.0=1 then
    ErrorFlag=1
    ERROR = 1
    endif
    endif
    ManchesterWord=ManchesterWord>>2
    If CounterA<7 then MyData=MyData>>1
    NEXT COUNTERA
    serout2 info, 813, [Mydata]

    Return


    I set PORTB.1 as an indicator telling me whether or not the Manchester code has errors in it... I was monitoring that pin with a scope and not once did it light up, yet I'm getting garbage coming out on pin 2.

    Somehow I'm thinking that the receiver code is missing something but I'm hoping if you guys could point out where the problem lies.

    thanks

    Alex

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


    Did you find this post helpful? Yes | No

    Default

    I cannot see how these two pieces of code (tx and rx) can work together.

    Read your code again,or post the working code.

    Or try the untested one that is attached.

    Rename to .bas and burn it.

    Ioannis
    Attached Files Attached Files

  3. #3
    Join Date
    Aug 2007
    Location
    Mississauga, Ontario, Canada
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    Of course!

    I'm sending the preamble at a wrong baud rate! DOH!

    Changed it and it works ok now....

    thanks!!!

    Alex

  4. #4
    Join Date
    Aug 2007
    Location
    Mississauga, Ontario, Canada
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    Ioannis...

    looks like I jumped the gun there. Your code seems to be working much better than the one I used.

    Thank you for your help. Hopefully I'll be ok from hereon.

    Alex

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Navaidstech View Post
    ...looks like I jumped the gun there...
    ? I am not sure i follow...

    You are welcome!

    Ioannis

  6. #6
    Join Date
    Aug 2007
    Location
    Mississauga, Ontario, Canada
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    In my previous message I indicated that once the baud rate was changed, the original program that I posted was working ok.
    Then I noticed some errors popping up so I decided to delve further into the program... it didn't look right so I decided to use your untested routines and they worked great.

    Thanks again!

Similar Threads

  1. Manchester coding/decoding Code help
    By financecatalyst in forum Code Examples
    Replies: 0
    Last Post: - 25th August 2009, 19:05
  2. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  3. SERIN2 – SEROUT2 and Manchester mistake.
    By RCtech in forum Serial
    Replies: 8
    Last Post: - 4th September 2007, 22:55
  4. Help with serin, serout, Manchester encoding
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 5th April 2007, 13:31
  5. Manchester and baud [II]
    By mbw123 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd December 2006, 22: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