(3) Send out one block data (Transmit – the data more than two characters)
Step 1: Enable TXC signal, and the bit 0 of the address of offset+4 just sets “1” .
Step 2: Send out the data. (Write all data to the offset+0 of the current COM port address)
Step 3: Wait for the buffer’ s data empty. Check transmitter holding register (THRE, bit 5 of the address of offset+5), and transmitter shift register (TSRE, bit 6 of the address of offset+5) are all sets must be “0” .
Step 4: Disabled TXC signal, and the bit 0 of the address of offset+4 sets “0”
(4) Receive data
The
(5)Basic Language Example a.) Initial 86C450 UART
10OPEN “COM1:9600,m,8,1” AS #1 LEN=1
20REM Reset DTR
30OUT &H3FC, (INP(%H3FC) AND &HFA)
40RETURN
b.) Send out one character to COM1
10REM Enable transmitter by setting DTR ON
20OUT &H3FC, (INP(&H3FC) OR &H01)
30REM Send out one character
40PRINT #1, OUTCHR$
50REM Check transmitter holding register and shift register
60IF ((INP(&H3FD) AND &H60) >0) THEN 60
70REM Disable transmitter by resetting DTR
80OUT &H3FC, (INP(&H3FC) AND &HEF)
90RETURN
c.) Receive one character from COM1
10REM Check COM1: receiver buffer
20IF LOF(1)<256 THEN 70
30REM Receiver buffer is empty
40INPSTR$”
50RETURN
60REM Read one character from COM1: buffer
70INPSTR$=INPUT$(1,#1)
80RETURN