encode/decode manchester


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    a_critchlow's Avatar
    a_critchlow Guest

    Post encode/decode manchester

    could anyone explain this to me in more detail please?



    Encode:
    For i = 0 to 7 ' loop for 8-bits
    outword.0[(i*2)] = ~inbyte.0[i]
    outword.0[(i*2)+1] = inbyte.0[i]
    Next i '
    Return

    Decode::
    For i = 0 to 7
    outbyte.0[i] = ~inword.0[i<<1]
    Next i
    Return





    The main line i dont understand is: outword.0[(i*2)] = ~inbyte.0[i]




    thank you all for your time

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by a_critchlow
    The main line i dont understand is: outword.0[(i*2)] = ~inbyte.0[i]
    That means bit i*2 of outword be the NOT (the inverse of) inbyte bit i

    Ioannis

  3. #3


    Did you find this post helpful? Yes | No

    Default

    I don't get any of it.

    Please, someone, a manchester encoding for dummies tutorial.

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


    Did you find this post helpful? Yes | No

    Default

    Do a SEARCH on 'manchester' on this forum and all will be revealed.

  5. #5
    a_critchlow's Avatar
    a_critchlow Guest


    Did you find this post helpful? Yes | No

    Exclamation ~inword.0[i<<1]

    ive figured out the encoded part but i cant get the decoded part into my head:


    outbyte.0[i] = ~inword.0[i<<1]


    if the counter is at 0, it should put the first bit of the encoded data inversed into the decoded data var. but because of the <<1 it puts the second bit inversed into the first decoded var.




    thanks.

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by a_critchlow
    ive figured out the encoded part but i cant get the decoded part into my head:
    Don't bother. If you do not understand this code, there are many other codes doing the same thing. Or better, create your own.

    The idea is this: if you have to send 0 then in manchester you will send 01 pair. If you have to send 1 then in manchester you will send 10 pair.

    So, for the byte

    1 0 0 1 1 0 0 1

    the result would be:

    10 01 01 10 10 01 01 10

    Is it clear now? You can simply do an if-then-else sub routine for the encoder and also the same for the decoder (in reverse of course).

    As Melanie stated, a search will reveal much more. This case is trivial by now...

    Ioannis

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. 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. Manchester coding question
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 5th May 2007, 17:35
  5. Help with serin, serout, Manchester encoding
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 5th April 2007, 13:31

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