Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: serie.h
- Revision:
- 8:cfcf73c16fab
- Parent:
- 6:edb27e228558
- Child:
- 10:6f9340af7926
diff -r 315630fad89f -r cfcf73c16fab serie.h
--- a/serie.h Mon Apr 15 15:25:12 2019 +0000
+++ b/serie.h Wed Aug 25 09:54:24 2021 +0000
@@ -1,68 +1,15 @@
// variables globales liées à la reception serie
- int arr ; int arr0 ; int arr1 ; //arrivée liaison serie
- char RA; char RB ; char RC ; char RD ; char Rc ; char Rd ; //
- int tr1; int tr2 ; int SR ; int SV ; int SB ;
- int SX ; int SY ;// pour rec serial
- char Scar;
-// Interupt Routine to read in data from serial port
-//void interrupt (); // pour rx serie
-
-void transfert() // pix avec rvb en X Y
- {
- SX = RA;
- SY = RB;
- SV = RC & 7 ;
- SR = (RC&56)>>3 ;
- SB = (RD&7) ;
- pix(SX,SY,SR,SV,SB);
- }
-
-void ascii() // place ascii en xy
- {
- SX = RA;
- SY = RB;
- Rc = RC&63; Rd = RD & 1 ;
- Scar = Rc*4 + Rd ;
- charr(SX,SY,Scar);
- }
-
-void color() // ligne plus 1
- {
- bv = RC & 7 ;
- br = (RC&56)>>3 ;
- bb = (RD&7) ;
+int arecv = 0 ; // stockage intermediaire du char arrivé
+
+void interrupt() // reception sur liaison serie
+ { // ici on decode un exemple simple
+ // un 'a' met posx = 10 un 'b' met posx = 20
+ arecv = serie.getc();
+ if (arecv == 'a') // c'est un 'a'
+ { posx = 10 ;
}
-
-void interrupt() // trame
- { // mettre dans le tableau a l' adresse voulue par a b c
- arr0 = serie.getc();
- arr1 = arr0;
- arr = arr1 & 192;
- if (arr == 0) // c'est A
- { RA = arr1 & 63;
- }
- if (arr == 64)// c'est B
- { RB = arr1 & 63;
- }
- if (arr == 128)// c'est C
- { RC = arr1 & 63;
- }
- if (arr == 192)// c'est D
- { RD = arr1 & 63;
- arr = arr0;
- if ( ( arr & 248) == 192 ) // c = 0 00
- { transfert (); // vers un pix
- }
- if ( ( arr & 248) == 200 ) // c = 0 01
- {
- Tr2 (); // efface tableau
- }
- if ( ( arr & 248) == 208 )
- {color(); // memo color br bv bb
- }
- if ( ( arr & 248) == 216 )
- { ascii();
- }
- }
+ if (arecv == 'b')// c'est B
+ { posx = 20 ;
+ }
return;
-}
\ No newline at end of file
+ }
\ No newline at end of file