please dont rip this site

PIC Microcontoller IO Method

High speed serial IO pin sampleing

by Scott Dattalo

to sample a stream as fast as possible. For an
arbitrary length (but constrained by the PIC's memory) arrary of bits, you can
do something like:


     btfsc   BIT_PORT,THE_BIT
      bsf    byte0,0
     btfsc   BIT_PORT,THE_BIT
      bsf    byte0,1
     btfsc   BIT_PORT,THE_BIT
      bsf    byte0,2
     btfsc   BIT_PORT,THE_BIT
      bsf    byte0,3
     btfsc   BIT_PORT,THE_BIT
      bsf    byte0,4
     btfsc   BIT_PORT,THE_BIT
      bsf    byte0,5
     btfsc   BIT_PORT,THE_BIT
      bsf    byte0,6
     btfsc   BIT_PORT,THE_BIT
      bsf    byte0,7


     btfsc   BIT_PORT,THE_BIT
      bsf    byte1,0

etc, for byte1, byte2 This'll give 2-cycle sampling per bit. There's a way to improve this to 1-cycle resolution, but you're limited to 16 bits.

Dmitry Kiryashov [zews at AHA.RU] says:

...it will make all the port unusable for other purposes ;) Source is located in bit.0 for instance. tris.0 is input others for output. Probably will not work on very fast speed (Scenix?)
        rlf     port,F  ;do it 7 times

        rlf     port,W  ;get 8 samples into W

        rlf     port,F  ;do it 8 times
                        ;will have one more 8 samples
                        ;in carry,port.7..1

also: PIC Microcontoller Bit Math Method Shifting long strings of bits


file: /Techref/microchip/sersamp.htm, 1KB, , updated: 2007/7/17 06:45, local time: 2024/12/24 09:43,
TOP NEW HELP FIND: 
18.188.0.20:LOG IN

 ©2024 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://linistepper.com/techref/microchip/sersamp.htm"> PIC Microcontoller IO Method High speed serial IO pin sampleing</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?