PLEASE NOTE:
We do not accept any liability for this code. We do not warrant or gurantee it for any particular use or application. Please see the code itself for information on usage restrictions.

That being out of the way...

I'm pleased to present this code to the world. It is not my best effort, but it is free, so you can't complain. ;-)

Of note, this is FULL DUPLEX. You can send a full-speed stream of RS-232 at it with NO time between a stop bit and the next start bit and it will not blink. It is formed in essentially three sections which always take exactly 21, 19, and 12 cycles. The code is set up to sample the serial stream 4 times per bit-time. Therefore each bit is 54 * 4 = 208 cycles in length. At 4MHz fosc you get 1 bit 4807.69 times per second, 00.160% faster than a steady 4.8kbps stream.

Pretty darn close.

I created this code a year ago (Spring 2000) thinking that I would make a new device about once a month, and start marketing them for much less than other companies were. But I never did, and it's now a year later so I decided to let it free. To paraphrase the poet, "If you love something, let it go. If it comes back then debug it. If it comes back with lots of money, love more things so they come back with money too." Or something like that. Anyway.

Without further ado:
FileNameSizeDescription
r232tran.asm[17k]The assembly source for both true RS-232 and inverted RS-232 (define at the top determines which)
spic1000.pdf[330k]The unfinished datasheet for 3 products. The third was never created, but could easily be done from the above asm file. The source is included in this file, as well as schematics of applications, and a full operating description. Plus typical data sheet fluff.
r232trnb.asm[7k]This is the base of this and other rs-232 devices I was going to make (such as LCD, servo, etc). It includes few comments, but a lot of the loops where I put code have been unrolled and counted. Note that much of the work is done when the transmit and receive routines are doing nothing.
Operate.xls[22k]These three Excel files were created to help me visualize the timing and get it exactly right. I include them so you can see how tight I was for space, and to suggest to you another way of 'flowcharting' code. IIRC there are a few extra cycles that could be squeezed out, but it worked and so I didn't touch it up any more.
operate1.xls[24k]
setup.xls[20k]
[an error occurred while processing this directive]