For the past few days I’m trying to do a establish a simple serial communication between a BA pro 28 and a terminal program (Hyper terminal, Docklight) running on a PC. I have tried everything that I know of and still could not get the BA pro 28 to respond to a command that is given from the PC.
I’m trying to blink an LED that is connected to P5 when the command 45 is received (very simple but does not work for me)
[code]main
entoli var word
loop
serin S_IN,i9600,[entoli]
if entoli=45 then
high p5
pause 2000
low p5
endif
goto loop
end[/code]
Any help would be deeply appreciated.
I’m really stuck on this
It would help to have a little more information here in order to try to help.
For example does the serin receive anything? Easy way to test is to try something like comment out your if and endif lines and see if your LED lights when any input is received.
How are you sending the information on the PC? Your serin you are showing is expecting binary data. If you are sending ASCII values you might want to add something like DEC.
serin … [dec entoli]
The serin command does receive data. If I make the command “serin S_IN,i9600,[dec entoli]” then if I use terminal1 of the IDE and send the number 45 I can always see the LED blinking. The problem is that I cannot do the same using hyperterminal of other terminal software. Any ideas as to why it does not work with hyperterminal ?
I am not sure, but have you in hyperterminal tried entering the number followed by hitting the enter (or CR) key? It is probably buffering your input until a CR is detected…
My assumption is that in Hyperterminal you have properly connected to the serial port with the correct baud rate, etc…
If you are still receiving information in the serin but not the right value, you might want to do a serout back to S_OUT to see what you did receive. Or you could do like I did in a C project and use the LEDs to blink the number out. (Use one LED for 100’s, the next for 10s and the next for 1s…)
Um, Hyperterminal, are you using a regular serial cable to make the connection to the ABB? Hyperterminal ALWAYS asserts DTR which is used as a reset on the ABB+BAP. This is discussed in some length elsewhere on the forum, perhaps hyperterminal and dtr might be good search words.
edit: here is a thread where someone else was having this problem. I have also tested disconnecting the DTR signal in a standard serial cable and verified this allowed hyperterminal to work with s_in/s_out, however, realize that if you make this mod then the same cable can not be used when you go to re-program the BAP as it requires the DTR signal to syncronize or something when downloading.
I got hyperterminal working but inserting a switch between the DTR signal and pin 3 of the BAP. When I want to program the BAP I flip the switch and the DTR signal is connected to the BAP.