Remote-processing RPC-30 Manual de usuario Pagina 17

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 38
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 16
CHAPTER 4 SERIAL PORTS
RPC-30 Page 15
Figure 4-3 Data packet
ACCESSING SERIAL BUFFERS
You can access C OM1 and COM 2 buffers in three w ays:
1. INPUT statement. This removes all characters in
the buffer up to the term inator cha racter and puts
them into a variable.
When using the INPUT statement, program
execution is suspended until a < cr> (Enter key) is
received. W hether this is a problem depends on
your particular application.
INPUT strips bit 7 on the COM1 port. This means
ASCII characters from 0 to 127 are received. The
INPUT statement can return a maxim um string
length of about 150 characters.
2. INKEY$(n) function. Characters ar e removed one
at a time. A null string is returned when the buffer
is empty.
In this mode, you have access to the full 256 bytes.
If you don' t read the buffer an d the buffer fills, all
subsequent characters are discarded. INKEY$(n)
may be used anywhere in the program.
3. COM$(n) retrieves all characters in the buffer,
including < cr> ' s and other control co des. This
function is commonly used with ON COM$
multitasking statement. You can retrieve 128 of the
256 bytes in the serial buffer at one time.
SERIAL PORT FILE NUMBERS
CAM BASIC references the ser ial I/O ports by file
numbers, similar to DOS. The following table shows
the corresponding file number to serial I/O port and how
they are used with the various ports.
Description File Examples
COM1 1 PRINT "Hello"
PRINT #1," Hello"
INPUT A$
INPUT #1,A$
A$ = INKEY$(1)
COM2 2 PRINT #2," Hello"
INPUT #2,A$
A$ = INKEY$(2)
COMMANDS
The following is a list of CAMBASIC commands used
for serial I/O. Variations for many commands not listed
here. These commands and functions are ex plained in
the CAM BASIC Program ming M anual.
Command Function
CLEAR COM$ Clears serial input buffer
COM$ Returns string from buffer
CONFIG BAUD Sets serial port parameters
CONFIG COM$ Configures port for ON
COM $(n) interrupt
INKEY$ Returns a character from the
serial buffer
INPUT Receives string from port
LIST Outputs program listing
ON COM$ Calls subroutine on serial
input
PRINT Outputs data in various
formats
TAB Tabs to predetermined
positions
Vista de pagina 16
1 2 ... 12 13 14 15 16 17 18 19 20 21 22 ... 37 38

Comentarios a estos manuales

Sin comentarios