test can console

Dependencies:   mbed

Fork of CAN by Carlos Almeida

Committer:
protongamer
Date:
Tue Feb 06 07:22:11 2018 +0000
Revision:
1:c022a879e21c
Parent:
0:cea062e60f85
Child:
2:be902ab7d787
test console can

Who changed what in which revision?

UserRevisionLine numberNew contents of line
protongamer 1:c022a879e21c 1 //Terminal CAN projet bts sn Enzo
protongamer 1:c022a879e21c 2
LabSE 0:cea062e60f85 3 #include "mbed.h"
LabSE 0:cea062e60f85 4
protongamer 1:c022a879e21c 5 #define BIG_ENDIAN 0
protongamer 1:c022a879e21c 6 #define LITTLE_ENDIAN 1
protongamer 1:c022a879e21c 7
protongamer 1:c022a879e21c 8 #define MENU_DISPLAY 0
protongamer 1:c022a879e21c 9 #define MENU_CHOOSE 1
protongamer 1:c022a879e21c 10 #define MENU_SENDING_DISPLAY 2
protongamer 1:c022a879e21c 11 #define MENU_SENDING 3
protongamer 1:c022a879e21c 12 #define SET_ID 4
protongamer 1:c022a879e21c 13
LabSE 0:cea062e60f85 14 Ticker ticker;
LabSE 0:cea062e60f85 15 DigitalOut led1(LED1);
LabSE 0:cea062e60f85 16 DigitalOut led2(LED2);
protongamer 1:c022a879e21c 17
protongamer 1:c022a879e21c 18 Serial pc(USBTX, USBRX);
protongamer 1:c022a879e21c 19 CAN can1(p9, p10);
LabSE 0:cea062e60f85 20 CAN can2(p30, p29);
protongamer 1:c022a879e21c 21
protongamer 1:c022a879e21c 22 char value = 0;
protongamer 1:c022a879e21c 23 uint8_t state = 0;
protongamer 1:c022a879e21c 24 uint16_t identifier = 0x0539;
protongamer 1:c022a879e21c 25
protongamer 1:c022a879e21c 26
protongamer 1:c022a879e21c 27 void send(char counter) {
protongamer 1:c022a879e21c 28 //pc.printf("send()\n");
protongamer 1:c022a879e21c 29 if(can1.write(CANMessage(identifier, &counter, 8,))) {
protongamer 1:c022a879e21c 30 //pc.printf("wloop()\n");
protongamer 1:c022a879e21c 31 //counter++;
protongamer 1:c022a879e21c 32 pc.printf("Message sent: %d\r\n", counter);
protongamer 1:c022a879e21c 33 }
protongamer 1:c022a879e21c 34 led1 = !led1;
LabSE 0:cea062e60f85 35 }
LabSE 0:cea062e60f85 36
LabSE 0:cea062e60f85 37 int main() {
protongamer 1:c022a879e21c 38
protongamer 1:c022a879e21c 39 //ticker.attach(&send, 1);
LabSE 0:cea062e60f85 40 CANMessage msg;
protongamer 1:c022a879e21c 41 char c;
protongamer 1:c022a879e21c 42 uint16_t instruction;
protongamer 1:c022a879e21c 43 uint16_t instruction_2;
protongamer 1:c022a879e21c 44 uint8_t bytes;
protongamer 1:c022a879e21c 45 int8_t state_val;
protongamer 1:c022a879e21c 46 uint8_t data_report[100];
protongamer 1:c022a879e21c 47 uint8_t data_rc;
protongamer 1:c022a879e21c 48 uint8_t endianness = 0;
LabSE 0:cea062e60f85 49 while(1) {
protongamer 1:c022a879e21c 50
protongamer 1:c022a879e21c 51
protongamer 1:c022a879e21c 52
protongamer 1:c022a879e21c 53
protongamer 1:c022a879e21c 54 switch(state){
protongamer 1:c022a879e21c 55
protongamer 1:c022a879e21c 56 case MENU_DISPLAY://menu affichage
protongamer 1:c022a879e21c 57 pc.printf("\r\n\n\n");
protongamer 1:c022a879e21c 58 pc.printf("CAN BUS - TERMINAL \r\n");
protongamer 1:c022a879e21c 59 pc.printf("1 - Set the value to be sent\r\n");
protongamer 1:c022a879e21c 60 pc.printf("2 - Set Endianness \r\n");
protongamer 1:c022a879e21c 61 pc.printf("3 - Set Identifier \r\n");
protongamer 1:c022a879e21c 62 pc.printf("4 - Send the value \r\n");
protongamer 1:c022a879e21c 63 state = 1;
protongamer 1:c022a879e21c 64 break;
protongamer 1:c022a879e21c 65
protongamer 1:c022a879e21c 66 case MENU_CHOOSE://choix menu
protongamer 1:c022a879e21c 67
protongamer 1:c022a879e21c 68 c = pc.getc();
protongamer 1:c022a879e21c 69
protongamer 1:c022a879e21c 70
protongamer 1:c022a879e21c 71 if(c == '1'){//attribution valeur a envoyer
protongamer 1:c022a879e21c 72 instruction = 0;
protongamer 1:c022a879e21c 73 state_val = 0;
protongamer 1:c022a879e21c 74 pc.printf("1 \r\n\n");
protongamer 1:c022a879e21c 75 wait(1.0);
protongamer 1:c022a879e21c 76 state = MENU_SENDING_DISPLAY;
protongamer 1:c022a879e21c 77 }
protongamer 1:c022a879e21c 78
protongamer 1:c022a879e21c 79
protongamer 1:c022a879e21c 80 if(c == '2'){
protongamer 1:c022a879e21c 81 pc.printf("2 \r\n\n");
protongamer 1:c022a879e21c 82 wait(1.0);
protongamer 1:c022a879e21c 83
protongamer 1:c022a879e21c 84 pc.printf("Endianness Configuration \r\n");
protongamer 1:c022a879e21c 85 pc.printf("1 - Big Endian \r\n");
protongamer 1:c022a879e21c 86 pc.printf("2 - Little Endian \r\n");
protongamer 1:c022a879e21c 87
protongamer 1:c022a879e21c 88 c = pc.getc();
protongamer 1:c022a879e21c 89
protongamer 1:c022a879e21c 90 if(c == '1'){
protongamer 1:c022a879e21c 91 endianness = BIG_ENDIAN;
protongamer 1:c022a879e21c 92 pc.printf("\r\n1\r\n");
protongamer 1:c022a879e21c 93 }
protongamer 1:c022a879e21c 94
protongamer 1:c022a879e21c 95 if(c == '2'){
protongamer 1:c022a879e21c 96 endianness = LITTLE_ENDIAN;
protongamer 1:c022a879e21c 97 pc.printf("\r\n2\r\n");
protongamer 1:c022a879e21c 98 }
protongamer 1:c022a879e21c 99 state = MENU_DISPLAY;
protongamer 1:c022a879e21c 100 wait(1.0);
protongamer 1:c022a879e21c 101
protongamer 1:c022a879e21c 102 }
protongamer 1:c022a879e21c 103
protongamer 1:c022a879e21c 104
protongamer 1:c022a879e21c 105 if(c == '3'){
protongamer 1:c022a879e21c 106
protongamer 1:c022a879e21c 107 pc.printf("3 \r\n\n");
protongamer 1:c022a879e21c 108 wait(1.0);
protongamer 1:c022a879e21c 109
protongamer 1:c022a879e21c 110 pc.printf("Set the identifier(hexa) : 0x");
protongamer 1:c022a879e21c 111 state = SET_ID;
protongamer 1:c022a879e21c 112
protongamer 1:c022a879e21c 113 }
protongamer 1:c022a879e21c 114
protongamer 1:c022a879e21c 115
protongamer 1:c022a879e21c 116 if(c == '4'){//envoie valeur
protongamer 1:c022a879e21c 117 pc.printf("4 \r\n\n");
protongamer 1:c022a879e21c 118 wait(1.0);
protongamer 1:c022a879e21c 119
protongamer 1:c022a879e21c 120 switch(bytes){//calcul nombre octet présent
protongamer 1:c022a879e21c 121
protongamer 1:c022a879e21c 122 case 1://si 1 octet present envoie 1 octet
protongamer 1:c022a879e21c 123 send(instruction);
protongamer 1:c022a879e21c 124 break;
protongamer 1:c022a879e21c 125
protongamer 1:c022a879e21c 126 case 2://si 2 octets present envoie 2 octets 1 par 1
protongamer 1:c022a879e21c 127 if(endianness == BIG_ENDIAN){
protongamer 1:c022a879e21c 128 send(instruction_2);
protongamer 1:c022a879e21c 129 send(instruction);}
protongamer 1:c022a879e21c 130
protongamer 1:c022a879e21c 131 if(endianness == LITTLE_ENDIAN){
protongamer 1:c022a879e21c 132 send(instruction);
protongamer 1:c022a879e21c 133 send(instruction_2);}
protongamer 1:c022a879e21c 134 break;
protongamer 1:c022a879e21c 135
protongamer 1:c022a879e21c 136 }//switch
protongamer 1:c022a879e21c 137
protongamer 1:c022a879e21c 138 state = MENU_DISPLAY; //on revient au menu de départ apres la capture de données
protongamer 1:c022a879e21c 139
protongamer 1:c022a879e21c 140 //sequence de capture de données de retour
protongamer 1:c022a879e21c 141 for(int i = 0; i <= 500; i++){
protongamer 1:c022a879e21c 142 if(!can1.read(msg)) {
protongamer 1:c022a879e21c 143 pc.printf("awaiting data\r\n");}
protongamer 1:c022a879e21c 144
protongamer 1:c022a879e21c 145 if(can1.read(msg)) {
protongamer 1:c022a879e21c 146 pc.printf("Message received: %d \r\n", msg.data[0]);
protongamer 1:c022a879e21c 147 data_report[data_rc] = msg.data[0];
protongamer 1:c022a879e21c 148 data_rc++;
protongamer 1:c022a879e21c 149 led2 = !led2;
protongamer 1:c022a879e21c 150 wait(0.1);
protongamer 1:c022a879e21c 151 }
protongamer 1:c022a879e21c 152
protongamer 1:c022a879e21c 153 }//for int i
protongamer 1:c022a879e21c 154 pc.printf("\r\nDone\r\n\n");
protongamer 1:c022a879e21c 155 //capture de données terminées, on fait un rapport des données collectées
protongamer 1:c022a879e21c 156 for(int i = 0; i < data_rc; i++){
protongamer 1:c022a879e21c 157 pc.printf("Message captured: %d \r\n", data_report[i]);
protongamer 1:c022a879e21c 158 }
protongamer 1:c022a879e21c 159 data_rc = 0;
protongamer 1:c022a879e21c 160
protongamer 1:c022a879e21c 161 }//if c == '2'
protongamer 1:c022a879e21c 162
protongamer 1:c022a879e21c 163 break;//
protongamer 1:c022a879e21c 164
protongamer 1:c022a879e21c 165 case MENU_SENDING_DISPLAY://choix de la valeur a envoyer
protongamer 1:c022a879e21c 166 pc.printf("Set the value to be sent(hex value) : 0x");
protongamer 1:c022a879e21c 167 state = 3;
protongamer 1:c022a879e21c 168 break;
protongamer 1:c022a879e21c 169
protongamer 1:c022a879e21c 170 case MENU_SENDING://demande de valeur a envoyer
protongamer 1:c022a879e21c 171
protongamer 1:c022a879e21c 172 c = pc.getc();
protongamer 1:c022a879e21c 173
protongamer 1:c022a879e21c 174
protongamer 1:c022a879e21c 175 //state_val correspond a la premiere valeur, si la premiere valeur n'est pas encore entrée, elle attribué a la variable instruction
protongamer 1:c022a879e21c 176 //dans l'autre cas, on décale de 4 rang les 4 bits de l'ancienne valeur pour l'ajouter à la nouvelle
protongamer 1:c022a879e21c 177 switch(c){
protongamer 1:c022a879e21c 178
protongamer 1:c022a879e21c 179
protongamer 1:c022a879e21c 180
protongamer 1:c022a879e21c 181 case '0':
protongamer 1:c022a879e21c 182 pc.printf("0");
protongamer 1:c022a879e21c 183
protongamer 1:c022a879e21c 184 if(state_val > 0){
protongamer 1:c022a879e21c 185 instruction = instruction << 4;
protongamer 1:c022a879e21c 186 instruction |= 0b0000;
protongamer 1:c022a879e21c 187 }
protongamer 1:c022a879e21c 188
protongamer 1:c022a879e21c 189 if(state_val == 0){
protongamer 1:c022a879e21c 190 instruction = 0b0000;
protongamer 1:c022a879e21c 191 state_val++;
protongamer 1:c022a879e21c 192 }
protongamer 1:c022a879e21c 193
protongamer 1:c022a879e21c 194 break;
protongamer 1:c022a879e21c 195
protongamer 1:c022a879e21c 196 case '1':
protongamer 1:c022a879e21c 197
protongamer 1:c022a879e21c 198 if(state_val > 0){
protongamer 1:c022a879e21c 199 instruction = instruction << 4;
protongamer 1:c022a879e21c 200 instruction |= 0b0001;
protongamer 1:c022a879e21c 201 }
protongamer 1:c022a879e21c 202
protongamer 1:c022a879e21c 203 pc.printf("1");
protongamer 1:c022a879e21c 204 if(state_val == 0){
protongamer 1:c022a879e21c 205 instruction = 0b0001;
protongamer 1:c022a879e21c 206 state_val++;
protongamer 1:c022a879e21c 207 }
protongamer 1:c022a879e21c 208
protongamer 1:c022a879e21c 209 break;
protongamer 1:c022a879e21c 210
protongamer 1:c022a879e21c 211 case '2':
protongamer 1:c022a879e21c 212
protongamer 1:c022a879e21c 213 if(state_val > 0){
protongamer 1:c022a879e21c 214 instruction = instruction << 4;
protongamer 1:c022a879e21c 215 instruction |= 0b0010;
protongamer 1:c022a879e21c 216 }
protongamer 1:c022a879e21c 217
protongamer 1:c022a879e21c 218 pc.printf("2");
protongamer 1:c022a879e21c 219 if(state_val == 0){
protongamer 1:c022a879e21c 220 instruction = 0b0010;
protongamer 1:c022a879e21c 221 state_val++;
protongamer 1:c022a879e21c 222 }
protongamer 1:c022a879e21c 223
protongamer 1:c022a879e21c 224 break;
protongamer 1:c022a879e21c 225
protongamer 1:c022a879e21c 226 case '3':
protongamer 1:c022a879e21c 227 pc.printf("3");
protongamer 1:c022a879e21c 228
protongamer 1:c022a879e21c 229 if(state_val > 0){
protongamer 1:c022a879e21c 230 instruction = instruction << 4;
protongamer 1:c022a879e21c 231 instruction |= 0b0011;
protongamer 1:c022a879e21c 232 }
protongamer 1:c022a879e21c 233
protongamer 1:c022a879e21c 234 if(state_val == 0){
protongamer 1:c022a879e21c 235 instruction = 0b0011;
protongamer 1:c022a879e21c 236 state_val++;
protongamer 1:c022a879e21c 237 }
protongamer 1:c022a879e21c 238
protongamer 1:c022a879e21c 239 break;
protongamer 1:c022a879e21c 240
protongamer 1:c022a879e21c 241 case '4':
protongamer 1:c022a879e21c 242
protongamer 1:c022a879e21c 243 if(state_val > 0){
protongamer 1:c022a879e21c 244 instruction = instruction << 4;
protongamer 1:c022a879e21c 245 instruction |= 0b0100;
protongamer 1:c022a879e21c 246 }
protongamer 1:c022a879e21c 247
protongamer 1:c022a879e21c 248 pc.printf("4");
protongamer 1:c022a879e21c 249 if(state_val == 0){
protongamer 1:c022a879e21c 250 instruction = 0b0100;
protongamer 1:c022a879e21c 251 state_val++;
protongamer 1:c022a879e21c 252 }
protongamer 1:c022a879e21c 253
protongamer 1:c022a879e21c 254 break;
protongamer 1:c022a879e21c 255
protongamer 1:c022a879e21c 256 case '5':
protongamer 1:c022a879e21c 257 pc.printf("5");
protongamer 1:c022a879e21c 258
protongamer 1:c022a879e21c 259 if(state_val > 0){
protongamer 1:c022a879e21c 260 instruction = instruction << 4;
protongamer 1:c022a879e21c 261 instruction |= 0b0101;
protongamer 1:c022a879e21c 262 }
protongamer 1:c022a879e21c 263
protongamer 1:c022a879e21c 264 if(state_val == 0){
protongamer 1:c022a879e21c 265 instruction = 0b0101;
protongamer 1:c022a879e21c 266 state_val++;
protongamer 1:c022a879e21c 267 }
protongamer 1:c022a879e21c 268
protongamer 1:c022a879e21c 269 break;
protongamer 1:c022a879e21c 270
protongamer 1:c022a879e21c 271 case '6':
protongamer 1:c022a879e21c 272 pc.printf("6");
protongamer 1:c022a879e21c 273
protongamer 1:c022a879e21c 274 if(state_val > 0){
protongamer 1:c022a879e21c 275 instruction = instruction << 4;
protongamer 1:c022a879e21c 276 instruction |= 0b0110;
protongamer 1:c022a879e21c 277 }
protongamer 1:c022a879e21c 278
protongamer 1:c022a879e21c 279 if(state_val == 0){
protongamer 1:c022a879e21c 280 instruction = 0b0110;
protongamer 1:c022a879e21c 281 state_val++;
protongamer 1:c022a879e21c 282 }
protongamer 1:c022a879e21c 283
protongamer 1:c022a879e21c 284 break;
protongamer 1:c022a879e21c 285
protongamer 1:c022a879e21c 286 case '7':
protongamer 1:c022a879e21c 287 pc.printf("7");
protongamer 1:c022a879e21c 288
protongamer 1:c022a879e21c 289 if(state_val > 0){
protongamer 1:c022a879e21c 290 instruction = instruction << 4;
protongamer 1:c022a879e21c 291 instruction |= 0b0111;
protongamer 1:c022a879e21c 292 }
protongamer 1:c022a879e21c 293
protongamer 1:c022a879e21c 294 if(state_val == 0){
protongamer 1:c022a879e21c 295 instruction = 0b0111;
protongamer 1:c022a879e21c 296 state_val++;
protongamer 1:c022a879e21c 297 }
protongamer 1:c022a879e21c 298
protongamer 1:c022a879e21c 299 break;
protongamer 1:c022a879e21c 300
protongamer 1:c022a879e21c 301 case '8':
protongamer 1:c022a879e21c 302 pc.printf("8");
protongamer 1:c022a879e21c 303
protongamer 1:c022a879e21c 304 if(state_val > 0){
protongamer 1:c022a879e21c 305 instruction = instruction << 4;
protongamer 1:c022a879e21c 306 instruction |= 0b1000;
protongamer 1:c022a879e21c 307 }
protongamer 1:c022a879e21c 308
protongamer 1:c022a879e21c 309
protongamer 1:c022a879e21c 310 if(state_val == 0){
protongamer 1:c022a879e21c 311 instruction = 0b1000;
protongamer 1:c022a879e21c 312 state_val++;
protongamer 1:c022a879e21c 313 }
protongamer 1:c022a879e21c 314
protongamer 1:c022a879e21c 315 break;
protongamer 1:c022a879e21c 316
protongamer 1:c022a879e21c 317 case '9':
protongamer 1:c022a879e21c 318 pc.printf("9");
protongamer 1:c022a879e21c 319
protongamer 1:c022a879e21c 320 if(state_val > 0){
protongamer 1:c022a879e21c 321 instruction = instruction << 4;
protongamer 1:c022a879e21c 322 instruction |= 0b1001;
protongamer 1:c022a879e21c 323 }
protongamer 1:c022a879e21c 324
protongamer 1:c022a879e21c 325 if(state_val == 0){
protongamer 1:c022a879e21c 326 instruction = 0b1001;
protongamer 1:c022a879e21c 327 state_val++;
protongamer 1:c022a879e21c 328 }
protongamer 1:c022a879e21c 329
protongamer 1:c022a879e21c 330 break;
protongamer 1:c022a879e21c 331
protongamer 1:c022a879e21c 332 case 'a':
protongamer 1:c022a879e21c 333 pc.printf("a");
protongamer 1:c022a879e21c 334
protongamer 1:c022a879e21c 335 if(state_val > 0){
protongamer 1:c022a879e21c 336 instruction = instruction << 4;
protongamer 1:c022a879e21c 337 instruction |= 0b1010;
protongamer 1:c022a879e21c 338 }
protongamer 1:c022a879e21c 339
protongamer 1:c022a879e21c 340 if(state_val == 0){
protongamer 1:c022a879e21c 341 instruction = 0b1010;
protongamer 1:c022a879e21c 342 state_val++;
protongamer 1:c022a879e21c 343 }
protongamer 1:c022a879e21c 344
protongamer 1:c022a879e21c 345 break;
protongamer 1:c022a879e21c 346
protongamer 1:c022a879e21c 347 case 'b':
protongamer 1:c022a879e21c 348 pc.printf("b");
protongamer 1:c022a879e21c 349
protongamer 1:c022a879e21c 350 if(state_val > 0){
protongamer 1:c022a879e21c 351 instruction = instruction << 4;
protongamer 1:c022a879e21c 352 instruction |= 0b1011;
protongamer 1:c022a879e21c 353 }
protongamer 1:c022a879e21c 354
protongamer 1:c022a879e21c 355 if(state_val == 0){
protongamer 1:c022a879e21c 356 instruction = 0b1011;
protongamer 1:c022a879e21c 357 state_val++;
protongamer 1:c022a879e21c 358 }
protongamer 1:c022a879e21c 359
protongamer 1:c022a879e21c 360 break;
protongamer 1:c022a879e21c 361
protongamer 1:c022a879e21c 362 case 'c':
protongamer 1:c022a879e21c 363 pc.printf("c");
protongamer 1:c022a879e21c 364
protongamer 1:c022a879e21c 365 if(state_val > 0){
protongamer 1:c022a879e21c 366 instruction = instruction << 4;
protongamer 1:c022a879e21c 367 instruction |= 0b1100;
protongamer 1:c022a879e21c 368 }
protongamer 1:c022a879e21c 369
protongamer 1:c022a879e21c 370 if(state_val == 0){
protongamer 1:c022a879e21c 371 instruction = 0b1100;
protongamer 1:c022a879e21c 372 state_val++;
protongamer 1:c022a879e21c 373 }
protongamer 1:c022a879e21c 374
protongamer 1:c022a879e21c 375 break;
protongamer 1:c022a879e21c 376
protongamer 1:c022a879e21c 377 case 'd':
protongamer 1:c022a879e21c 378 pc.printf("d");
protongamer 1:c022a879e21c 379
protongamer 1:c022a879e21c 380 if(state_val > 0){
protongamer 1:c022a879e21c 381 instruction = instruction << 4;
protongamer 1:c022a879e21c 382 instruction |= 0b1101;
protongamer 1:c022a879e21c 383 }
protongamer 1:c022a879e21c 384
protongamer 1:c022a879e21c 385 if(state_val == 0){
protongamer 1:c022a879e21c 386 instruction = 0b1101;
protongamer 1:c022a879e21c 387 state_val++;
protongamer 1:c022a879e21c 388 }
protongamer 1:c022a879e21c 389
protongamer 1:c022a879e21c 390 break;
protongamer 1:c022a879e21c 391
protongamer 1:c022a879e21c 392 case 'e':
protongamer 1:c022a879e21c 393 pc.printf("e");
protongamer 1:c022a879e21c 394
protongamer 1:c022a879e21c 395 if(state_val > 0){
protongamer 1:c022a879e21c 396 instruction = instruction << 4;
protongamer 1:c022a879e21c 397 instruction |= 0b1110;
protongamer 1:c022a879e21c 398 }
protongamer 1:c022a879e21c 399
protongamer 1:c022a879e21c 400 if(state_val == 0){
protongamer 1:c022a879e21c 401 instruction = 0b1110;
protongamer 1:c022a879e21c 402 state_val++;
protongamer 1:c022a879e21c 403 }
protongamer 1:c022a879e21c 404
protongamer 1:c022a879e21c 405 break;
protongamer 1:c022a879e21c 406
protongamer 1:c022a879e21c 407 case 'f':
protongamer 1:c022a879e21c 408 pc.printf("f");
protongamer 1:c022a879e21c 409
protongamer 1:c022a879e21c 410 if(state_val > 0){
protongamer 1:c022a879e21c 411 instruction = instruction << 4;
protongamer 1:c022a879e21c 412 instruction |= 0b1111;
protongamer 1:c022a879e21c 413 }
protongamer 1:c022a879e21c 414
protongamer 1:c022a879e21c 415 if(state_val == 0){
protongamer 1:c022a879e21c 416 instruction = 0b1111;
protongamer 1:c022a879e21c 417 state_val++;
protongamer 1:c022a879e21c 418 }
protongamer 1:c022a879e21c 419
protongamer 1:c022a879e21c 420 break;
protongamer 1:c022a879e21c 421
protongamer 1:c022a879e21c 422 case 'A':
protongamer 1:c022a879e21c 423 pc.printf("a");
protongamer 1:c022a879e21c 424
protongamer 1:c022a879e21c 425 if(state_val > 0){
protongamer 1:c022a879e21c 426 instruction = instruction << 4;
protongamer 1:c022a879e21c 427 instruction |= 0b1010;
protongamer 1:c022a879e21c 428 }
protongamer 1:c022a879e21c 429
protongamer 1:c022a879e21c 430 if(state_val == 0){
protongamer 1:c022a879e21c 431 instruction = 0b1010;
protongamer 1:c022a879e21c 432 state_val++;
protongamer 1:c022a879e21c 433 }
protongamer 1:c022a879e21c 434
protongamer 1:c022a879e21c 435 break;
protongamer 1:c022a879e21c 436
protongamer 1:c022a879e21c 437 case 'B':
protongamer 1:c022a879e21c 438 pc.printf("b");
protongamer 1:c022a879e21c 439
protongamer 1:c022a879e21c 440 if(state_val > 0){
protongamer 1:c022a879e21c 441 instruction = instruction << 4;
protongamer 1:c022a879e21c 442 instruction |= 0b1011;
protongamer 1:c022a879e21c 443 }
protongamer 1:c022a879e21c 444
protongamer 1:c022a879e21c 445 if(state_val == 0){
protongamer 1:c022a879e21c 446 instruction = 0b1011;
protongamer 1:c022a879e21c 447 state_val++;
protongamer 1:c022a879e21c 448 }
protongamer 1:c022a879e21c 449
protongamer 1:c022a879e21c 450 break;
protongamer 1:c022a879e21c 451
protongamer 1:c022a879e21c 452 case 'C':
protongamer 1:c022a879e21c 453 pc.printf("c");
protongamer 1:c022a879e21c 454
protongamer 1:c022a879e21c 455 if(state_val > 0){
protongamer 1:c022a879e21c 456 instruction = instruction << 4;
protongamer 1:c022a879e21c 457 instruction |= 0b1100;
protongamer 1:c022a879e21c 458 }
protongamer 1:c022a879e21c 459
protongamer 1:c022a879e21c 460 if(state_val == 0){
protongamer 1:c022a879e21c 461 instruction = 0b1100;
protongamer 1:c022a879e21c 462 state_val++;
protongamer 1:c022a879e21c 463 }
protongamer 1:c022a879e21c 464
protongamer 1:c022a879e21c 465 break;
protongamer 1:c022a879e21c 466
protongamer 1:c022a879e21c 467 case 'D':
protongamer 1:c022a879e21c 468 pc.printf("d");
protongamer 1:c022a879e21c 469
protongamer 1:c022a879e21c 470 if(state_val > 0){
protongamer 1:c022a879e21c 471 instruction = instruction << 4;
protongamer 1:c022a879e21c 472 instruction |= 0b1101;
protongamer 1:c022a879e21c 473 }
protongamer 1:c022a879e21c 474
protongamer 1:c022a879e21c 475 if(state_val == 0){
protongamer 1:c022a879e21c 476 instruction = 0b1101;
protongamer 1:c022a879e21c 477 state_val++;
protongamer 1:c022a879e21c 478 }
protongamer 1:c022a879e21c 479
protongamer 1:c022a879e21c 480 break;
protongamer 1:c022a879e21c 481
protongamer 1:c022a879e21c 482 case 'E':
protongamer 1:c022a879e21c 483 pc.printf("e");
protongamer 1:c022a879e21c 484
protongamer 1:c022a879e21c 485 if(state_val > 0){
protongamer 1:c022a879e21c 486 instruction = instruction << 4;
protongamer 1:c022a879e21c 487 instruction |= 0b1110;
protongamer 1:c022a879e21c 488 }
protongamer 1:c022a879e21c 489
protongamer 1:c022a879e21c 490 if(state_val == 0){
protongamer 1:c022a879e21c 491 instruction = 0b1110;
protongamer 1:c022a879e21c 492 state_val++;
protongamer 1:c022a879e21c 493 }
protongamer 1:c022a879e21c 494
protongamer 1:c022a879e21c 495 break;
protongamer 1:c022a879e21c 496
protongamer 1:c022a879e21c 497 case 'F':
protongamer 1:c022a879e21c 498 pc.printf("f");
protongamer 1:c022a879e21c 499
protongamer 1:c022a879e21c 500 if(state_val > 0){
protongamer 1:c022a879e21c 501 instruction = instruction << 4;
protongamer 1:c022a879e21c 502 instruction |= 0b1111;
protongamer 1:c022a879e21c 503 }
protongamer 1:c022a879e21c 504
protongamer 1:c022a879e21c 505 if(state_val == 0){
protongamer 1:c022a879e21c 506 instruction = 0b1111;
protongamer 1:c022a879e21c 507 state_val++;
protongamer 1:c022a879e21c 508 }
protongamer 1:c022a879e21c 509
protongamer 1:c022a879e21c 510 break;
protongamer 1:c022a879e21c 511
protongamer 1:c022a879e21c 512 case '\r': //si au sérial nous avons le retour de ligne
protongamer 1:c022a879e21c 513 pc.printf("\r\n0x%x \r\n", instruction);
protongamer 1:c022a879e21c 514 wait(1.0);
protongamer 1:c022a879e21c 515 state_val = 0;
protongamer 1:c022a879e21c 516 state = MENU_DISPLAY;
protongamer 1:c022a879e21c 517 //calcul du nombre d'octet en fonction de la valeur finale
protongamer 1:c022a879e21c 518 if(instruction <= 255){
protongamer 1:c022a879e21c 519 bytes = 1;
protongamer 1:c022a879e21c 520 }
protongamer 1:c022a879e21c 521 if(instruction > 255){
protongamer 1:c022a879e21c 522 bytes = 2;
protongamer 1:c022a879e21c 523 instruction_2 = instruction;
protongamer 1:c022a879e21c 524 instruction_2 = instruction_2 >> 8;
protongamer 1:c022a879e21c 525 instruction = instruction & 0b0000000011111111;
protongamer 1:c022a879e21c 526 }
protongamer 1:c022a879e21c 527 break;
protongamer 1:c022a879e21c 528
protongamer 1:c022a879e21c 529
protongamer 1:c022a879e21c 530 }
protongamer 1:c022a879e21c 531
protongamer 1:c022a879e21c 532 break;
protongamer 1:c022a879e21c 533
protongamer 1:c022a879e21c 534 case SET_ID:
protongamer 1:c022a879e21c 535
protongamer 1:c022a879e21c 536 c = pc.getc();
protongamer 1:c022a879e21c 537
protongamer 1:c022a879e21c 538 switch(c){
protongamer 1:c022a879e21c 539
protongamer 1:c022a879e21c 540
protongamer 1:c022a879e21c 541
protongamer 1:c022a879e21c 542 case '0':
protongamer 1:c022a879e21c 543 pc.printf("0");
protongamer 1:c022a879e21c 544
protongamer 1:c022a879e21c 545 if(state_val > 0){
protongamer 1:c022a879e21c 546 identifier = identifier << 4;
protongamer 1:c022a879e21c 547 identifier |= 0b0000;
protongamer 1:c022a879e21c 548 }
protongamer 1:c022a879e21c 549
protongamer 1:c022a879e21c 550 if(state_val == 0){
protongamer 1:c022a879e21c 551 identifier = 0b0000;
protongamer 1:c022a879e21c 552 state_val++;
protongamer 1:c022a879e21c 553 }
protongamer 1:c022a879e21c 554
protongamer 1:c022a879e21c 555 break;
protongamer 1:c022a879e21c 556
protongamer 1:c022a879e21c 557 case '1':
protongamer 1:c022a879e21c 558
protongamer 1:c022a879e21c 559 if(state_val > 0){
protongamer 1:c022a879e21c 560 identifier = identifier << 4;
protongamer 1:c022a879e21c 561 identifier |= 0b0001;
protongamer 1:c022a879e21c 562 }
protongamer 1:c022a879e21c 563
protongamer 1:c022a879e21c 564 pc.printf("1");
protongamer 1:c022a879e21c 565 if(state_val == 0){
protongamer 1:c022a879e21c 566 identifier = 0b0001;
protongamer 1:c022a879e21c 567 state_val++;
protongamer 1:c022a879e21c 568 }
protongamer 1:c022a879e21c 569
protongamer 1:c022a879e21c 570 break;
protongamer 1:c022a879e21c 571
protongamer 1:c022a879e21c 572 case '2':
protongamer 1:c022a879e21c 573
protongamer 1:c022a879e21c 574 if(state_val > 0){
protongamer 1:c022a879e21c 575 identifier = identifier << 4;
protongamer 1:c022a879e21c 576 identifier |= 0b0010;
protongamer 1:c022a879e21c 577 }
protongamer 1:c022a879e21c 578
protongamer 1:c022a879e21c 579 pc.printf("2");
protongamer 1:c022a879e21c 580 if(state_val == 0){
protongamer 1:c022a879e21c 581 identifier = 0b0010;
protongamer 1:c022a879e21c 582 state_val++;
protongamer 1:c022a879e21c 583 }
protongamer 1:c022a879e21c 584
protongamer 1:c022a879e21c 585 break;
protongamer 1:c022a879e21c 586
protongamer 1:c022a879e21c 587 case '3':
protongamer 1:c022a879e21c 588 pc.printf("3");
protongamer 1:c022a879e21c 589
protongamer 1:c022a879e21c 590 if(state_val > 0){
protongamer 1:c022a879e21c 591 identifier = identifier << 4;
protongamer 1:c022a879e21c 592 identifier |= 0b0011;
protongamer 1:c022a879e21c 593 }
protongamer 1:c022a879e21c 594
protongamer 1:c022a879e21c 595 if(state_val == 0){
protongamer 1:c022a879e21c 596 identifier = 0b0011;
protongamer 1:c022a879e21c 597 state_val++;
protongamer 1:c022a879e21c 598 }
protongamer 1:c022a879e21c 599
protongamer 1:c022a879e21c 600 break;
protongamer 1:c022a879e21c 601
protongamer 1:c022a879e21c 602 case '4':
protongamer 1:c022a879e21c 603
protongamer 1:c022a879e21c 604 if(state_val > 0){
protongamer 1:c022a879e21c 605 identifier = identifier << 4;
protongamer 1:c022a879e21c 606 identifier |= 0b0100;
protongamer 1:c022a879e21c 607 }
protongamer 1:c022a879e21c 608
protongamer 1:c022a879e21c 609 pc.printf("4");
protongamer 1:c022a879e21c 610 if(state_val == 0){
protongamer 1:c022a879e21c 611 identifier = 0b0100;
protongamer 1:c022a879e21c 612 state_val++;
protongamer 1:c022a879e21c 613 }
protongamer 1:c022a879e21c 614
protongamer 1:c022a879e21c 615 break;
protongamer 1:c022a879e21c 616
protongamer 1:c022a879e21c 617 case '5':
protongamer 1:c022a879e21c 618 pc.printf("5");
protongamer 1:c022a879e21c 619
protongamer 1:c022a879e21c 620 if(state_val > 0){
protongamer 1:c022a879e21c 621 identifier = identifier << 4;
protongamer 1:c022a879e21c 622 identifier |= 0b0101;
protongamer 1:c022a879e21c 623 }
protongamer 1:c022a879e21c 624
protongamer 1:c022a879e21c 625 if(state_val == 0){
protongamer 1:c022a879e21c 626 identifier = 0b0101;
protongamer 1:c022a879e21c 627 state_val++;
protongamer 1:c022a879e21c 628 }
protongamer 1:c022a879e21c 629
protongamer 1:c022a879e21c 630 break;
protongamer 1:c022a879e21c 631
protongamer 1:c022a879e21c 632 case '6':
protongamer 1:c022a879e21c 633 pc.printf("6");
protongamer 1:c022a879e21c 634
protongamer 1:c022a879e21c 635 if(state_val > 0){
protongamer 1:c022a879e21c 636 identifier = identifier << 4;
protongamer 1:c022a879e21c 637 identifier |= 0b0110;
protongamer 1:c022a879e21c 638 }
protongamer 1:c022a879e21c 639
protongamer 1:c022a879e21c 640 if(state_val == 0){
protongamer 1:c022a879e21c 641 identifier = 0b0110;
protongamer 1:c022a879e21c 642 state_val++;
protongamer 1:c022a879e21c 643 }
protongamer 1:c022a879e21c 644
protongamer 1:c022a879e21c 645 break;
protongamer 1:c022a879e21c 646
protongamer 1:c022a879e21c 647 case '7':
protongamer 1:c022a879e21c 648 pc.printf("7");
protongamer 1:c022a879e21c 649
protongamer 1:c022a879e21c 650 if(state_val > 0){
protongamer 1:c022a879e21c 651 identifier = identifier << 4;
protongamer 1:c022a879e21c 652 identifier |= 0b0111;
protongamer 1:c022a879e21c 653 }
protongamer 1:c022a879e21c 654
protongamer 1:c022a879e21c 655 if(state_val == 0){
protongamer 1:c022a879e21c 656 identifier = 0b0111;
protongamer 1:c022a879e21c 657 state_val++;
protongamer 1:c022a879e21c 658 }
protongamer 1:c022a879e21c 659
protongamer 1:c022a879e21c 660 break;
protongamer 1:c022a879e21c 661
protongamer 1:c022a879e21c 662 case '8':
protongamer 1:c022a879e21c 663 pc.printf("8");
protongamer 1:c022a879e21c 664
protongamer 1:c022a879e21c 665 if(state_val > 0){
protongamer 1:c022a879e21c 666 identifier = identifier << 4;
protongamer 1:c022a879e21c 667 identifier |= 0b1000;
protongamer 1:c022a879e21c 668 }
protongamer 1:c022a879e21c 669
protongamer 1:c022a879e21c 670
protongamer 1:c022a879e21c 671 if(state_val == 0){
protongamer 1:c022a879e21c 672 identifier = 0b1000;
protongamer 1:c022a879e21c 673 state_val++;
protongamer 1:c022a879e21c 674 }
protongamer 1:c022a879e21c 675
protongamer 1:c022a879e21c 676 break;
protongamer 1:c022a879e21c 677
protongamer 1:c022a879e21c 678 case '9':
protongamer 1:c022a879e21c 679 pc.printf("9");
protongamer 1:c022a879e21c 680
protongamer 1:c022a879e21c 681 if(state_val > 0){
protongamer 1:c022a879e21c 682 identifier = identifier << 4;
protongamer 1:c022a879e21c 683 identifier |= 0b1001;
protongamer 1:c022a879e21c 684 }
protongamer 1:c022a879e21c 685
protongamer 1:c022a879e21c 686 if(state_val == 0){
protongamer 1:c022a879e21c 687 identifier = 0b1001;
protongamer 1:c022a879e21c 688 state_val++;
protongamer 1:c022a879e21c 689 }
protongamer 1:c022a879e21c 690
protongamer 1:c022a879e21c 691 break;
protongamer 1:c022a879e21c 692
protongamer 1:c022a879e21c 693 case 'a':
protongamer 1:c022a879e21c 694 pc.printf("a");
protongamer 1:c022a879e21c 695
protongamer 1:c022a879e21c 696 if(state_val > 0){
protongamer 1:c022a879e21c 697 identifier = identifier << 4;
protongamer 1:c022a879e21c 698 identifier |= 0b1010;
protongamer 1:c022a879e21c 699 }
protongamer 1:c022a879e21c 700
protongamer 1:c022a879e21c 701 if(state_val == 0){
protongamer 1:c022a879e21c 702 identifier = 0b1010;
protongamer 1:c022a879e21c 703 state_val++;
protongamer 1:c022a879e21c 704 }
protongamer 1:c022a879e21c 705
protongamer 1:c022a879e21c 706 break;
protongamer 1:c022a879e21c 707
protongamer 1:c022a879e21c 708 case 'b':
protongamer 1:c022a879e21c 709 pc.printf("b");
protongamer 1:c022a879e21c 710
protongamer 1:c022a879e21c 711 if(state_val > 0){
protongamer 1:c022a879e21c 712 identifier = identifier << 4;
protongamer 1:c022a879e21c 713 identifier |= 0b1011;
protongamer 1:c022a879e21c 714 }
protongamer 1:c022a879e21c 715
protongamer 1:c022a879e21c 716 if(state_val == 0){
protongamer 1:c022a879e21c 717 identifier = 0b1011;
protongamer 1:c022a879e21c 718 state_val++;
protongamer 1:c022a879e21c 719 }
protongamer 1:c022a879e21c 720
protongamer 1:c022a879e21c 721 break;
protongamer 1:c022a879e21c 722
protongamer 1:c022a879e21c 723 case 'c':
protongamer 1:c022a879e21c 724 pc.printf("c");
protongamer 1:c022a879e21c 725
protongamer 1:c022a879e21c 726 if(state_val > 0){
protongamer 1:c022a879e21c 727 identifier = identifier << 4;
protongamer 1:c022a879e21c 728 identifier |= 0b1100;
protongamer 1:c022a879e21c 729 }
protongamer 1:c022a879e21c 730
protongamer 1:c022a879e21c 731 if(state_val == 0){
protongamer 1:c022a879e21c 732 identifier = 0b1100;
protongamer 1:c022a879e21c 733 state_val++;
protongamer 1:c022a879e21c 734 }
protongamer 1:c022a879e21c 735
protongamer 1:c022a879e21c 736 break;
protongamer 1:c022a879e21c 737
protongamer 1:c022a879e21c 738 case 'd':
protongamer 1:c022a879e21c 739 pc.printf("d");
protongamer 1:c022a879e21c 740
protongamer 1:c022a879e21c 741 if(state_val > 0){
protongamer 1:c022a879e21c 742 identifier = identifier << 4;
protongamer 1:c022a879e21c 743 identifier |= 0b1101;
protongamer 1:c022a879e21c 744 }
protongamer 1:c022a879e21c 745
protongamer 1:c022a879e21c 746 if(state_val == 0){
protongamer 1:c022a879e21c 747 identifier = 0b1101;
protongamer 1:c022a879e21c 748 state_val++;
protongamer 1:c022a879e21c 749 }
protongamer 1:c022a879e21c 750
protongamer 1:c022a879e21c 751 break;
protongamer 1:c022a879e21c 752
protongamer 1:c022a879e21c 753 case 'e':
protongamer 1:c022a879e21c 754 pc.printf("e");
protongamer 1:c022a879e21c 755
protongamer 1:c022a879e21c 756 if(state_val > 0){
protongamer 1:c022a879e21c 757 identifier = identifier << 4;
protongamer 1:c022a879e21c 758 identifier |= 0b1110;
protongamer 1:c022a879e21c 759 }
protongamer 1:c022a879e21c 760
protongamer 1:c022a879e21c 761 if(state_val == 0){
protongamer 1:c022a879e21c 762 identifier = 0b1110;
protongamer 1:c022a879e21c 763 state_val++;
protongamer 1:c022a879e21c 764 }
protongamer 1:c022a879e21c 765
protongamer 1:c022a879e21c 766 break;
protongamer 1:c022a879e21c 767
protongamer 1:c022a879e21c 768 case 'f':
protongamer 1:c022a879e21c 769 pc.printf("f");
protongamer 1:c022a879e21c 770
protongamer 1:c022a879e21c 771 if(state_val > 0){
protongamer 1:c022a879e21c 772 identifier = identifier << 4;
protongamer 1:c022a879e21c 773 identifier |= 0b1111;
protongamer 1:c022a879e21c 774 }
protongamer 1:c022a879e21c 775
protongamer 1:c022a879e21c 776 if(state_val == 0){
protongamer 1:c022a879e21c 777 identifier = 0b1111;
protongamer 1:c022a879e21c 778 state_val++;
protongamer 1:c022a879e21c 779 }
protongamer 1:c022a879e21c 780
protongamer 1:c022a879e21c 781 break;
protongamer 1:c022a879e21c 782
protongamer 1:c022a879e21c 783 case 'A':
protongamer 1:c022a879e21c 784 pc.printf("a");
protongamer 1:c022a879e21c 785
protongamer 1:c022a879e21c 786 if(state_val > 0){
protongamer 1:c022a879e21c 787 identifier = identifier << 4;
protongamer 1:c022a879e21c 788 identifier |= 0b1010;
protongamer 1:c022a879e21c 789 }
protongamer 1:c022a879e21c 790
protongamer 1:c022a879e21c 791 if(state_val == 0){
protongamer 1:c022a879e21c 792 identifier = 0b1010;
protongamer 1:c022a879e21c 793 state_val++;
protongamer 1:c022a879e21c 794 }
protongamer 1:c022a879e21c 795
protongamer 1:c022a879e21c 796 break;
protongamer 1:c022a879e21c 797
protongamer 1:c022a879e21c 798 case 'B':
protongamer 1:c022a879e21c 799 pc.printf("b");
protongamer 1:c022a879e21c 800
protongamer 1:c022a879e21c 801 if(state_val > 0){
protongamer 1:c022a879e21c 802 identifier = identifier << 4;
protongamer 1:c022a879e21c 803 identifier |= 0b1011;
protongamer 1:c022a879e21c 804 }
protongamer 1:c022a879e21c 805
protongamer 1:c022a879e21c 806 if(state_val == 0){
protongamer 1:c022a879e21c 807 identifier = 0b1011;
protongamer 1:c022a879e21c 808 state_val++;
protongamer 1:c022a879e21c 809 }
protongamer 1:c022a879e21c 810
protongamer 1:c022a879e21c 811 break;
protongamer 1:c022a879e21c 812
protongamer 1:c022a879e21c 813 case 'C':
protongamer 1:c022a879e21c 814 pc.printf("c");
protongamer 1:c022a879e21c 815
protongamer 1:c022a879e21c 816 if(state_val > 0){
protongamer 1:c022a879e21c 817 identifier = identifier << 4;
protongamer 1:c022a879e21c 818 identifier |= 0b1100;
protongamer 1:c022a879e21c 819 }
protongamer 1:c022a879e21c 820
protongamer 1:c022a879e21c 821 if(state_val == 0){
protongamer 1:c022a879e21c 822 identifier = 0b1100;
protongamer 1:c022a879e21c 823 state_val++;
protongamer 1:c022a879e21c 824 }
protongamer 1:c022a879e21c 825
protongamer 1:c022a879e21c 826 break;
protongamer 1:c022a879e21c 827
protongamer 1:c022a879e21c 828 case 'D':
protongamer 1:c022a879e21c 829 pc.printf("d");
protongamer 1:c022a879e21c 830
protongamer 1:c022a879e21c 831 if(state_val > 0){
protongamer 1:c022a879e21c 832 identifier = identifier << 4;
protongamer 1:c022a879e21c 833 identifier |= 0b1101;
protongamer 1:c022a879e21c 834 }
protongamer 1:c022a879e21c 835
protongamer 1:c022a879e21c 836 if(state_val == 0){
protongamer 1:c022a879e21c 837 identifier = 0b1101;
protongamer 1:c022a879e21c 838 state_val++;
protongamer 1:c022a879e21c 839 }
protongamer 1:c022a879e21c 840
protongamer 1:c022a879e21c 841 break;
protongamer 1:c022a879e21c 842
protongamer 1:c022a879e21c 843 case 'E':
protongamer 1:c022a879e21c 844 pc.printf("e");
protongamer 1:c022a879e21c 845
protongamer 1:c022a879e21c 846 if(state_val > 0){
protongamer 1:c022a879e21c 847 identifier = identifier << 4;
protongamer 1:c022a879e21c 848 identifier |= 0b1110;
protongamer 1:c022a879e21c 849 }
protongamer 1:c022a879e21c 850
protongamer 1:c022a879e21c 851 if(state_val == 0){
protongamer 1:c022a879e21c 852 identifier = 0b1110;
protongamer 1:c022a879e21c 853 state_val++;
protongamer 1:c022a879e21c 854 }
protongamer 1:c022a879e21c 855
protongamer 1:c022a879e21c 856 break;
protongamer 1:c022a879e21c 857
protongamer 1:c022a879e21c 858 case 'F':
protongamer 1:c022a879e21c 859 pc.printf("f");
protongamer 1:c022a879e21c 860
protongamer 1:c022a879e21c 861 if(state_val > 0){
protongamer 1:c022a879e21c 862 identifier = identifier << 4;
protongamer 1:c022a879e21c 863 identifier |= 0b1111;
protongamer 1:c022a879e21c 864 }
protongamer 1:c022a879e21c 865
protongamer 1:c022a879e21c 866 if(state_val == 0){
protongamer 1:c022a879e21c 867 identifier = 0b1111;
protongamer 1:c022a879e21c 868 state_val++;
protongamer 1:c022a879e21c 869 }
protongamer 1:c022a879e21c 870
protongamer 1:c022a879e21c 871 break;
protongamer 1:c022a879e21c 872
protongamer 1:c022a879e21c 873 case '\r': //si au sérial nous avons le retour de ligne
protongamer 1:c022a879e21c 874 pc.printf("\r\n0x%x \r\n", identifier);
protongamer 1:c022a879e21c 875 wait(1.0);
protongamer 1:c022a879e21c 876 state = MENU_DISPLAY;
protongamer 1:c022a879e21c 877 state_val = 0;
protongamer 1:c022a879e21c 878 break;
protongamer 1:c022a879e21c 879
protongamer 1:c022a879e21c 880
protongamer 1:c022a879e21c 881 }
protongamer 1:c022a879e21c 882
protongamer 1:c022a879e21c 883
protongamer 1:c022a879e21c 884 break;
protongamer 1:c022a879e21c 885
protongamer 1:c022a879e21c 886
protongamer 1:c022a879e21c 887
protongamer 1:c022a879e21c 888
protongamer 1:c022a879e21c 889 }
protongamer 1:c022a879e21c 890
protongamer 1:c022a879e21c 891
protongamer 1:c022a879e21c 892
protongamer 1:c022a879e21c 893
protongamer 1:c022a879e21c 894 //wait(0.2);
protongamer 1:c022a879e21c 895 }
protongamer 1:c022a879e21c 896 }
protongamer 1:c022a879e21c 897
protongamer 1:c022a879e21c 898 /*printf("loop()\n");
LabSE 0:cea062e60f85 899 if(can2.read(msg)) {
protongamer 1:c022a879e21c 900 printf("Message received: %d\n", msg.data[0]);
protongamer 1:c022a879e21c 901 led2 = !led2;
protongamer 1:c022a879e21c 902 } */