You are on page 1of 77

} {

Technology Processes Automation


|

@i@@N
Copyright 2012 Walid Balid - All rights reserved.
| 2011-2012

Page | 1

Technology Processes Automation

} {Serial Communications
0B

:
6B

:
.
.

.

.

Serial Communications

Parallel Communications

| 2011-2012

Asynchronous

Synchronous

LPT

I2C

ISA
EISA

SPI
PS2

Morse code telegraphy

o
o

)RS-232 (COM Port

VESA
ATA

RS-423

RS-485

SCSI
PCI

)Universal Serial Bus (USB

FireWire

PCMCIA

Ethernet

IEEE-1284
IEEE-488

Fiber Channel

InfiniBand

MIDI

DMX512

Serial ATA

SpaceWire

PCI Express

SONET and SDH

T-1, E-1

Page | 2

Technology Processes Automation

} {UART
1B

:(Universal Asynchronous Receiver and Transmitter Interface) UART



RS232 TTL
RS232 .UART
) (MCU-MCU ).(MCU-PC

AVR :

:UART .TXD, RXD

:USART TXD, RXD


XCK .

):(UART Frame Format


UART RS232
.

St : Start bit, always low.


Data bits : (0 to 8).
)P : Parity bit (Can be odd or even
Sp : Stop bit, always high.
IDLE : No transfers on the communication line (RxD or TxD), IDLE line is high.
| 2011-2012

Page | 3

Technology Processes Automation

:1 AVR ...UART
AVR UART :
MCU-A A MCU-A MCU-B
MCU-B A .D2 :
MCU-B B MCU-B MCU-A MCU-A B
.D1

...

| 2011-2012

Page | 4

Technology Processes Automation

:Bascom-AVR MCU-A
'-----------------------[Definitions]
$regfile = "m8def.dat"
$crystal = 8000000
$baud = 9600
'-----------------------[GPIO Configuration]
Config Pinb.0 = Input : Switch Alias Pinb.0 : Portb.0 = 1
Config Pinb.1 = Output : Led Alias Portb.1
'
'-----------------------[Variables]
Dim Var As Byte
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'--->[Main Program]
Do
If Ischarwaiting() = 1 Then
Var = Inkey()
If Var = "B" Then Toggle Led
End If
If Switch = 0 Then
Print "A" : Waitms 200
End If
Loop
End
'---<[End Main]
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Bascom-AVR MCU-B
'-----------------------[Definitions]
$regfile = "m8def.dat"
$crystal = 8000000
$baud = 9600
'-----------------------[GPIO Configuration]
Config Pinb.0 = Input : Switch Alias Pinb.0 : Portb.0 = 1
Config Pinb.1 = Output : Led Alias Portb.1
'-----------------------[Variables]
Dim Var As Byte
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'--->[Main Program]
Do
If Ischarwaiting() = 1 Then
Var = Inkey()
If Var = "A" Then Toggle Led
End If
If Switch = 0 Then
Print "B" : Waitms 200
End If
Loop
End
'---<[End Main]
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technology Processes Automation

Page | 5

| 2011-2012

} {RS232
2B

DTE .DCE

TTL :
:0 " "Space .+3V ~ +25V
:1 " "Mark .-3V ~ -25V
:x .-3V ~ +3V
: 25V GND
.500mA

| 2011-2012

Page | 6

Technology Processes Automation

:RS232
7B

)(Disadvantages

8B

)(Advantages

System-to-System

Chip-2-Chip

.Chip-2-Sensor

.
.RS232<>TTL
.Single Master/Single Slave


.
50

.
)(25
).(0 , 1
.

RS232 :

RS232 Serial Port COM

.
Address

Port

0x3F8

COM1

0x2F8

COM2

0x3E8

COM3

0x2E8

COM4

COMx DB-9Pin :

| 2011-2012

Page | 7

Technology Processes Automation

) (1, 2, 3, ., 9 :
Description

Function

Direction

Name

Pin

Carrier Detect

Control

In

CD

Receive Data

Data

In

RXD

Transmit Data

Data

Out

TXD

Data Terminal Ready

Control

Out

DTR

System Ground

Ground

---

GND

Data Set Ready

Control

In

DSR

Request to Send

Control

Out

RTS

Clear to Send

Control

In

CTS

Ring Indicator

Control

In

RI

):CD Carrier Detect (Control sent from DCE to DTE


.
):RxD Receive Data (Data sent from DCE to DTE
) (DCE ) .(DTE ) Mark state, 0 or

