please dont rip this site

PIC Specific RF IO

Manchester Encoding

Simon Nield [simon.nield at QUANTEL.COM] says:

The problem:

I need to biphase code a byte for serial transmission over an rf link. In other words each '1' becomes '10' and each '0' becomes '01'. If it makes the code easier then '1' becoming '01' and '0' becoming '10' is ok too.

this _could_ be done with a lookup table, which would be fast, but that's not the point of a tiny code challenge now is it ?

Here's a chunk of code that does the job.

; data starts off stored in lo_int_temp+0
; program_status(fRFToggle) flips each time around the loop to select which nibble we are attacking
btfss    program_status, fRFToggle
swapf    lo_int_temp+0, F            ; select the appropriate nibble

; biphase code bit
movlw    b'01010101'                 ; start biphase coding...
btfsc    lo_int_temp+0, 0
addlw    b'00000001'                 ; if bit 0 is set then W = 01010110
btfsc    lo_int_temp+0, 1
addlw    b'00000100'                 ; if bit 1 is set then W = 010110xx
btfsc    lo_int_temp+0, 2
addlw    b'00010000'                 ; if bit 2 is set then W = 0110xxxx
btfsc    lo_int_temp+0, 3
addlw    b'01000000'                 ; xxxxabcd now encoded as aAbBcCdD, where A = !a
; exits with a coded version of the relevant nibble of lo_int_temp+0 in W


happy hunting,
Simon


Also:

Archive:

Questions:

See also:


file: /Techref/microchip/manchester.htm, 2KB, , updated: 2002/2/27 02:41, local time: 2021/10/21 11:20,
TOP NEW HELP FIND: 
3.237.16.210:LOG IN

 ©2021 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.piclist.com/techref/microchip/manchester.htm"> PIC RF IO - Manchester Encoding</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2021 contributors:
o List host: MIT, Site host massmind.org, Top posters @20211021 Neil, Harold Hallikainen, Alan Pearce, RussellMc, Bob Blick, Allen Mulvey, Dwayne Reid, madscientistatlarge, Sean Breheny, Justin Richards,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .