User`s manual

mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
program RS232com
dim Received_byte as byte
main:
USART_init(2400)
' initialize USART module
while true
if USART_data_ready = 1 then
' if data is received
Received_byte = USART_read
' read received data,
USART_write(Received_byte)
' send data via USART
end if
wend
end.
Figure: RS232 HW connection
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
163
page
SUB-D 9-pin connector
+
+
+
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
serial cable
(1 to 1)
Receive data (Rx)
Send data (Tx)
+
MAX232
C1+
V+
C1-
C2+
C2-
V-
T2out
R2in R2out
T2in
T1in
R1out
R1in
T1out
GN
D
Vcc
+5V
Tx line to MCU
Rx line to MCU
4.7uF
4.7uF
4.7uF
4.7uF