Remote-processing BASIC 52 Manual do Utilizador Página 14

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 163
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 13
RPBASIC-52 PROGRAMMING GUIDE
1-11
0 Wait for "RING" message. Modem
auto answers.
1 Look for "CONNE CT".
2 Get password. If invalid, prompt for
password again.
3 Send successful log in message .
Prompt for comm and and process
them.
4 Take modem off line and reset
5 Delay for a few seconds and send sign
on message.
The actual program is more complicated than the
steps indicate. Timeouts are used to disconnect the
modem when there is inactivity. Three failed
passw ord attempts takes t he m odem off line.
Ringing but no connect takes the modem off line.
Superfluous <cr>'s are ignored.
Activity timeout is set for 10 seconds. The
ONTICK routine checks for activity every second
when the program cycle advances to step 1 and
beyond. ON TICK cou ld be faster if it is necessary.
Keep in mind that ONTICK interrupts have the
highest priority. Keep tick interrupt processing
times short and as infrequent as possible. Frequent
and/or long processing times take away from other
program times.
ON COM $ interrupt uses a program cycle pointer
(variable CYCLE) to direct the next activity on an
interrupt. When a message is received, an interrupt
is generated. Processing the message is handled by
the appropriate routine poi nted to by CY CLE . A
<cr><lf> sequence is simply ignored and treated as a
non-event.
After the password is accepted, the main purpose of
the application takes over. There are many
scenarios, or situations, possible:
1. The comp uter is u sed for data log ging.
Dialing in merely dumps data.
2. The computer is used for control. A dial up
is for new instructions or parameters.
3. Some combination of data logging and
control.
4. A computer will dial up and query and/or
issue new instructions.
5. A person using a terminal will dial up the
control card and query and/or issue new
instructions.
6. A computer and/or person at a terminal w ill
dial up and query and/or issue new
instructions.
7. A new program is downloaded to the card.
The number of possible applications is much too
complex to even begin showing code.
Some applications use a person at a term inal to
remotely query the card. In this situation, it is nice
to return a character as soon as it is typed in. This
can be done by setting the users terminal to local
echo. However, you don't know if the card received
what you send. The remote card can echo back
characters as they are sent. To do this requires a
program change. ON COM $ must either be disabled
or changed to generate an interrupt on each character
input. If ON COM$ is disabled, then the m ain
program has to be structured so it can process
incom ing characte rs imm ediately.
If ON COM$ generates an interrupt on each
character, then the incoming data rate should be
relatively slow (1 character every 50 ms). Note this
is not the baud rate. Th e baud rate can still be 9600.
It just should not get characters more than 20
times/second. For hand typing situations, this is just
fine.
When another computer is talking to the card,
immediate echo may not be necessary. Instead, the
incoming message can be echoed back w hen a <cr>
is received (or when ON COM$ generates an
interrupt). The cycles would merely increase based
on the command. In some ways, it becomes like a
RS-485 network described above. A comm and is
received, parsed, and processed.
Scenario 7 requires some cautionary notes. It is not
unusual to download program s through a m odem .
There is no difference between a modem down load
and one directly connected to a PC. The UI and UO
commands must be set to 1 when using COM 1 and
before going into the command mode (executing an
END or STOP statement in th e program).
A problem arises when communication is lost for
some reason. While the RPC cards have a watch
dog timer, they are not enabled during command
mode (This is true of the RPC-320 and RPC-330.)
When comm unication is lost, usually all that is
required is to redial the modem, assuming it has
been set to auto answer. If communication is lost
due to some external force (cell phone or netw ork
failure), the card will just sit there an d not ru n.
When the application is mission critical, an external
Vista de página 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 162 163

Comentários a estes Manuais

Sem comentários