Documente Academic
Documente Profesional
Documente Cultură
21-Aug-2010
Paranz
Serial Communication
August 21, 2010 DAY 3 Afternoon Session
21-Aug-2010 Paranz 2
OVERVIEW
Basics of serial communication PIC UART architecture Programming exercises
TX and RX characters Interrupts FIFO buffer SMS application
E-gizmo GSM module
21-Aug-2010 Paranz 3
21-Aug-2010
Paranz
21-Aug-2010
Paranz
MAX232
- RS232 Line Driver Chip - voltage double & voltage inverter
21-Aug-2010
Paranz
MAX232
to PC RX +10v from MCU TX +5v 0v -10v
to MCU RX +5v 0v
from PC TX +10v
-10v
21-Aug-2010 Paranz 8
RS232 Signal
21-Aug-2010
Paranz
DB9 Connector
21-Aug-2010
Paranz
10
Synchronous mode
specialized applications
21-Aug-2010 Paranz 11
21-Aug-2010
21-Aug-2010
Paranz
13
TXSTA Register
UART Transmit Status and Control 0 Asynchronous mode Not used if TX9=0 register USART UART
0 8-bit data
1 TSR is empty 0 TSR is active 1 - Enable TX 1 high speed Baud Rate 0 low speed Baud Rate
Paranz 14
Baud Rate =
21-Aug-2010
Paranz
15
21-Aug-2010
Paranz
17
21-Aug-2010
Paranz
18
//High-speed //Baud Rate = 9600 bps at 20 Mhz //Set UART in Asynchronous mode. //Enable serial port. //Enable Transmit. //Disable Receive. //8-bit data
21-Aug-2010
Paranz
20
TXREG=0x41;
1 0 129 1 0 1
21-Aug-2010
Paranz
21
HYPERTERMINAL
21-Aug-2010
Paranz
22
HYPERTERMINAL
21-Aug-2010
Paranz
23
21-Aug-2010
Paranz
24
21-Aug-2010
Paranz
25
21-Aug-2010
Paranz
26
21-Aug-2010
Paranz
27
RCSTA Register
UART Receive Status & Control Reg.
21-Aug-2010
Paranz
28
10
21-Aug-2010
Paranz
32
21-Aug-2010
Paranz
33
11
21-Aug-2010
Paranz
34
21-Aug-2010
Paranz
35
21-Aug-2010
Paranz
36
12
21-Aug-2010
Paranz
37
+CMTI: "SM",13 <SMS is received> AT+CMGR=13 <Read SMS> +CMGR: "REC UNREAD","+639277949241",,"10/07/17,11:28:40+32" Led2 on <SMS> +CMTI: "SM",14 <SMS is received> AT+CMGR=14 <Read SMS> +CMGR: "REC UNREAD","+639277949241",,"10/07/17,11:32:48+32" Led2 off <SMS>
21-Aug-2010
Paranz
38
main.c
UARTGetChars() DoGSMTask() ReadSMS() is_equal()
21-Aug-2010 Paranz 39
13
42
14
EGBT9830 Module
E-gizmo Bluetooth module National Semiconductor LMX9830 Simply Blue BT module chip 3.3V supply 9600 bps (preset)
21-Aug-2010 Paranz 43
EGBT9830 Module
21-Aug-2010
Paranz
44
EGBT9830 Module
21-Aug-2010
Paranz
45
15
LMX9830 Command
Communication interface
Command/Event structure Packets
21-Aug-2010
Paranz
46
LMX9830 Command
21-Aug-2010
Paranz
47
16