kt88seamp
12-27-2009, 03:48 AM
I am attempting to write my own Dull Duplex Serial. I know one exists in the object exchange but I just want to see if I can do it. Meanwhile what I wrote is not working. I think its the baudrate part. Right now the code only expects one byte so I put in nothing to compensate for the stop bit. It communicates at 9600 baud. If only spin had a debugger I would be able to see exactly what is going on!
ina[15]~ 'Make pin an input
wait := clkfreq / 9600 'Set bit timing
repeat while ina[15] <> 1 'Wait for start bit.
waitcnt(wait + cnt) 'Wait for first bit.
repeat 8 'Read in each bit
buffer <<= ina[15]
waitcnt(wait + cnt) 'Next bit
ina[15]~ 'Make pin an input
wait := clkfreq / 9600 'Set bit timing
repeat while ina[15] <> 1 'Wait for start bit.
waitcnt(wait + cnt) 'Wait for first bit.
repeat 8 'Read in each bit
buffer <<= ina[15]
waitcnt(wait + cnt) 'Next bit