(Positive ) (Idle State, 1 or Negative .


):TxD Transmit Data (Data sent from DTE to DCE
) (DTE ) .(DCE )(Mark state, 0 or Positive
) (Idle State, 1 or Negative .
):DTR Data Terminal Ready (Control sent from DTE to DCE
) (DTE ) (DCE
.

| 2011-2012

Page | 8

Technology Processes Automation

):DSR Data Set Ready (Control sent from DCE to DTE


) (DCE ) .(DTE ) (0
) (1 .
):RTS Request To Send (Control sent from DTE to DCE
) (DCE ) (DTE
. ) (0
) (1 .
):CTS Clear To Send (Control sent from DCE to DTE
) (DTE
) (DCE . )(0
) (1 .
):RI Ring Indicator (Control sent from DCE to DTE
) (DTE
.
9B

:RS232

TxD RxD
:

) (Hardware handshaking )(RTS, CTS


) (TxD, RxD :
CTS .
RTS
RTS ) (.
:
.
| 2011-2012

Page | 9

Technology Processes Automation

RTS
.

:RS232
10B

SPECIFICATIONS

RS232

RS423

SINGLE-ENDED

SINGLE-ENDED

1DRIVER/1RECVR

1DRIVER/10RECVR

Maximum Cable Length

50 FT

4000 FT

Maximum Data Rate

20kb/s

100kb/s

Maximum Driver Output Voltage

25V

6V

5V to 15V

3.6V

25V

6V

3k to 7k

>=450

Mode of Operation
Total Number of Drivers and Receivers on One Line

Driver Output Signal Level (Loaded Min.)

Loaded

Driver Output Signal Level (Unloaded Max)

Unloaded

Driver Load Impedance (Ohms)


Max. Driver Current in High Z State

Power On

N/A

N/A

Max. Driver Current in High Z State

Power Off

6mA @ 2v

100uA

30V/S

Adjustable

Receiver Input Voltage Range

15V

12V

Receiver Input Sensitivity

3V

200mV

3k to 7k

4k min

Slew Rate (Max.)

Receiver Input Resistance (Ohms)

Shield 24AWG
.100 16PF/FT

Technology Processes Automation

Page | 10

| 2011-2012

) (Synchronized ):(Asynchronous
1B

: )( : ) clock or

(strobe
) (.

: \ .
: ) ( : )(Start Bit

) (Stop Bit
.

| 2011-2012

Page | 11

Technology Processes Automation

:
.
:
: ) (Half-Duplex ).(Full-Duplex
.6, 7 or 8 bit :
).(Baud Rate
) (Parity Bit
).(Even or Odd
).(1, 1.5 or 2
) :(Half-Duplex
.
) :(Full-Duplex
.
) :(Parity Bit
.

Even 0
.1 .
10110010 > Parity Bit = 0 | 10110110 > Parity Bit = 1

Odd 0
.1 .
10110010 > Parity Bit = 1 | 10110110 > Parity Bit = 0
| 2011-2012

Page | 12

Technology Processes Automation

) :(N 5, 6, 7 or 8bit
: N=7bit .ASCII=127

) :(Stop Bit 1, 1.5 or 2 ..

) :(Baud Rate
:
300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, etc

| 2011-2012

= /

Page | 13

Technology Processes Automation

RS232 :

| 2011-2012

Page | 14

Technology Processes Automation

RS232 :
8250-UART
.
/ ):(IOR, Input/Output Register
COM1: 0x3F8 | COM2: 0x2F8

RxD .TxD

):(LCR, Line Control Register


COM1: 0x3FB | COM2: 0x2FB

)( .

):(LSR, Line Status Register


COM1: 0x3FD | COM2: 0x2FD

):(MCR, Modem Control Register


COM1: 0x3FC | COM2: 0x2FC

)( .8250

| 2011-2012

Page | 15

Technology Processes Automation

):(MSR, Modem Status Register


COM1: 0x3FE | COM2: 0x2FE

dxxx=1 .

):(IER, Interrupt Enable Register


COM1: 0x3F9 | COM2: 0x2F9

COM ) (1 Active
IRQ4 COM1 IRQ3 .COM2

):(IIR, Interrupt Identification Register


COM1: 0x3FA | COM2: 0x2FA

.
| 2011-2012

Page | 16

Technology Processes Automation

: COM3
.

:
8250 1.8432MHZ
"."Divisor
1.8432 106
=
16

: 9600bps Divisor

1.8432 106
1.8432 106
=
=
= 12
16
16 9600

D=12 UART8250:
| 2011-2012

Page | 17

Technology Processes Automation

Bit7=1 ).(LCR
) (LSB ).(0x3F8
) (MSB ).(0x3F9
Bit7=0 ).(LCR
COM :VB, MVS2008.net
) ActiveX & OCX

