Mike Harrison says:
While we're on the subject of neat little routines etc...
This code sends a byte at 115.2Kbaud
With a 4.096MHZ xtal, error is about 1.25% (near enough),
with 4.000MHz, 4.55% (marginal).
Data is non-inverted (i.e can be fed straight to PC)txbyte mov temp, W mov W, #10 ; 1 start + 8 data + 1 stop mov cnt, W clrb C ;start bit mov W, Rb txloop and W, #0ff-(1< ;<seroutbit) sb C or W, #1< ;<seroutbit mov Rb, W sec rr temp ; carry shifted in as stop bit decsz cnt jmp txloop ret
Incidentally It's also possible to do 115K2 bit-bashed reception at 4.096MHz, by generating an INT interrupt off the startbit edge, and grabbbing all the data bits within the int code. Context save/restore overheads mean there's only a couple of cycles available to the foreground task if data is streaming in continuously!
|file: /Techref/scenix/lib/io/osi2/serial/rs232at115kbps_sx.htm, 1KB, , updated: 2013/7/23 10:40, local time: 2022/5/27 15:52,
|©2022 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/scenix/lib/io/osi2/serial/rs232at115kbps_sx.htm"> Mike Harrisons 115.2kBaud with a 4.096Mhz crystal</A>
|Did you find what you needed?|
PICList 2022 contributors:
o List host: MIT, Site host massmind.org, Top posters @20220527
* 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!