
33
32
RS-232C INTERFACE/CLOCK
Transmit mode : RS-232C interface
n
Type : EIA - RS - 232C
n
Method : Full-duplex, asynchronous transmission Fomat
F11
Baud rate
600, 1200, 2400, 4800, 9600, 19200
F12
Output mode
stable, Unstable, Data is required
①
Baud rate : 600 bps - 19200 bps
Choose Baud rate in SET mode (F11).
Refer to SET mode.
②
Data bit : 8, Stop bit : 1, Parity blt : None
③
Code : ASCII
④
When data is sent to computer ?
Set in SET mode (F12).
⑤
Data Fomat
,
,
,
DATA (8 byte)
K
G CR LF
US (unstable)
ST (stable)
OL (over load)
GS (gross)
NT (net)
Device ID
Lamp status byte
Blank
※
Simple communication program (BASIC)
10 OPEN "COM1:9600,N,8,1" As #1
20 IF LOC(1) = 0 THEN 60
30 A$ = INPUT$(1,1)
40 PRINT A$ ; " ";
50 GO TO 20
60 B$=IN KEY$ : IF B$ ="" THEN 20
70 PRINT B$ ; " ";
80 PRINT #1,B$;
90 GO TO 20
※
Simple communication program (C)
#include <bios.h>
#include <conio.h>
#define COM1 0
#define DATA_READY 0x100
#define TRUE 1
#define FALSE 0
#define SETTINGS ( 0x80 | 0x03 | 0x00 | 0x00)
int main(void)
{
int in, out, status, DONE = FALSE;
bioscom(0, SETTINGS, COM1);
cprintf("... BIOSCOM [ESC] to exit ...\n");
while (!DONE)
{
status = bioscom(3, 0, COM1);
if (status & DATA_READY)
if ((out = bioscom(2, 0, COM1) & 0x7F) != 0)
putch(out);
if (kbhit())
{
if ((in = getch()) == '\x1B') DONE = TRUE;
bioscom(1, in, COM1); }
}
return 0;
}