BT-Basic provides several statements for using the RS-232 ports for communication. These statements enable the system to open and configure a port for RS-232 use.
In order to transfer data using RS-232 protocol, an I/O port must be established and configured for RS-232 data transfer. This port is a physical connection to a serial device (such as a printer), from a port on the mux card.
A pseudo-device file handles the actual transfer of data to and from the physical device. Thus, when you communicate via RS-232 you are actually accessing a pseudo-device file that the operating system maps to a physical device.
Once an RS-232 file is created, the
assign to
statement allows the port (file) to be opened and accessed by the system for data transfer. Then the parameters associated with the RS-232 port are set with one or morecontrol
statements.The example program shown in Example 1 demonstrates a data transfer using these statements.
Example 1 Example of a data transfer
assign @Terminal to "/dev/com/5" ! Associates @Terminal with port "COM5"
control @Terminal, 3; oti ("411") ! Sets the baud rate to 1200, EVEN parity
output @Terminal; Com$ ! Sends string Com$ sequentially to @Terminal
assign @Terminal to * ! Cancels the @<IDname> association and
! closes the device "COM5"
If desired, you can use the
status
statement to interrogate an RS-232 register and return its current value. See Example 2.Example 2 Example of using the
status
statement to interrogate an RS-232 registerassign @Terminal to "/dev/com/5" ! Associates @Terminal with port "COM5"
control @Terminal, 3; oti ("411") ! Sets the baud rate to 1200, EVEN parity
status @Terminal, 3; Status ! Interrogates Register 3
print ito$ (Status) ! Prints 4611(The WN system forced the additional
! settings 4000 (CLOCAL) and 0200 (CREAD)
The
ito$
function converts the octal number retrieved by thestatus
statement into a string containing its octal equivalent.
Numpang promo ya Admin^^
ReplyDeleteajoqq^^cc
mau dapat penghasil4n dengan cara lebih mudah....
mari segera bergabung dengan kami.....
di ajopk.com ^_~
segera di add Whatshapp : +855969190856