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: 2018/4/25 19:08,
|©2018 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.piclist.com/techref/microchip/sersamp.htm"> PIC Microcontoller IO Method High speed serial IO pin sampleing</A>
|Did you find what you needed?|
PICList 2018 contributors:
o List host: MIT, Site host massmind.org, Top posters @20180425 RussellMc, Van Horn, David, Sean Breheny, Isaac M. Bavaresco, Bob Blick, Neil, David C Brown, alan.b.pearce, Brent Brown, John Gardner,
* 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!