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 07:45, local time: 2023/9/27 10:34,
|©2023 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?|
<A HREF="http://www.massmind.org/Techref/microchip/sersamp.htm"> PIC Microcontoller IO Method High speed serial IO pin sampleing</A>
|Did you find what you needed?|
Welcome to massmind.org!
Welcome to www.massmind.org!