FAST Forth Native-Language Embedded Computers
FAST Forth Native-Language Embedded Computers
FAST Forth Native-Language Embedded Computers
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
RS-232<br />
The hardware description is a<br />
single-ended digital signal of at least<br />
k8.0 volts output. The inputs are<br />
defined as having thresholds of k3.0<br />
volts. This gives a very high noise<br />
rejection and hysteresis, which re-<br />
sults in excellent performance up to<br />
about 50 feet at 9600 baud.<br />
RS-422 and RS-485<br />
RS-422 uses the same UART and<br />
identical software of the RS-232 stan-<br />
dard, while the RS-485 requires one<br />
additional signal. The RS-485 de-<br />
fines a "Party Line" or "Multi-Drop"<br />
communications method allowing<br />
up to 32 talkershsteners to hang on<br />
the same set of lines.<br />
Allowing multiple talkers requires<br />
that each node, when not specifically<br />
speaking, be in a receive, not transmit,<br />
state. This is sometimes called "tri-<br />
stated." If two talkers simultaneously<br />
attempt to speak on the same line,<br />
excessive current will flow and the<br />
data from both will be garbled. This<br />
requires extra hardware to gate the<br />
transmitter on and off while the re-<br />
ceiver is turned off and on. In the B&B<br />
COM board used, 232CICC1 is used to<br />
provide this function.<br />
Both of these standards refer to<br />
balanced transmission lines<br />
Listing One. 1<br />
label serial(coml,2)<br />
ax push bx push dx push<br />
BEGIN CS: COM-PORT #) DX MOV<br />
DX AL IN 4 # AL TEST<br />
O WHILE CS: COM-PORT #) DX MOV<br />
2 # DX SUB dx a1 in<br />
cs: head #) bx rnov cs: a1 0 [bx] rnov<br />
bx inc end-of-serial-buffer # bx cmp<br />
O= if serial-buffer # bx rnov then<br />
cs : bx head #) rnov<br />
REPEAT<br />
$20 # dx rnov $20 # a1 rnov a1 dx out<br />
dx pop bx pop ax pop iret end-code<br />
Listing Two.<br />
label serial (com3,4)<br />
ax push bx push dx push<br />
BEGIN CS: COM-PORT #) DX MOV<br />
DX AL IN 4 # AL TEST<br />
O WHILE CS: COM-PORT #) DX MOV<br />
2 # DX SUB dx a1 in<br />
cs: head #) bx rnov cs: a1 0 [bx] rnov<br />
bx inc end-of-serial-buffer # bx cmp<br />
O= if serial-buffer # bx rnov<br />
then cs: bx head #) rnov<br />
REPEAT<br />
$20 # a1 rnov $A0 # dx rnov a1 dx out<br />
$20 # dx rnov a1 dx out dx pop<br />
bx pop ax pop iret end-code<br />
rather than the single-ended<br />
(unbalanced) line of the RS- Listing I<br />
232 standard. Balanced lines<br />
are a pair of lines which<br />
transmit opposite polarity<br />
CREATE DOS INTS<br />
: DOSINT# ( - b)<br />
$OC C, SOB C, $72 C, $73 C,<br />
COM @ 2/ DOSINTS + C@ ;<br />
signals simultaneously to : SET-SERIAL-VECTOR ( - )<br />
represent the serial data.<br />
?cs: DOSINT# $72 <<br />
Balanced lines have<br />
IF serial (coml, 2)<br />
much higher data integrity.<br />
ELSE SERIAL (COM3,4)<br />
The net current through<br />
the pair is a null value, so<br />
THEN DOSINT# interrupt! ;<br />
the interference output is CREATE INT#S<br />
reduced as well. Standard<br />
CI $21 C, SF7 Cl $21 C, SFB C, $A1 C, SF7 C, $A1 C,<br />
drivers typically pull one<br />
lineto+5voltswhilethe<br />
other is pulled to ground.<br />
: SET-8259 ( - n a)<br />
COM @ INT#S +<br />
A bit change will reverse<br />
the levels, giving an effective<br />
*10 volt transition from<br />
I<br />
COUNT >R C@ DUP PC@ R> AND SWAP ;<br />
low voltage logic-level power supplies.<br />
Al Mitchell has been doing embedded systems programming since 1974, when<br />
Due to the balanced lines, more powerful drivers, and he worked on lntel 4004,<br />
sensitive receivers, distances can be extended to as much I<br />
as four kilometers under ideal circumstances, or to very<br />
high data rates over shorter distances.<br />
<strong>Forth</strong> Dimensions 9 March 1994 April