
RPBASIC-52 PROGRAMMING GUIDE
1-10
processed unless the host "knows" this node has just
reset. Any valid command, unless it is "E", returns a
"N2" negative acknowledgement. The host
recognizes this as a power up condition. Line 1220
checks for a valid power up flag.
Command F could return any number of status
conditions. The way it is implemented here, data is
returned to indicate the type of error. A 0 return
indicates things are just fine. The type and value of
data returned will depend upon the number of error
conditions. If error conditions were binary weighted
(1, 2, 4, 8...) then the receiver could determine
exactly what errors are in the system.
A unique address in the message packet, >99 , tells all
units using this program to go to a 'safety' mode. It is
used for emergency shut down situations. Nodes do
not reply to this command. The program example
does a simple return as your application determines
appropriate respon se. The ad vantage to using this
command is in emergency situations all units get the
message in under 50 ms. It could take considerably
longer, perhaps 1 second in a 20 node system , to poll
all units.
A networking factor is communication time. Longer
messages take longer to p rocess. At 9 600 ba ud, it
takes about 12 ms to send out a 10 character message.
This assumes the host can assemble a message string
instantaneously. Add 5 ms processing time by the
remote card (and 5 ms could be considered a
minimum) before anything is sent out. It could be
nearly 50 ms for a complete exchange. Using a
simple command structure, about 20 message
exchanges per second are possible.
Increasing the baud rate decreases message exchange
time, but there is a point of diminishing return. Going
to 19,200 baud cuts serial communication time in
half. However, message processing time stays the
same. At some point in time the processing power of
the host and remote units is a major factor. RPC
cards process comm ands roughly at a rate of 1/ms.
To verify an address and begin ca rrying out a
command takes about 30 ms. Any additional data
processing increases this time.
The next application in Appendix B uses a modem in
a receive application. T his illustration uses a g eneric
1200 baud modem, although a higher speed modem
can be used provided incoming data do es not com e in
so fast the buffer fills and characters are lost.
COM1 is set as the receive port. The modem
connects to the RPC card serial port using a VTC-9F
serial cable. Most external modems have a DB-25F
(female) connector for the serial port, therefore a DB-
9F to DB -25M adapter is necessary. Also, since both
the RPC card and modem are designed to plug into a
PC, a null modem adapter must be inserted between
the DB-9 connector on the VTC-9F and adapter. The
connectors are shown below:
modem > DB9F to DB-25M > null modem > VTC-9F
This can be somewhat of a kludge. A nother way is
to make a custom cable from the R PC card 10 pin
IDC connector to a DB -25M. If you choose this
route, connect the pins in the following manner:
IDC DB-25 Function on
male RPC card
3 2 Tx output
4 5 RTS input
5 3 RXD input
6 4 CTS output
9 7 Ground
Your modem may have configuration switches. Set
these switches to the following conditions to use the
sample program:
Force DTR lead (pin 20) true to enable modem
to execute commands.
Modem responds to commands with english
word result codes.
Result codes sent to the RPC card.
Echo characters while in the command state.
Modem automatically answers an incoming
call.
Force CD lead (pin 8) true.
Enable modem command recognition.
You may have to set these conditions in software.
There is a certain sequence, or protocol, that is
followed when answering a phone. The steps
(CYCLE) follows:
CYCLE Action
Comentários a estes Manuais