getting an 'echo' on serial interface?
Hi. I have a BS2 breadboard, and i want to use the built-on db9 serial port to communicate with a linux terminal. I'm using DEBUG to send data, and SERIN to receive. Basicallly, i'm trying to get the stamp to work it's way though the username and password prompts, and then get the IP address of the host. What I finding, though (using ttysnoop on the terminal), is the data the terminal sends to the stamp, the stamp "echos" back to the terminal. The terminal interprets this as keystrokes as if entering the username. Is there any way to turn this off?
Here's a code snipet of what I'm attempting to do:
SERIN 16, MyBaud, 5000,noun, [noparse][[/noparse]WAIT("in:"), sData] 'wait for "login:" to show. If not within 5 sec, goto noun.
' BAFG.CDE
OUTH = %00000001 'Update display w/ progress
DEBUG "myusername",CR,LF
SERIN 16, MyBaud, [noparse][[/noparse]WAIT("rd:"), sData] 'wait for "Password:" to show.
OUTH = %00100001 'Update display w/ progress
PAUSE 10
DEBUG "mypassword", CR,LF
SERIN 16, MyBaud, [noparse][[/noparse]WAIT("]"), sData] 'wait for "]", which is the prompt.
OUTH = %01100001 'Update display w/ progress
'send command string to get IP address from host.
SEROUT 16, MyBaud, [noparse][[/noparse]"ifconfig | grep 'inet addr' | awk '{print $2}' | sed 's/addr://' | grep 172.25",CR,LF]
OUTH = %11100101 'Update display w/ progress
SERIN 16, MyBaud, [noparse][[/noparse]STR ByteArray \15 \CR] ' Read in the IP address to a char array
'
Thanks.
Here's a code snipet of what I'm attempting to do:
SERIN 16, MyBaud, 5000,noun, [noparse][[/noparse]WAIT("in:"), sData] 'wait for "login:" to show. If not within 5 sec, goto noun.
' BAFG.CDE
OUTH = %00000001 'Update display w/ progress
DEBUG "myusername",CR,LF
SERIN 16, MyBaud, [noparse][[/noparse]WAIT("rd:"), sData] 'wait for "Password:" to show.
OUTH = %00100001 'Update display w/ progress
PAUSE 10
DEBUG "mypassword", CR,LF
SERIN 16, MyBaud, [noparse][[/noparse]WAIT("]"), sData] 'wait for "]", which is the prompt.
OUTH = %01100001 'Update display w/ progress
'send command string to get IP address from host.
SEROUT 16, MyBaud, [noparse][[/noparse]"ifconfig | grep 'inet addr' | awk '{print $2}' | sed 's/addr://' | grep 172.25",CR,LF]
OUTH = %11100101 'Update display w/ progress
SERIN 16, MyBaud, [noparse][[/noparse]STR ByteArray \15 \CR] ' Read in the IP address to a char array
'
Thanks.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Robert
Just out of curiosity, why is the 4.7K ohm resistor between the TX and RX pins?
Thanks!
The popular Max232 and Max233 chips and their cousins are used for just such a reason.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
If the echo isn't desirable then you can easily use a couple of the other pins and use a MAX232 as Tom suggested to translate the logic level signals to ones more suitable for a standard RS-232 serial connection.
Alternatively if you just wanted the Stamp to talk to a PC that is running an application or terminal then you could look at the Parallax USB2SER or even better the PropPlug. These are basically just USB to logic level serial translators and it looks like a COM port on the PC. On the Stamp end just use the ground, TX, and RX signals. You can ignore the one normally used to reset the chips for programming.
Robert
-Phil