(Components
Bios .
.
VB6 MSComm (MSCOMM32.ocx) OCX
COM .
: System32
SP6 VB6 .
Standard EXE
VB6 Enterprice Edition
.

| 2011-2012

Page | 18

Technology Processes Automation

Microsoft Visual Studio 2008 VB6


" "SerialPort .net
).(VB.net, C#.net or C++.net

SerialPort ) (
.VB6
: :VB6
) (COM
.

).(Test1/ProjRS232.vbp

" "OutGoing " Send

"Data

" "InComing .
| 2011-2012

Page | 19

Technology Processes Automation

:
Private Sub Form_Load()
MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,8,1"
MSComm1.RThreshold = 1
MSComm1.InputLen = 0
MSComm1.InBufferCount = 0
End Sub
Private Sub cmdClear_Click()
txtOutput.Text = ""
txtInput.Text = ""
End Sub
Private Sub optCOM1_Click()
MSComm1.CommPort = 1
End Sub
Private Sub optCOM2_Click()
MSComm1.CommPort = 2
End Sub
Private Sub optOpen_Click()
MSComm1.PortOpen = True
End Sub
Private Sub optClose_Click()
MSComm1.PortOpen = Flase
End Sub
Private Sub optTXT_Click()
MSComm1.InputMode = comInputModeText
End Sub
Private Sub optBIN_Click()
MSComm1.InputMode = comInputModeBinary
End Sub
Private Sub cmdSendData_Click()
Technology Processes Automation

Page | 20

| 2011-2012




)MSComm1.Output = txtOutput.Text & Chr(13
End Sub
)(Private Sub cmdExit_Click
If MSComm1.PortOpen = True Then MSComm1.PortOpen = Flase
End
End Sub
)(Private Sub MSComm1_OnComm
Static sBuff As String
If MSComm1.CommEvent = comEvReceive Then
If optBIN.Value = True Then
)sBuff = sBuff & StrConv(MSComm1.Input, vbUnicode
txtInput.Text = sBuff
Else
txtInput.Text = txtInput.Text & MSComm1.Input
End If
End If
End Sub

:MSComm
MSComm1.CommPort = N

" "N .
"MSComm1.Settings = "Baud,Parity,Bits,Stop

) (.
MSComm1.RThreshold = n

") "comEvReceive (
n=0 .
MSComm1.InputLen = n

n=0
.
MSComm1.InBufferSize = n

).(1~1024

MSComm1.OutBufferSize = n

).(1~1024

MSComm1.InBufferCount = n

.
| 2011-2012

Page | 21

Technology Processes Automation

MSComm1.OutBufferCount = n

MSComm1.PortOpen = True | Flase

| .

MSComm1.InputMode = comInputModeText | comInputModeBinary

) | ( " "Input .

var = MSComm1.InPut

MSComm1.OutPut = var

.
.

MSComm1.CommEvent = Value

Value

CD

comEvCD

CTS

comEvCTS

DSR

comEvDSR

RI

comEvRing

RThreshold .
SThreshold .
).(vbCrLf

comEvReceive
comEvSend
comEvEOF

MSComm1.DTREnable = True | Flase

| | .DTR ) (True 1 0
. ) (Flase 0 .

MSComm1.Handshaking = comNone|comRTS|comXOnXoff|comRTSXOnXOff

MSComm1.RTSEnable = True | Flase

| | RTS .Hardware ) (True 1


0 . ) (Flase 0 .

| 2011-2012

Page | 22

Technology Processes Automation

:
:
) :(Poling the Port
.

) (Header Byte ).(Footer Byte
) :(OnComm() event
OnComm .

.

| 2011-2012

Page | 23

Technology Processes Automation

: :Matlab
Matlab

:
)obj = serial('Port','PropertyName',PropertyValue,...
;)'Ser = serial('COM1','BaudRate',9600,'DataBits',8, 'Parity','non

) (.

)fopen(obj
;)fopen(Ser

)fclose(obj
;)fclose(Ser

)delete(obj
;)delete(Ser

)fprintf(fid, format, A, ...


;)'fprintf(Ser,'This is Test

) (TXT .

)fwrite(fid, format, A, ...


;)fwrite(Ser,4

) (BIN .

)A = fscanf(fid, format
;)A = fscanf(Ser

) (TXT .

)A = fread(fid
;)A = fread(Ser

) (BIN .

| 2011-2012

Page | 24

Technology Processes Automation

:
ser = serial('COM1','BaudRate',9600,'DataBits',8);
fopen(ser)
fprintf(ser,'This is Test')
A = fscanf(ser);
fprintf(ser,A)
for i=1:5
fwrite(ser,i);
end
A = fread(ser);
fwrite(ser,A);
fclose(ser)
delete(ser)
clear ser

Technology Processes Automation

Page | 25

| 2011-2012

:1 AVR (TTL) UART ......(RS232) COM


AVR UART (RS232) COM
.

:TTL <> RS232


RS232

TTL
) (Adapter .
Max232
.TTL<>RS232

TTL<>RS232 ) (RS232
) (UART .Max232

| 2011-2012

Page | 26

Technology Processes Automation

TTL<>RS232 ) (RS232
) (UART .

| 2011-2012

Page | 27

Technology Processes Automation

} {RS485
3B

:RS485
RS485 .
) (A,B VA<VB
1 VA>VB .0
.1

RS485
A B
.

:RS485
.RS485
LTC

MAXIM

TI

ST

LTC485

MAX485

SN75176

ST485

| 2011-2012

Page | 28

Technology Processes Automation

:RS485
. RS485
SPECIFICATIONS

RS422

RS485

Differential

Differential

1DRIVER

1DRIVER

32DRIVER

1RECVR

10RECVR

10RECVR

32RECVR

Maximum Cable Length

50 FT

4000 FT

4000 FT

4000 FT

Maximum Data Rate

20kb/s

100kb/s

10Mb/s 100Kb/s

10Mb/s 100Kb/s

Maximum Driver Output Voltage

25V

6V

-0.25V to +6V

-7V to +12V

5V to 15V

3.6V

2.0V

1.5V

25V

6V

6V

6V

3k to 7k

>=450

100

54

Power On

N/A

N/A

N/A

100uA

Power Off

6mA @ 2v

100uA

100uA

100uA

30V/S

Adjustable

N/A

N/A

Receiver Input Voltage Range

15V

12V

-10V to +10V

-7V to +12V

Receiver Input Sensitivity

3V

200mV

200mV

200mV

3k to 7k

4k min

4k min

>=12k

Mode of Operation
Total Number of Drivers and
Receivers on One Line

Driver Output Signal


Level (Loaded Min.)
Driver Output Signal
Level (Unloaded Max)

Loaded
Unloaded

Driver Load Impedance (Ohms)


Max. Driver Current in
High Z State
Max. Driver Current in
High Z State
Slew Rate (Max.)

Receiver Input Resistance (Ohms)

RS232

RS423

SINGLE-

SINGLE-

ENDED

ENDED

1DRIVER

RS-485 drivers provide a differential output of a minimum 1.5V across a 54- load

RS-485 receivers detect a differential input down to 200mV.

Technology Processes Automation

Page | 29

| 2011-2012

:

.RS485

:
.
RS485 :
A B
:

: 15Meter Daisy Chain

.Backbone with Stubs

| 2011-2012

Page | 30

Technology Processes Automation

: RS485
. .

| 2011-2012

Page | 31

Technology Processes Automation

RS485 ):(Half-Duplex Bus Structures in RS-485


RS485 ) (Driver
) (Receivers .

) MAX485 32( ) MAX1487 128(

RS485 ):(Full-Duplex Bus Structures in RS-485


)( RS485
) (Driver ) (Receivers .

| 2011-2012

Page | 32

Technology Processes Automation

) MAX489 32( ) MAX491 128(

:(RS-485 Bus Termination Resistor) RS485


RS485 ) (120 ohm :
. ) !!(.

:(RS-485 Max Bus Capacitance) RS485


RS485 RS485 ) 4000pF
( . Cable Capacitance = 11pF / ft = 3.35pF / m
Driver Capacitance = 30pF 1Km 32 .
!Total Cap = (3.35 x 1000) + (30 x 32) = 4310 > 4000

) (Max1487, 15pF
).(CAT5, 9pF/ft
| 2011-2012

Page | 33

Technology Processes Automation

RS485 :
:
PASSIVE DUPLEX CONTROL (AUTOMATIC)

) ACTIVE DUPLEX CONTROL (RTS Pin

: :Passive Duplex ) (RO, DI RS485 Driver



) (DE/RE
. :

) :(No data to send 1


) .(Idle

) :(Master sends a request


) (Start Bit
) (Stop Bit ) (Check sum
).(Idle

) :(Slave sends a response


add = 07

.

| 2011-2012

Page | 34

Technology Processes Automation

: :Active Duplex RS485 Driver


) (RTS Control /.
:
) :(No data to send
) (RTS ) .(1
.

) :(Master sends a request


) (Start Bit
) (Stop Bit ) (Check sum

).(Idle

) :(Slave sends a response add

= 07


.

| 2011-2012

Page | 35

Technology Processes Automation

MODBUS :RS485
MODEBUS
) (Multi Master/Slave
.
MODEBUS ) (Master Device ) Slave

