Download PB PICBASIC user's manual

Transcript
PICBASIC DATABOOK
SET RS232
SET RS232 baud rate
Declare RS232C communication
Baud rate is fixed value.
EXPLANATION
This instruction is used to declare use of RS232 hardware. In order to use GET or PUT instruction, you must use this
instruction in the first part of program. Once SET RS232 is activated, PICBASIC assign port14 and port15 as RS232C ports
and initialize them. You can use one of baud rates shown in following table.
SET RS232 2400
2400 baud rate
SET RS232 4800
4800 baud rate
SET RS232 9600
9600 baud rate
SET RS232 19200
19200 baud rate
SET RS232 38400
38400 baud rate
SET RS232 57600
57600 baud rate
SET RS232 76800
76800 baud rate
SET RS232 96000
96000 baud rate
SET RS232 115200
115200 baud rate
EXAMPLE
The following program displays data from PC on LCD, and ECHO.
10
120
SET RS232 4800
DIM DATA AS BYTE
LCDINIT
CSROFF
GET DATA,100
IF DATA=0 THEN GOTO 10
PRINT CHR(DATA)
PUT DATA
DATA = 0
GOTO 10
'Declare hardware RS232 at 4800 baud rate
‘Display received data on LCD
COMFILE Technology