Præsentation er lastning. Vent venligst

Præsentation er lastning. Vent venligst

1 Kommunikation med COM-porten Lars S. 2 Indhold Krav til interface mellem M3-M4 Kommunikation med COM-port Løsning til at afhjælpe tab af data Konklusion.

Lignende præsentationer


Præsentationer af emnet: "1 Kommunikation med COM-porten Lars S. 2 Indhold Krav til interface mellem M3-M4 Kommunikation med COM-port Løsning til at afhjælpe tab af data Konklusion."— Præsentationens transcript:

1 1 Kommunikation med COM-porten Lars S

2 2 Indhold Krav til interface mellem M3-M4 Kommunikation med COM-port Løsning til at afhjælpe tab af data Konklusion

3 3 Krav til interface mellem M3-M4 Envejs seriel kommunikation 9600 baud 1 start- og stopbit, 8 databit, ingen paritetsbit Data sendes som: –2 char: længde og vinkel –1 char: fejl

4 4 Kommunikation med COM-port Initialiser COM-port* Modtag data fra COM-port –Detekter tastetryk** Sæt COM-port til gammel indstilling *http://www.ibiblio.org/pub/Linux/docs/HOWTO/other- formats/html_single/Serial-Programming-HOWTO.htmlhttp://www.ibiblio.org/pub/Linux/docs/HOWTO/other- formats/html_single/Serial-Programming-HOWTO.html **http://www.experts- exchange.com/Programming/Programming_Platforms/Linux_Progra mming/Q_20367853.htmlhttp://www.experts- exchange.com/Programming/Programming_Platforms/Linux_Progra mming/Q_20367853.html

5 5 initcom() Opsætning iht. krav til interface: newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD; newtio.c_iflag = IGNPAR; newtio.c_cc[VMIN] = 2;

6 6 getcom()

7 7 Løsning til at afhjælpe tab af data Nu: (l v) (l v) (e l) (v l) Løsning: –Kun modtage 1 char ad gangen ( initcom() ) –Modtage et start-tegn, fx: %11111111 = x  x (l v) (l v) (e) (l v)

8 8 Konklusion Den virker hvis ikke der sker tab af data og der ikke sendes fejl. Førnævnte løsningsmodel kan afhjælpe problemet med tab af data og fejl. Brugbar kommunikation, men skal optimeres.


Download ppt "1 Kommunikation med COM-porten Lars S. 2 Indhold Krav til interface mellem M3-M4 Kommunikation med COM-port Løsning til at afhjælpe tab af data Konklusion."

Lignende præsentationer


Annoncer fra Google