.(Device
MODEBUS ) (Query ) (Master Device ):(Slave Device
CRC

Data

Start
Address Lo

Start
Address Hi

Function
Code

Byte
Count

Slave
Address

CRC
CRC Low
CRC Hi

Stream

Start
Address

Byte Count

Function
Code

Slave
Address

1~2 byte

0 ~ 252 byte

2 byte

1 byte

1 byte

1 byte

Data

:Slave Address ).(1~252


:Function code .
:Byte Count .
:Start Address .
:Data Stream ).(255 byte max
:(Cyclic Redundancy Check) CRC .
Inter-frame-time t3.5

| 2011-2012

Page | 36

Technology Processes Automation

) (Data t1.5
!

:
| Inter-character time-out (t1.5) = 750s

Inter-frame delay (t3.5) = 1.750ms

9600bps 70Byte

.Slave address
:
1000 = .

70 8 = 560

560

9600

58ms
.t3.5= 1.75ms
MODEBUS ) (Responce ) (Slave ):(Master
Slave

.

| 2011-2012

CRC
CRC Low
CRC Hi

Byte Count

Function
Code

Slave
Address

1~2 byte

1 byte

1 byte

1 byte

Page | 37

Technology Processes Automation

: ) (Slave .CRC
| :RS485
RS485 : ) (Half-Duplex ) (Full-Duplex
.
.

RS485
.

| 2011-2012

Page | 38

Technology Processes Automation

):(RS232<>RS458
.RS232<>RS458

| 2011-2012

Page | 39

Technology Processes Automation

):(RS232<>UART<>RS458
.RS232<>UART<>RS458 Max485

UART Max232 UART


.

.RS232<>UART<>RS458

| 2011-2012

Page | 40

Technology Processes Automation

(RS485 Adapter <> UART) RS485

| 2011-2012

Page | 41

Technology Processes Automation

} {USB
4B

LPT COM USB Firewire


USB .
:

127

16

1.5M, 12M, 480M

RS-232

50-100

20k -115k

RS-485

4000

10M

IrDA

115k

Microwire

10

2M

SPI

I2C

10

2.1M

40

18

3.4M

FireWire

64

15

400M-3.2G

IEEE-488

15

60

8M

Ethernet

1024

1600

10M/100M/1G

MIDI

50

31.5k

LPT

10-30

8M

USB

)(

bits/sec

:USB
.480Mb/s
Plug & Play .

.
127 .
:USB

USB 1.0 & USB 1.1 & USB 2.0 & USB 3.0 :USB :
Low Speed 1.5 Mbits/s .USB 1.0
Full Speed 12 Mbits/s .USB 1.1
| 2011-2012

Page | 42

Technology Processes Automation

High Speed 480 Mbits/s .USB 2.0


4800 Mbits/s .USB 3.0

:USB
USB Host Controlled )
(
USB
On-The-Go
.
USB :
.
.
USB HUB
.

| 2011-2012

Page | 43

Technology Processes Automation

:Plug& Play
USB Plug & Play
USB .
.
.
. VID, PID
USB
.
:USB
USB :
:A .
:B .
.
USB : +5v & GND .D- & D+
1

) VCC(

D-

)(

D+

)(

) GND 4(
USB D+&D- ' '1
' '1 '0' D+ D-
.

| 2011-2012

Page | 44

Technology Processes Automation

:(Non Return to Zero Invert) NRZI


USB NRZI
. ' '0 ' '1 ' '0
' '1 .

' '1
.

:
USB D- D+
:
: .D-

.1
.2 : .D+
.3 : .

| 2011-2012

Page | 45

Technology Processes Automation

:USB
USB
.USB
:(USB Device) USB USB
) (Host Controller IC ) (USB Function
USB .
:USB Function USB .
) :(Endpoint USB Function USB

Function ) (Endpoint )(Out


) (In .
USB
.EP2 In
USB Function
:

| 2011-2012

Page | 46

Technology Processes Automation

EP1 In USB1 USB1


:
][Addr : 2] [Endpoint : EP1] [In

:Pipe Pipe :
) ( .Pipe :

Pipe0 EP0 In & EP0 Out : .


:
Pipe :
).(Control Transfers
).(Interrupt Transfers
).(Isochronous Transfers
).(Bulk Transfers
:USB
USB ) (Frame )(USB1.1, USB2.0
: ) (1ms
).(125s
) (Transaction .
:
:Token Packet :
:In Token :

.1
.2

:Synchronization .
:(Packet Identity) PID
.

.3

:Address 128.

| 2011-2012

Page | 47

Technology Processes Automation

.4
.5

:Endpoint .
:(Cyclic Redundancy Check) CRC 5 .

:Out Token ).(In


: Setup Token Control Transfer .In
: Start of frame Token 1ms500ns
) (Frame number 11.

) :(Data Packet :
.Data0

.1
.2 .Data1
1024bit CRC 16bit .

) :(Handshake Packet :
:Acknowledge .
:Not acknowledge
.
:Stall
.

| 2011-2012

Page | 48

Technology Processes Automation

USB

| 2011-2012

Page | 49

Technology Processes Automation

:USB
USB USB
:
) (Hardware .USB

.1
.2 .


USB

USB USB
UART
USB
.
FT232 USB<>UART
.FTDI
USB ) (Hardware

USB .
) (D2XX driver & VCP driver :

.COM

| 2011-2012

Page | 50

Technology Processes Automation

):(D2XX driver & VCP driver


VCP Driver

D2XX.DLL Driver

300 KB/s

3MB

:(Virtual Com Port) VCP USB Com


USB Com.
:D2XX.DLL
.DLL
:FT232BM
.
FTDI ).(VCP & D2XX.DLL
.USB1.1, USB2.0
.
300kb~3Mb .
FIFO 256.
FIFO 128.
VID, PID .
.
USB USB
USB .USB

| 2011-2012

Page | 51

Technology Processes Automation

11 .

PWREN# .
| 2011-2012

Page | 52

Technology Processes Automation

) (Sleep mode ) 3ms (


Sleep=1
.
Wake up

.
USB Serial Interface ) SIE

