serial terminal help D:
ohVaNiLLaGoRiLLa
Posts: 33
i have a program to determine which pins on a ttl chip are inputs or outputs then to send the results to the serial terminal but the terminal keeps giving me garbage.. why is that? I am using a propstick usb version if that makes a difference.
here is the code i'm using. i am new to programming on the propeller so lets not laugh to hard at it.
i get mixed results out of the terminal ill put some below
[code]
here is the code i'm using. i am new to programming on the propeller so lets not laugh to hard at it.
VAR Byte pin11,pin21,pin31,pin41,pin51,pin61,pin81,pin91,pin101,pin111,pin121,pin131,pin141 Byte pin12,pin22,pin32,pin42,pin52,pin62,pin82,pin92,pin102,pin112,pin122,pin132,pin142 Byte pin1,pin2,pin3,pin4,pin5,pin6,pin8,pin9,pin10,pin011,pin012,pin013 OBJ pst : "Parallax Serial Terminal" PUB readttl pst.start(115200) waitcnt(clkfreq + cnt) dira[0..23] := 10101010101010101010101010 outa[0] := 1 'check pin 1 pin11 := ina[1] outa[0] := 0 pin12 := ina[1] outa[2] := 1 pin21 := ina[3] 'check pin 2 outa[2] := 0 pin22 := ina[3] outa[4] := 1 pin31 := ina[5] 'check pin 3 outa[4] := 0 pin32 := ina[5] outa[6] := 1 pin41 := ina[7] 'check pin 4 outa[6] := 0 pin42 := ina[7] outa[8] := 1 pin51 := ina[9] 'check pin 5 outa[8] := 0 pin52 := ina[9] outa[10] := 1 pin61 := ina[11] 'check pin 6 outa[10] := 0 '7 = ground pin62 := ina[11] outa[12] := 1 pin81 := ina[13] 'check pin 8 outa[12] := 0 pin82 := ina[13] outa[14] := 1 pin91 := ina[15] 'check pin 9 outa[14] := 0 pin92 := ina[15] outa[16] := 1 pin101 := ina[17] 'check pin 10 outa[16] := 0 pin102 := ina[17] outa[18] := 1 pin111 := ina[19] 'check pin 11 outa[18] := 0 pin112 := ina[19] outa[20] := 1 pin121 := ina[21] 'check pin 12 outa[20] := 0 pin122 := ina[21] outa[22] := 1 pin131 := ina[23] 'check pin 13 outa[22] := 0 '14 = +5v pin132 := ina[23] 'determines whether pin 1 is an input or output pin and then the 2nd and so on ' if input then pin# = 0 and if output pin# = 1 'pin1 := ina[0] 'pst.dec(pin1) if pin11 == 1 and pin12 == 0 pst.str(string("1 input",13)) pin1 := 0 elseif pin11 == 0 and pin12 == 0 pst.str(string("1 output",13)) pin1 := 1 elseif pin11 == 1 and pin12 == 1 pst.str(string("1 output",13)) pin1 := 1 if pin21 == 1 and pin22 == 0 pst.str(string("2 input",13)) pin2 := 0 elseif pin21 == 0 and pin22 == 0 pst.str(string("2 output",13)) pin2 := 1 elseif pin21 == 1 and pin22 == 1 pst.str(string("2 output",13)) pin2 := 1 if pin31 == 1 and pin32 == 0 pst.str(string("3 input",13)) pin3 := 0 elseif pin31 == 0 and pin32 == 0 pst.str(string("3 output",13)) pin3 := 1 elseif pin31 == 1 and pin32 == 1 pst.str(string("3 output",13)) pin3 := 1 if pin41 == 1 and pin42 == 0 pst.str(string("4 input",13)) pin4 := 0 elseif pin41 == 0 and pin42 == 0 pst.str(string("4 output",13)) pin4 := 1 elseif pin41 == 1 and pin42 == 1 pst.str(string("4 output",13)) pin4 := 1 if pin51 == 1 and pin52 == 0 pst.str(string("5 input",13)) pin5 := 0 elseif pin51 == 0 and pin52 == 0 pst.str(string("5 output",13)) pin5 := 1 elseif pin51 == 1 and pin52 == 1 pst.str(string("5 output",13)) pin5 := 1 if pin61 == 1 and pin62 == 0 pst.str(string("6 input",13)) pin6 := 0 elseif pin61 == 0 and pin62 == 0 pst.str(string("6 output",13)) pin6 := 1 elseif pin61 == 1 and pin62 == 1 pst.str(string("6 output",13)) pin6 := 1 if pin81 == 1 and pin82 == 0 pst.str(string("8 input",13)) pin8 := 0 elseif pin81 == 0 and pin82 == 0 pst.str(string("8 output",13)) pin8 := 1 elseif pin81 == 1 and pin82 == 1 pst.str(string("8 output",13)) pin8 := 1 if pin91 == 1 and pin92 == 0 pst.str(string("9 input",13)) pin9 := 0 elseif pin91 == 0 and pin92 == 0 pst.str(string("9 output",13)) pin9 := 1 elseif pin91 == 1 and pin92 == 1 pst.str(string("9 output",13)) pin9 := 1 if pin101 == 1 and pin102 == 0 pst.str(string("10 input",13)) pin10 := 0 elseif pin101 == 0 and pin102 == 0 pst.str(string("10 output",13)) pin10 := 1 elseif pin101 == 1 and pin102 == 1 pst.str(string("10 output",13)) pin10 := 1 if pin111 == 1 and pin112 == 0 pst.str(string("11 input",13)) pin011 := 0 elseif pin111 == 0 and pin112 == 0 pst.str(string("11 output",13)) pin011 := 1 elseif pin111 == 1 and pin112 == 1 pst.str(string("11 output",13)) pin011 := 1 if pin121 == 1 and pin122 == 0 pst.str(string("12 input",13)) pin012 := 0 elseif pin121 == 0 and pin122 == 0 pst.str(string("12 output",13)) pin012 := 1 elseif pin121 == 1 and pin122 == 1 pst.str(string("12 output",13)) pin012 := 1 if pin131 == 1 and pin132 == 0 pst.str(string("13 input",13)) pin013 := 0 elseif pin131 == 0 and pin132 == 0 pst.str(string("13 output",13)) pin013 := 1 elseif pin131 == 1 and pin132 == 1 pst.str(string("13 output",13)) pin013 := 1
i get mixed results out of the terminal ill put some below
[code]
Comments
which would really help improving reliability ;o)
when i first wrote the code it worked fine. I also have a bs2 version of this code so i know the process works to determine whether the pins are inputs or outputs.
Solve your problems one at a time.
A good way to confirm coms, is to simply send a 'I'm here' string of reasonable length, and including the pgm name and version number,helps you confirm you really are testing that latest build...
It sounds like you have solved the unstable comms, now you need to compare your version that does work, and this one, and decide what differs.