Pin 16 question
firestorm.v1
Posts: 94
When using the serial port on the HomeWork board (this may affect other boards, BOE, etc..) I know that i can use the serial port (programming port 9 pin Dsub) as pin 16.
Is there a way to turn off local echo on that serial port? Example, i hit "A", the stamp receives "A" and the Termainal app on the PC gets the letter "A". It's like the TX/RX pins on the stamp are connected to each other. Can someone verify this?
What I am trying to do is create a Serial LCD display that is bi-directional, where a pushbutton on the Basic Stamp, sends a command to the PC via the serial cable to interpret. (Right now, the button returns the value "1") but the PC also sends commands to the Stamp to display characters on the LCD, position cursor, set up LCD displays, etc..
Thanks in advance.
Is there a way to turn off local echo on that serial port? Example, i hit "A", the stamp receives "A" and the Termainal app on the PC gets the letter "A". It's like the TX/RX pins on the stamp are connected to each other. Can someone verify this?
What I am trying to do is create a Serial LCD display that is bi-directional, where a pushbutton on the Basic Stamp, sends a command to the PC via the serial cable to interpret. (Right now, the button returns the value "1") but the PC also sends commands to the Stamp to display characters on the LCD, position cursor, set up LCD displays, etc..
Thanks in advance.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...
Since you're sending this data from the PC in the first place, in theory you already know the 'echo' will come back, and know how many characters to 'toss'. But it can be a pain.
On the good side, you can use ANY I/O pin on the BS2 as an RS-232 recieve pin without a MAX232, IF you put a 22Kohm resistor in series with the signal. But then for the BS2 to 'talk' back with RS-232 levels you'll still need a MAX232.
Thanks for your help with this, I have been wanting to learn signalling via RS232 and I guess here's my chance.. [noparse]:)[/noparse]
So, you can see the +12 signal is associated with a zero-volt TTL, and a -12 volt signal associated with a +5 volt TTL. Thus, the RS-232 drivers were sometimes called "inverter-drivers".
A full 'byte' (it's a byte oriented protocol) has a 'start-bit', 8 'data-bits', and one or more 'stop-bits'. The 'start-bit' guaranteed a transition at the start of the byte, while the 'stop-bit' guaranteed some time at the end of the byte.
The MAX232 chip implements the full RS-232 specification. With the 'b' and 'c' variants, that +- 12 volts dropped down to +- 10 volts, and some laptops only put out +- 3 volts.
Now, the BS2 CAN recieve ( that's RECIEVE only) the +-12 volt signal if you put a 22 Kohm resistor in series with it, to reduce the current to something that won't damage the PIC. When you do that, there's an inversion left in the signal, so the BS2 supports recieving this 'Inverted' signal with the 'Inverted' baud-modes. What's 'inverted' and what isn't depends on your interpretation, so this can take some experimentation to get it to work.
Still, to TRANSMIT the 'true' RS-232, +- 12 volt (or +- 10 volt, whatever) signal will still take a MAX232 driver.
Post Edited (allanlane5) : 4/21/2006 6:59:22 PM GMT
There are other similar ready-made circuit-boards for implementing a full-fledged 5V-to-RS232 solution.
Post Edited (PJ Allen) : 4/21/2006 7:12:17 PM GMT
Allanlane5: Thank you for the very informative post. That will help tremendously as soon as I can afford the parts. Just to make sure I understand, TTL is signalling between 0 and 5v and RS232 is between 0 and 12vdc or 0 and -12vdc, correct?
Thank you both.
Allan's post was excellent and quite detailed. I'd just like to make one addition to one part of it. Allan said:
"A full 'byte' (it's a byte oriented protocol) has a 'start-bit', 8 'data-bits', and one or more 'stop-bits'. The 'start-bit' guaranteed a transition at the start of the byte, while the 'stop-bit' guaranteed some time at the end of the byte."
To that I would just add the following:
If parity is specified (common forms: odd or even) one additional bit will be transmitted, prior to the 'stop-bit', which contains the appropriate parity for the particular data byte to be transmitted. The bit is set or not, based on the parity specified, and the raw parity of the 8 bits in question. Here are the basic rules, although the calculation is much simpler than these rules may seem to imply (Note: The "raw parity" is the parity of the 8 data bits alone. The raw parity is calculated as the left-truncated one bit wide total of all 8 data bits.):
If ODD parity is specified, and the raw parity is already ODD, the parity bit is set to ZERO. If ODD parity is specified, and the raw parity is EVEN, the parity bit is set to ONE to cause it to be ODD. In either case the 8 data bits + the parity bit, now represent the appropriate parity as specified.
If EVEN parity is specified, and the raw parity is already EVEN, the parity bit is set to ZERO. If EVEN parity is specified, and the raw parity is ODD, the bit is set to ONE to cause it to be EVEN. In either case the 8 data bits + the parity bit, now represent the appropriate parity as specified.
If you want the "bible" on asynchronous serial data transmission, the following comes HIGHLY recommended: "Serial Port Complete", Jan Axelson, and here is a link to her web site: http://www.lvr.com
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Post Edited (Bruce Bates) : 4/21/2006 9:50:51 PM GMT