(Engine :
USB .USB
.CRC
.Start Of Packet, End Of Packet, Resume, Reset
.NRZI
).(PID
) (USB Transceiver USB2.0, USB1.1
D+ .

| 2011-2012

Page | 53

Technology Processes Automation

AVR (TTL) UART .(Differential) USB

(RS232) COM ...(Differential) USB

| 2011-2012

Page | 54

Technology Processes Automation

USB (RS485 Adapter <> USB) RS485

| 2011-2012

Page | 55

Technology Processes Automation

RS485

| 2011-2012

Page | 56

Technology Processes Automation

} {LabVIEW
5B

):(Graphical Hardware Programming Language


12B

. :
.[428]Agilent VEE .[429]National Instruments LabVIEW.[430]Microsoft Visual Programming Language (MVPL) -

" "Agilent VEE


. 28-3 Agilent

.VEE Pro 9.2

1-3

Agilent VEE Pro 9.2

" "Microsoft Visual Programming Language


. 29-3 .MVPL

2-3 MVPL
| 2011-2012

Page | 57

Technology Processes Automation

LabVIEW
.
):(The Importance of Graphical Programming
13B

Moor
) (FPGAs, Multi-core MPUs, SoCs
. 30-3 .

3-3

)(
FPAG
) (Synthesizable .

.

: C
].[431,432
] [433 FPGA
. ] [434-436
) .(Dataflow 31-3
. 32-3 .

| 2011-2012

Page | 58

Technology Processes Automation

4-3

5-3


] .[437
] [438 ] [439
) (Flowchart .
:(LabVIEW Programming Environment) LabVIEW
14B

LabVIEW " "Laboratory Virtual Instrumentation Engineering Workbench


National Instruments

][428

1980s

].[422

) (Design ) (Prototype )Deploy ) MCUs,
MPUs, Multi-core, FPGAs, DSPs, ) PLC, Vision,

