10 - Lecture10
10 - Lecture10
ﺍﻟﺘﺠﺎﺭﺏ ﺍﻟﻌﻤﻠﻴﺔ
Programming
Embedded Systems Microcontroller
RS485
RS485
RS485
A,B
VA>VB “1” VA<VB
“1”“0”
RS485
B A
RS485
RS485
ST TI MAXIM LTC
ST485 SN75176 MAX485 LTC485
:RS485
Faculty of Electrical and Electronic Eng. 213 Automatic Control & Automation Dept.
RS485
SPECIFICATIONS RS232 RS423 RS422 RS485
RS485
214
Practical Class 10 Programming Microcontrollers
RS485
B A
15Meter
Backbone with StubsDaisy Chain
RS485
Faculty of Electrical and Electronic Eng. 215 Automatic Control & Automation Dept.
RS485
PASSIVE DUPLEX CONTROL (AUTOMATIC ) ü
ACTIVE DUPLEX CONTROL (RTS Pin ) ü
RS485 RO, DI Passive Duplex ü
DE/RE Driver
No data to send §
“1”
Idle
Faculty of Electrical and Electronic Eng. 217 Automatic Control & Automation Dept.
RS232
Advantages Disadvantages
ü System-to-System ×
Chip-2-Chip
1200 ü .Chip-2-Sensor
100kb/s RS485<>TTL ×
ü
ü
:RS485MODBUS
MODEBUS
Multi Master/Slave
Master Device MODEBUS
Slave Device
1~252Slave Address •
Function code •
Byte Count •
Start Address •
255 byte maxData Stream •
Cyclic Redundancy CheckCRC •
Inter-frame-time
t3.5
Data
t1.5
Inter-character time-out (t1.5) = 750μs
Inter-frame delay (t3.5) = 1.750ms
Faculty of Electrical and Electronic Eng. 219 Automatic Control & Automation Dept.
70Byte9600bps
Slave address
70 ×8 = 560
× 1000 = .
58ms
.t3.5= 1.75ms
Start Master
Waitms 10
Waitms 100
End
220
Practical Class 10 Programming Microcontrollers
Start Slave
NO
UART INT
Yes
NO
Yes
Enable UART
NO
Check Count
Check CRC
Programming
YES
OK
Ignore Data
Set Data Value
End
MasterSlaveResponceMODEBUS
Slave
Slave
CRC
Faculty of Electrical and Electronic Eng. 221 Automatic Control & Automation Dept.
RS485|
Full-DuplexHalf-DuplexRS485
UART<>RS458
Max485
Config Print0 = Porte.2 , Mode = Set .RS485
“DE”“1”Config Print0
“0”“DE”
“DE”
Faculty of Electrical and Electronic Eng. 223 Automatic Control & Automation Dept.
Faculty of Electrical and Electronic Eng. 225 Automatic Control & Automation Dept.
RS232<>RS458
RS232<>RS458
RS232<>RS458
RS232<>UART<>RS458
RS232<>UART<>RS458
Max232 UART Max485
UART
RS232<>UART<>RS458
Faculty of Electrical and Electronic Eng. 227 Automatic Control & Automation Dept.
USB
USB
USB
USB
480Mb/s ü
. Plug & Play ü
ü
127 ü
:USB
USB 1.0 & USB 1.1 & USB 2.0& USB 3.0USB
USB
”Host Controlled” USB
)
USB
”On-The-Go”
USB
ü
ü
Plug& Play
Plug & Play USB
USB
VID, PID
USB
Faculty of Electrical and Electronic Eng. 229 Automatic Control & Automation Dept.
USB
USB
A §
B §
VCC1
D-2
D+3
GND4
'1' D+&D- USB
D- '0' D+ '1'
'0' '1''0'
'1'
'1'
USB
D- D+
D- .1
D+ .2
.3
USB
USB
USB
USB Device USB
USB Function Host Controller IC USB
USB
USBUSB Function
USB Function Endpoint
EndpointUSB Function
InOut
Faculty of Electrical and Electronic Eng. 231 Automatic Control & Automation Dept.
USB1 EP1 In
USB1
[Addr : 2] [Endpoint : EP1] [In]
PipePipe
EP0 In & EP0 Out Pipe0 Pipe
Pipe
Control Transfers §
Interrupt Transfers §
Isochronous Transfers §
Bulk Transfers §
USB
Frame USB
1ms USB1.1, USB2.0
125µs
Transaction
Token Packet
In Token
Synchronization .1
Packet Identity PID .2
128Address .3
Endpoint .4
5Cyclic Redundancy CheckCRC .5
Faculty of Electrical and Electronic Eng. 233 Automatic Control & Automation Dept.
Handshake Packet
Acknowledge
Not acknowledge
Stall
USB
USB USB
USBHardware .1
. .2
USB
USB
UARTUSB
USB
FT232
FTDIUSB<>UART
HardwareUSB
USB
.COM
Faculty of Electrical and Electronic Eng. 235 Automatic Control & Automation Dept.
FT232BM
ü
VCP& D2XX.DLLFTDI ü
USB1.1, USB2.0 ü
ü
300kb~2Mb ü
384FIFO ü
128FIFO ü
VID, PID ü
ü
USBUSB
USB
USB
11
PWREN#
Faculty of Electrical and Electronic Eng. 237 Automatic Control & Automation Dept.
Wake up
USB
Serial Interface EngineSIE
USBUSB §
CRC §
Start Of Packet, End Of Packet, Resume, Reset §
NRZI §
PID §
USB1.1USB Transceiver
D+ USB2.0,
FT232BM
6MHz48MHz
EEPROM PID, VID
RS232<>UART<>USB
RS232<>UART<>USB
Faculty of Electrical and Electronic Eng. 239 Automatic Control & Automation Dept.