vectorspace
Member
After removing all but the bare essentials from my project I still have the problem. The first character I send into the 20M2 through an ICL232 (MAX232 equivalent) goes through fine. The following characters are mangled. I've tried different 20M2 frequencies, different chips and different baud rates all with the same result. According to my O'scope and logic analyzer the data is going through the ICL232 chip fine and shows up on the 20M2 input pin very clean. And noise doesn't seem to be the issue for another reason, namely, the output is always the same, but always wrong (after the first correct character). I had this code working with a different prototype but I must have done something that I just don't see after I adapted it to this project.
It's just two serial cables, one going in and the other coming out. I've tested the two serial ports I'm using with this project by crossing them back-to-back (without my circuit in between) and data goes both ways nicely so my serial ports seem to be good.
What am I missing? Any help would be appreciated.
It's just two serial cables, one going in and the other coming out. I've tested the two serial ports I'm using with this project by crossing them back-to-back (without my circuit in between) and data goes both ways nicely so my serial ports seem to be good.
What am I missing? Any help would be appreciated.
Code:
#picaxe 20M2
#no_data
#terminal off
'--------------------------------setup---------------------------------------
SETFREQ m32
dirsB = %11111111
dirsC = %11111011
SYMBOL char = b0 ; character holder for IO
'--------------------------------I/0-----------------------------------------
SYMBOL LoopOut = B.6 ;Serial out to Blue cable
SYMBOL C40SerIn = C.2 ;HW Serial TX to C40
SYMBOL C40baud = T38400_32 ;C40 Serial baud rate xxxx,N,8,1 @ 16 MHz
'-------------------------------init-----------------------------------------
init:
pause 1000 ;wait for something to initialize
high LoopOut
'---------------------------------main------------------------------------------
main:
gosub getInputString
gosub textToBlue
pause 1000
goto main ' main loop
'----------------------------getInputString-------------------------------------
getInputString:
bptr = 28 ' begin storing data at location 28 just above b27
serin C40SerIn,C40baud,@bptrinc' no timeut; so wait for the FIRST CHAR
serin [800], C40SerIn, C40baud, @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc
' and all that inputs <= FOURTY MORE CHARS
@bptr = 0 ' 0 is the end of transmission marker,
bptr = 28 ' Reset byte pointer to the first location
return
'------------------------------textToBlue---------------------------------------
textToBlue:
do until @bptr = 0 ' loop until we reach the EOT character(0)
char = @bptrinc ' get each byte
serout LoopOut,C40baud,(char);send chr to Blue Cable
loop ' done looping
return