(Communications, Control, Measurements, Mechatronics


| 2011-2012

Page | 59

Technology Processes Automation

) (C, HDL, .m file


. 33-3 .LabVIEW

6-3 LabVIEW

:(The LabVIEW Environment Parts) LabVIEW


15B

-1 )(Front Panel
-2 )(Block Diagram
-3 )(Project Explorer

7-3 LabVIEW
| 2011-2012

Page | 60

Technology Processes Automation

16B

8-3 LabVIEW

)(Front Panel

) (GUI ") "Controls


( ) .(Controls Palette 36-3
.LabVIEW

9-3 LabVIEW



. 37-3 "."Controls Palette

10-3 " "Controls Palette LabVIEW


| 2011-2012

Page | 61

Technology Processes Automation

):(Block Diagram
17B

) (C, C++, Jave


) (Functions Palette

. 38-3 .LabVIEW
39-3 "."Functions Palette

11-3 LabVIEW

12-3 " "Functions Palette LabVIEW

LabVIEW ) (For..Next, Do..While :


) (IfThen :
.
| 2011-2012

Page | 62

Technology Processes Automation

40-3 .LabVIEW

13-3 LabVIEW

LabVIEW G
) (High-level Design Models Simulation-Module
Matlab-Simulink StateChart Module ) HDL,

(C/C++, .m file . 41-3


.

14-3 LabVIEW

LabVIEW ):(LabVIEW, "G" Dataflow Programming


18B

LabVIEW " (Graphical) "G


" "G
| 2011-2012

Page | 63

Technology Processes Automation

. " "G :

) object-oriented
) (recursion ) (event handling

.(programming

LabVIEW G
) (Dataflow
)(
- .C++ & C
G ) (Dataflow
- -

) ( LabVIEW

.

19B

:(Benefits of G Programming) G
.

):(Intuitive Graphical Programming



" " ) (Visual Thinkers
.
.
.
G

)

| 2011-2012

Page | 64

Technology Processes Automation

42-3
.LabVIEW

15-3

LabVIEW

):(Interactive Debugging Tools


G LabVIEW


. LabVIEW
).(Execution Highlighting

16-3 " "Execution Highlighting

LabVIEW

LabVIEW G :
) (Probes ) (Break Points ).(Step-by-Step
G

LabVIEW
| 2011-2012

Page | 65

Technology Processes Automation

LabVIEW

.

):(Automatic Parallelism and Performance

.
LabVIEW

C C++
. / ) (Producer/Consumer
G While
Queues
. 44-3 .Producer/Consumer

17-3 LabVIEW Producer/Consumer


. 40


.

) (Pipelining, Task and Data Parallelism ) (Multithreading )

( .


| 2011-2012

Page | 66

Technology Processes Automation

. G ) (Multitasking
LabVIEW
.


" Implicit Parallelism
G . 45-3 .

18-3 ) (Automatic Multithreading

LabVIEW

46-3
. 47-3 " "Data Parallelism Quad-core .LabVIEW

19-3 " "Data Parallelism Quad-core

20-3 " "Data Parallelism Quad-core


| 2011-2012

Page | 67

LabVIEW
Technology Processes Automation

48-3 " "Pipelining .


49-3 " "Pipelining .LabVIEW

21-3 " "Pipelining


Sequential

Pipelining

4-Channels

22-3 ) (Sequential ) (4L.Pipelining

LabVIEW

50-3 ) (Real-time
).(1,2,n

Core-1
23-3 LabVIEW
| 2011-2012

Page | 68

Core-2

Technology Processes Automation

:(Parallelism on FPGA Chips) FPGA



) (FPGAs


.
FPGA
FPGA FPGA
].[433


G FPGA
G

) (Parallelism

. 51-3
LabVIEW FPGA .

24-3 LabVIEW FPGA

):(Abstraction of Low-Level Tasks




. G
) (
.

| 2011-2012

Page | 69

Technology Processes Automation

.
.
G

LabVIEW
.

G
" "Profile Performance & Memory LabVIEW
LabVIEW .
52-3 .LabVIEW

25-3

LabVIEW

G
" ."LabVIEW Desktop Execution Trace Toolkit
:


. 53-3

"."Execution Trace

| 2011-2012

Page | 70

Technology Processes Automation

26-3 " "Execution Trace LabVIEW

G ):(Combining G with Other Languages


G

LabVIEW
LabVIEW .
LabVIEW ) (Formula Node

)( .LabVIEW 54-3 C-node


C/C++ .LabVIEW

27-3 C LabVIEW

C-node

) (MathScript Node LabVIEW


" (Matlab) ".m file . 55-3 MathScript-Node
" ".m file .LabVIEW
HDL .HDL-Node

| 2011-2012

Page | 71

Technology Processes Automation

28-3 " ".m file LabVIEW MathScript-Node

):(Textual vs. Graphical Programming


20B

56-3
. LabVIEW


] .[444
.
Design Algorithm

Graphical

Programming
Simulate Program
Test System

1.
2.

Target Hardware

3.

Make Algorithm Compatible

Optimize Algorithm

Traditional Languages

Simulate Algorithm

Download and Deploy

29-3 -

| 2011-2012

Page | 72

Technology Processes Automation

30-3 .DSP

57-3 LabVIEW-DSP
LabVIEW

LabVIEW
.
58-3 ) (DAQ
. LabVIEW

) .(58-3a
50
).(58-3b

)(a

)(b

31-3

58-3 -59-3
LabVIEW .
.

| 2011-2012

Page | 73

Technology Processes Automation

32-3

59-3
) ( .60-3
Do-while Times-loop
.

33-3

FPGA ) (DIO: Data In/out FPGA


61-3b .
60 .
)(a

)(b

34-3
| 2011-2012

Page | 74

FPGA

Technology Processes Automation

61-3
62-3
) (Floating point
.

35-3

FPGA

62-3 SRAM
FPGA LabVIEW DMA-FIFO 63-3
66 4000 !

66Pages ~4000Lines

36-3 FPGA

):(Conclusion
21B

Moor

) (FPGAs, Multi-core MPUs, SoCs


.

) : (FPGAs
| 2011-2012

Page | 75

Technology Processes Automation

. ) :
( .

: C
. )(LabVIEW
.

.

| 2011-2012

Page | 76

Technology Processes Automation

:LabVIEW
2B

LabVIEW :
NI LabVIEW 2011

NI VISA 511full

NI-VISA_Runtime

) (Write.vi COM

) (Read.vi COM...
:LabVIEW2011

:LabVIEW2011


23B

24B

30 2012
25B

| 2011-2012

Page | 77

Technology Processes Automation

You might also like