This is a program to simulate a waiting line queuing system on FRDM K64F microcontroller.

Dependencies:   mbed-rtos mbed

Committer:
wmerghan
Date:
Wed May 03 16:28:47 2017 +0000
Revision:
0:c848f9fd4d72
This is a program that is used to program a FRDM K64F microcontroller to simulate a waiting line queuing system.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wmerghan 0:c848f9fd4d72 1 #include "mbed.h"
wmerghan 0:c848f9fd4d72 2 #include "rtos.h"
wmerghan 0:c848f9fd4d72 3
wmerghan 0:c848f9fd4d72 4 Serial pc(USBTX, USBRX); // tx, rx
wmerghan 0:c848f9fd4d72 5 Serial bt(PTC17, PTC16);
wmerghan 0:c848f9fd4d72 6 AnalogIn man_ticket(PTC11);
wmerghan 0:c848f9fd4d72 7 AnalogIn temp(PTC10);
wmerghan 0:c848f9fd4d72 8 AnalogIn emp1_button(PTB2);
wmerghan 0:c848f9fd4d72 9 AnalogIn emp2_button(PTB3);
wmerghan 0:c848f9fd4d72 10 DigitalOut emp1_led(PTE24, 0);
wmerghan 0:c848f9fd4d72 11 DigitalOut emp2_led(PTE25, 0);
wmerghan 0:c848f9fd4d72 12 DigitalOut fan(PTA1, 0);
wmerghan 0:c848f9fd4d72 13 DigitalOut dc_motor(PTA2, 0);
wmerghan 0:c848f9fd4d72 14 DigitalOut spkr(PTD0, 0);
wmerghan 0:c848f9fd4d72 15
wmerghan 0:c848f9fd4d72 16 DigitalOut P1(PTC9, 0);
wmerghan 0:c848f9fd4d72 17 DigitalOut P2(PTC8, 0);
wmerghan 0:c848f9fd4d72 18 DigitalOut P3(PTB9, 0);
wmerghan 0:c848f9fd4d72 19 DigitalOut P4(PTC1, 0);
wmerghan 0:c848f9fd4d72 20 DigitalOut P5(PTB19, 0);
wmerghan 0:c848f9fd4d72 21 DigitalOut P6(PTB18, 1);
wmerghan 0:c848f9fd4d72 22 DigitalOut P7(PTC3, 0);
wmerghan 0:c848f9fd4d72 23 DigitalOut P8(PTC5, 1);
wmerghan 0:c848f9fd4d72 24 DigitalOut P9(PTC2, 1);
wmerghan 0:c848f9fd4d72 25 DigitalOut P10(PTC7, 0);
wmerghan 0:c848f9fd4d72 26 DigitalOut P11(PTC0, 0);
wmerghan 0:c848f9fd4d72 27 DigitalOut P12(PTB23, 1);
wmerghan 0:c848f9fd4d72 28
wmerghan 0:c848f9fd4d72 29 unsigned int ticket_motor_cntr = 5;
wmerghan 0:c848f9fd4d72 30 int ticket_motor_f = 0;
wmerghan 0:c848f9fd4d72 31 bool motor_on_f = false;
wmerghan 0:c848f9fd4d72 32
wmerghan 0:c848f9fd4d72 33 int emp1_f = 0;
wmerghan 0:c848f9fd4d72 34 int emp2_f = 0;
wmerghan 0:c848f9fd4d72 35
wmerghan 0:c848f9fd4d72 36 double tempF = 0;
wmerghan 0:c848f9fd4d72 37
wmerghan 0:c848f9fd4d72 38 char counter_num = '\0';
wmerghan 0:c848f9fd4d72 39 char queue_cnt = '\0';
wmerghan 0:c848f9fd4d72 40 char ticket_cnt = '\0';
wmerghan 0:c848f9fd4d72 41 int ticket_nones = 0;
wmerghan 0:c848f9fd4d72 42 int ticket_ntens = 0;
wmerghan 0:c848f9fd4d72 43 char c = 'f';
wmerghan 0:c848f9fd4d72 44 bool keepgoing = true;
wmerghan 0:c848f9fd4d72 45
wmerghan 0:c848f9fd4d72 46 int ch1 = 99 ;
wmerghan 0:c848f9fd4d72 47 int ch2 = 99;
wmerghan 0:c848f9fd4d72 48 int ch3 = 99;
wmerghan 0:c848f9fd4d72 49 int ch4 = 99;
wmerghan 0:c848f9fd4d72 50
wmerghan 0:c848f9fd4d72 51 void norm_op(void);
wmerghan 0:c848f9fd4d72 52 void on_op(void);
wmerghan 0:c848f9fd4d72 53 void off_op(void);
wmerghan 0:c848f9fd4d72 54 void emergency_op(void);
wmerghan 0:c848f9fd4d72 55 void disp_str(int ch4, int ch1, int ch2, int ch3);
wmerghan 0:c848f9fd4d72 56
wmerghan 0:c848f9fd4d72 57 void display_thread(void const *args);
wmerghan 0:c848f9fd4d72 58
wmerghan 0:c848f9fd4d72 59 int main(void)
wmerghan 0:c848f9fd4d72 60 {
wmerghan 0:c848f9fd4d72 61 pc.printf("Started\r\n");
wmerghan 0:c848f9fd4d72 62
wmerghan 0:c848f9fd4d72 63 Thread thread(display_thread);
wmerghan 0:c848f9fd4d72 64
wmerghan 0:c848f9fd4d72 65 while(true)
wmerghan 0:c848f9fd4d72 66 {
wmerghan 0:c848f9fd4d72 67 if(bt.readable() > 0)
wmerghan 0:c848f9fd4d72 68 c = bt.getc();
wmerghan 0:c848f9fd4d72 69
wmerghan 0:c848f9fd4d72 70 switch(c)
wmerghan 0:c848f9fd4d72 71 {
wmerghan 0:c848f9fd4d72 72 case 'n':
wmerghan 0:c848f9fd4d72 73 norm_op();
wmerghan 0:c848f9fd4d72 74 break;
wmerghan 0:c848f9fd4d72 75
wmerghan 0:c848f9fd4d72 76 case 'o':
wmerghan 0:c848f9fd4d72 77 on_op();
wmerghan 0:c848f9fd4d72 78 break;
wmerghan 0:c848f9fd4d72 79
wmerghan 0:c848f9fd4d72 80 case 'f':
wmerghan 0:c848f9fd4d72 81 off_op();
wmerghan 0:c848f9fd4d72 82 break;
wmerghan 0:c848f9fd4d72 83
wmerghan 0:c848f9fd4d72 84 case 'r':
wmerghan 0:c848f9fd4d72 85 queue_cnt++;
wmerghan 0:c848f9fd4d72 86 bt.printf("%c", queue_cnt);
wmerghan 0:c848f9fd4d72 87 c = 'n';
wmerghan 0:c848f9fd4d72 88 break;
wmerghan 0:c848f9fd4d72 89
wmerghan 0:c848f9fd4d72 90 case 'e':
wmerghan 0:c848f9fd4d72 91 emergency_op();
wmerghan 0:c848f9fd4d72 92 break;
wmerghan 0:c848f9fd4d72 93
wmerghan 0:c848f9fd4d72 94 default :
wmerghan 0:c848f9fd4d72 95 break;
wmerghan 0:c848f9fd4d72 96 }
wmerghan 0:c848f9fd4d72 97 }
wmerghan 0:c848f9fd4d72 98 }
wmerghan 0:c848f9fd4d72 99
wmerghan 0:c848f9fd4d72 100 void norm_op(void)
wmerghan 0:c848f9fd4d72 101 {
wmerghan 0:c848f9fd4d72 102 ticket_nones = ticket_cnt % 10;
wmerghan 0:c848f9fd4d72 103 ticket_ntens = ticket_cnt/10;;
wmerghan 0:c848f9fd4d72 104
wmerghan 0:c848f9fd4d72 105 ch1 = ticket_ntens;
wmerghan 0:c848f9fd4d72 106 ch2 = ticket_nones;
wmerghan 0:c848f9fd4d72 107 ch3 = 10;
wmerghan 0:c848f9fd4d72 108
wmerghan 0:c848f9fd4d72 109 ticket_motor_f = man_ticket.read();
wmerghan 0:c848f9fd4d72 110
wmerghan 0:c848f9fd4d72 111 if (ticket_motor_f)
wmerghan 0:c848f9fd4d72 112 {
wmerghan 0:c848f9fd4d72 113 queue_cnt++;
wmerghan 0:c848f9fd4d72 114 motor_on_f = true;
wmerghan 0:c848f9fd4d72 115 }
wmerghan 0:c848f9fd4d72 116
wmerghan 0:c848f9fd4d72 117 if (motor_on_f && ticket_motor_cntr > 0)
wmerghan 0:c848f9fd4d72 118 {
wmerghan 0:c848f9fd4d72 119 dc_motor = 1;
wmerghan 0:c848f9fd4d72 120 wait(1);
wmerghan 0:c848f9fd4d72 121 ticket_motor_cntr--;
wmerghan 0:c848f9fd4d72 122 }
wmerghan 0:c848f9fd4d72 123 else
wmerghan 0:c848f9fd4d72 124 {
wmerghan 0:c848f9fd4d72 125 dc_motor = 0;
wmerghan 0:c848f9fd4d72 126 motor_on_f = false;
wmerghan 0:c848f9fd4d72 127 ticket_motor_f = 0;
wmerghan 0:c848f9fd4d72 128 ticket_motor_cntr = 5;
wmerghan 0:c848f9fd4d72 129 }
wmerghan 0:c848f9fd4d72 130
wmerghan 0:c848f9fd4d72 131 tempF = temp * 330;
wmerghan 0:c848f9fd4d72 132
wmerghan 0:c848f9fd4d72 133 if(tempF > 35)
wmerghan 0:c848f9fd4d72 134 fan = 1;
wmerghan 0:c848f9fd4d72 135 else
wmerghan 0:c848f9fd4d72 136 fan = 0;
wmerghan 0:c848f9fd4d72 137
wmerghan 0:c848f9fd4d72 138 emp1_f = emp1_button.read();
wmerghan 0:c848f9fd4d72 139
wmerghan 0:c848f9fd4d72 140 if(emp1_f)
wmerghan 0:c848f9fd4d72 141 {
wmerghan 0:c848f9fd4d72 142 if(ticket_cnt < queue_cnt)
wmerghan 0:c848f9fd4d72 143 {
wmerghan 0:c848f9fd4d72 144 ticket_cnt++;
wmerghan 0:c848f9fd4d72 145 ch4 = 1;
wmerghan 0:c848f9fd4d72 146 emp1_led = 1;
wmerghan 0:c848f9fd4d72 147 wait(5);
wmerghan 0:c848f9fd4d72 148 emp1_led = 0;
wmerghan 0:c848f9fd4d72 149 }
wmerghan 0:c848f9fd4d72 150 }
wmerghan 0:c848f9fd4d72 151
wmerghan 0:c848f9fd4d72 152 emp2_f = emp2_button.read();
wmerghan 0:c848f9fd4d72 153
wmerghan 0:c848f9fd4d72 154 if(emp2_f)
wmerghan 0:c848f9fd4d72 155 {
wmerghan 0:c848f9fd4d72 156 if(ticket_cnt < queue_cnt)
wmerghan 0:c848f9fd4d72 157 {
wmerghan 0:c848f9fd4d72 158 ticket_cnt++;
wmerghan 0:c848f9fd4d72 159 ch4 = 2;
wmerghan 0:c848f9fd4d72 160 emp2_led = 1;
wmerghan 0:c848f9fd4d72 161 wait(5);
wmerghan 0:c848f9fd4d72 162 emp2_led = 0;
wmerghan 0:c848f9fd4d72 163 }
wmerghan 0:c848f9fd4d72 164 }
wmerghan 0:c848f9fd4d72 165
wmerghan 0:c848f9fd4d72 166 keepgoing = true;
wmerghan 0:c848f9fd4d72 167 }
wmerghan 0:c848f9fd4d72 168
wmerghan 0:c848f9fd4d72 169 void emergency_op(void)
wmerghan 0:c848f9fd4d72 170 {
wmerghan 0:c848f9fd4d72 171 while(keepgoing)
wmerghan 0:c848f9fd4d72 172 {
wmerghan 0:c848f9fd4d72 173 if(bt.readable() > 0)
wmerghan 0:c848f9fd4d72 174 c = bt.getc();
wmerghan 0:c848f9fd4d72 175
wmerghan 0:c848f9fd4d72 176 switch(c)
wmerghan 0:c848f9fd4d72 177 {
wmerghan 0:c848f9fd4d72 178 case 'f':
wmerghan 0:c848f9fd4d72 179 keepgoing = false;
wmerghan 0:c848f9fd4d72 180 break;
wmerghan 0:c848f9fd4d72 181
wmerghan 0:c848f9fd4d72 182 default :
wmerghan 0:c848f9fd4d72 183 ch1 = 99;
wmerghan 0:c848f9fd4d72 184 ch2 = 9;
wmerghan 0:c848f9fd4d72 185 ch3 = 1;
wmerghan 0:c848f9fd4d72 186 ch4 = 1;
wmerghan 0:c848f9fd4d72 187 spkr = 1;
wmerghan 0:c848f9fd4d72 188 emp1_led = 1;
wmerghan 0:c848f9fd4d72 189 emp2_led = 1;
wmerghan 0:c848f9fd4d72 190 wait(2);
wmerghan 0:c848f9fd4d72 191 spkr = 0;
wmerghan 0:c848f9fd4d72 192 emp1_led = 0;
wmerghan 0:c848f9fd4d72 193 emp2_led = 0;
wmerghan 0:c848f9fd4d72 194 wait(1);
wmerghan 0:c848f9fd4d72 195 break;
wmerghan 0:c848f9fd4d72 196 }
wmerghan 0:c848f9fd4d72 197 }
wmerghan 0:c848f9fd4d72 198 keepgoing = true;
wmerghan 0:c848f9fd4d72 199 }
wmerghan 0:c848f9fd4d72 200
wmerghan 0:c848f9fd4d72 201 void on_op(void)
wmerghan 0:c848f9fd4d72 202 {
wmerghan 0:c848f9fd4d72 203 while(keepgoing)
wmerghan 0:c848f9fd4d72 204 {
wmerghan 0:c848f9fd4d72 205 if(bt.readable() > 0)
wmerghan 0:c848f9fd4d72 206 c = bt.getc();
wmerghan 0:c848f9fd4d72 207
wmerghan 0:c848f9fd4d72 208 switch(c)
wmerghan 0:c848f9fd4d72 209 {
wmerghan 0:c848f9fd4d72 210 case 'f':
wmerghan 0:c848f9fd4d72 211 keepgoing = false;
wmerghan 0:c848f9fd4d72 212 break;
wmerghan 0:c848f9fd4d72 213
wmerghan 0:c848f9fd4d72 214 case 'e':
wmerghan 0:c848f9fd4d72 215 keepgoing = false;
wmerghan 0:c848f9fd4d72 216 break;
wmerghan 0:c848f9fd4d72 217
wmerghan 0:c848f9fd4d72 218 default :
wmerghan 0:c848f9fd4d72 219 dc_motor = 1;
wmerghan 0:c848f9fd4d72 220 emp1_led = 1;
wmerghan 0:c848f9fd4d72 221 emp2_led = 1;
wmerghan 0:c848f9fd4d72 222 fan = 1;
wmerghan 0:c848f9fd4d72 223 break;
wmerghan 0:c848f9fd4d72 224 }
wmerghan 0:c848f9fd4d72 225 }
wmerghan 0:c848f9fd4d72 226 keepgoing = true;
wmerghan 0:c848f9fd4d72 227 }
wmerghan 0:c848f9fd4d72 228
wmerghan 0:c848f9fd4d72 229 void off_op(void)
wmerghan 0:c848f9fd4d72 230 {
wmerghan 0:c848f9fd4d72 231 while(keepgoing)
wmerghan 0:c848f9fd4d72 232 {
wmerghan 0:c848f9fd4d72 233 if(bt.readable() > 0)
wmerghan 0:c848f9fd4d72 234 c = bt.getc();
wmerghan 0:c848f9fd4d72 235
wmerghan 0:c848f9fd4d72 236 switch(c)
wmerghan 0:c848f9fd4d72 237 {
wmerghan 0:c848f9fd4d72 238 case 'n':
wmerghan 0:c848f9fd4d72 239 keepgoing = false;
wmerghan 0:c848f9fd4d72 240 break;
wmerghan 0:c848f9fd4d72 241
wmerghan 0:c848f9fd4d72 242 case 'o':
wmerghan 0:c848f9fd4d72 243 keepgoing = false;
wmerghan 0:c848f9fd4d72 244 break;
wmerghan 0:c848f9fd4d72 245
wmerghan 0:c848f9fd4d72 246 case 'e':
wmerghan 0:c848f9fd4d72 247 keepgoing = false;
wmerghan 0:c848f9fd4d72 248 break;
wmerghan 0:c848f9fd4d72 249
wmerghan 0:c848f9fd4d72 250 default :
wmerghan 0:c848f9fd4d72 251 queue_cnt = 0;
wmerghan 0:c848f9fd4d72 252 ticket_cnt = 0;
wmerghan 0:c848f9fd4d72 253 emp1_led = 0;
wmerghan 0:c848f9fd4d72 254 emp2_led = 0;
wmerghan 0:c848f9fd4d72 255 dc_motor = 0;
wmerghan 0:c848f9fd4d72 256 fan = 0;
wmerghan 0:c848f9fd4d72 257 break;
wmerghan 0:c848f9fd4d72 258 }
wmerghan 0:c848f9fd4d72 259 }
wmerghan 0:c848f9fd4d72 260 keepgoing = true;
wmerghan 0:c848f9fd4d72 261 }
wmerghan 0:c848f9fd4d72 262
wmerghan 0:c848f9fd4d72 263 void disp_str(int ch4, int ch1, int ch2, int ch3)
wmerghan 0:c848f9fd4d72 264 {
wmerghan 0:c848f9fd4d72 265 P6 = 1; // 4 ground
wmerghan 0:c848f9fd4d72 266 P8 = 1; // 3 ground
wmerghan 0:c848f9fd4d72 267 P9 = 1; // 2 ground
wmerghan 0:c848f9fd4d72 268 P12 = 0; // 1 ground
wmerghan 0:c848f9fd4d72 269
wmerghan 0:c848f9fd4d72 270 wait_ms(1);
wmerghan 0:c848f9fd4d72 271
wmerghan 0:c848f9fd4d72 272 switch(ch1)
wmerghan 0:c848f9fd4d72 273 {
wmerghan 0:c848f9fd4d72 274 case 0:
wmerghan 0:c848f9fd4d72 275 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 276 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 277 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 278 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 279 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 280 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 281 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 282 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 283 break;
wmerghan 0:c848f9fd4d72 284
wmerghan 0:c848f9fd4d72 285 case 1:
wmerghan 0:c848f9fd4d72 286 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 287 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 288 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 289 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 290 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 291 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 292 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 293 P11 = 0; // A segment
wmerghan 0:c848f9fd4d72 294 break;
wmerghan 0:c848f9fd4d72 295
wmerghan 0:c848f9fd4d72 296 case 2:
wmerghan 0:c848f9fd4d72 297 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 298 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 299 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 300 P4 = 0; // C segment
wmerghan 0:c848f9fd4d72 301 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 302 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 303 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 304 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 305 break;
wmerghan 0:c848f9fd4d72 306
wmerghan 0:c848f9fd4d72 307 case 3:
wmerghan 0:c848f9fd4d72 308 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 309 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 310 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 311 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 312 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 313 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 314 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 315 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 316 break;
wmerghan 0:c848f9fd4d72 317
wmerghan 0:c848f9fd4d72 318 case 4:
wmerghan 0:c848f9fd4d72 319 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 320 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 321 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 322 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 323 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 324 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 325 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 326 P11 = 0; // A segment
wmerghan 0:c848f9fd4d72 327 break;
wmerghan 0:c848f9fd4d72 328
wmerghan 0:c848f9fd4d72 329 case 5:
wmerghan 0:c848f9fd4d72 330 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 331 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 332 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 333 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 334 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 335 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 336 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 337 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 338 break;
wmerghan 0:c848f9fd4d72 339
wmerghan 0:c848f9fd4d72 340 case 6:
wmerghan 0:c848f9fd4d72 341 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 342 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 343 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 344 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 345 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 346 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 347 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 348 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 349 break;
wmerghan 0:c848f9fd4d72 350
wmerghan 0:c848f9fd4d72 351 case 7:
wmerghan 0:c848f9fd4d72 352 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 353 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 354 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 355 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 356 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 357 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 358 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 359 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 360 break;
wmerghan 0:c848f9fd4d72 361
wmerghan 0:c848f9fd4d72 362 case 8:
wmerghan 0:c848f9fd4d72 363 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 364 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 365 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 366 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 367 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 368 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 369 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 370 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 371 break;
wmerghan 0:c848f9fd4d72 372
wmerghan 0:c848f9fd4d72 373 case 9:
wmerghan 0:c848f9fd4d72 374 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 375 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 376 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 377 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 378 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 379 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 380 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 381 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 382 break;
wmerghan 0:c848f9fd4d72 383
wmerghan 0:c848f9fd4d72 384 case 10:
wmerghan 0:c848f9fd4d72 385 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 386 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 387 P3 = 1; // Dot segment
wmerghan 0:c848f9fd4d72 388 P4 = 0; // C segment
wmerghan 0:c848f9fd4d72 389 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 390 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 391 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 392 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 393 break;
wmerghan 0:c848f9fd4d72 394
wmerghan 0:c848f9fd4d72 395 default :
wmerghan 0:c848f9fd4d72 396 break;
wmerghan 0:c848f9fd4d72 397 }
wmerghan 0:c848f9fd4d72 398
wmerghan 0:c848f9fd4d72 399 P6 = 1; // 4 ground
wmerghan 0:c848f9fd4d72 400 P8 = 1; // 3 ground
wmerghan 0:c848f9fd4d72 401 P9 = 1; // 2 ground
wmerghan 0:c848f9fd4d72 402 P12 = 1; // 1 ground
wmerghan 0:c848f9fd4d72 403
wmerghan 0:c848f9fd4d72 404 P6 = 1; // 4 ground
wmerghan 0:c848f9fd4d72 405 P8 = 1; // 3 ground
wmerghan 0:c848f9fd4d72 406 P9 = 0; // 2 ground
wmerghan 0:c848f9fd4d72 407 P12 = 1; // 1 ground
wmerghan 0:c848f9fd4d72 408
wmerghan 0:c848f9fd4d72 409 wait_ms(1);
wmerghan 0:c848f9fd4d72 410
wmerghan 0:c848f9fd4d72 411 switch(ch2)
wmerghan 0:c848f9fd4d72 412 {
wmerghan 0:c848f9fd4d72 413 case 0:
wmerghan 0:c848f9fd4d72 414 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 415 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 416 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 417 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 418 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 419 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 420 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 421 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 422 break;
wmerghan 0:c848f9fd4d72 423
wmerghan 0:c848f9fd4d72 424 case 1:
wmerghan 0:c848f9fd4d72 425 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 426 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 427 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 428 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 429 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 430 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 431 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 432 P11 = 0; // A segment
wmerghan 0:c848f9fd4d72 433 break;
wmerghan 0:c848f9fd4d72 434
wmerghan 0:c848f9fd4d72 435 case 2:
wmerghan 0:c848f9fd4d72 436 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 437 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 438 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 439 P4 = 0; // C segment
wmerghan 0:c848f9fd4d72 440 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 441 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 442 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 443 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 444 break;
wmerghan 0:c848f9fd4d72 445
wmerghan 0:c848f9fd4d72 446 case 3:
wmerghan 0:c848f9fd4d72 447 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 448 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 449 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 450 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 451 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 452 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 453 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 454 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 455 break;
wmerghan 0:c848f9fd4d72 456
wmerghan 0:c848f9fd4d72 457 case 4:
wmerghan 0:c848f9fd4d72 458 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 459 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 460 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 461 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 462 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 463 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 464 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 465 P11 = 0; // A segment
wmerghan 0:c848f9fd4d72 466 break;
wmerghan 0:c848f9fd4d72 467
wmerghan 0:c848f9fd4d72 468 case 5:
wmerghan 0:c848f9fd4d72 469 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 470 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 471 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 472 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 473 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 474 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 475 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 476 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 477 break;
wmerghan 0:c848f9fd4d72 478
wmerghan 0:c848f9fd4d72 479 case 6:
wmerghan 0:c848f9fd4d72 480 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 481 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 482 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 483 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 484 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 485 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 486 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 487 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 488 break;
wmerghan 0:c848f9fd4d72 489
wmerghan 0:c848f9fd4d72 490 case 7:
wmerghan 0:c848f9fd4d72 491 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 492 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 493 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 494 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 495 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 496 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 497 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 498 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 499 break;
wmerghan 0:c848f9fd4d72 500
wmerghan 0:c848f9fd4d72 501 case 8:
wmerghan 0:c848f9fd4d72 502 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 503 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 504 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 505 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 506 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 507 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 508 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 509 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 510 break;
wmerghan 0:c848f9fd4d72 511
wmerghan 0:c848f9fd4d72 512 case 9:
wmerghan 0:c848f9fd4d72 513 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 514 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 515 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 516 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 517 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 518 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 519 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 520 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 521 break;
wmerghan 0:c848f9fd4d72 522
wmerghan 0:c848f9fd4d72 523 case 10:
wmerghan 0:c848f9fd4d72 524 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 525 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 526 P3 = 1; // Dot segment
wmerghan 0:c848f9fd4d72 527 P4 = 0; // C segment
wmerghan 0:c848f9fd4d72 528 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 529 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 530 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 531 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 532 break;
wmerghan 0:c848f9fd4d72 533
wmerghan 0:c848f9fd4d72 534 default :
wmerghan 0:c848f9fd4d72 535 break;
wmerghan 0:c848f9fd4d72 536 }
wmerghan 0:c848f9fd4d72 537
wmerghan 0:c848f9fd4d72 538 P6 = 1; // 4 ground
wmerghan 0:c848f9fd4d72 539 P8 = 1; // 3 ground
wmerghan 0:c848f9fd4d72 540 P9 = 1; // 2 ground
wmerghan 0:c848f9fd4d72 541 P12 = 1; // 1 ground
wmerghan 0:c848f9fd4d72 542
wmerghan 0:c848f9fd4d72 543 P6 = 1; // 4 ground
wmerghan 0:c848f9fd4d72 544 P8 = 0; // 3 ground
wmerghan 0:c848f9fd4d72 545 P9 = 1; // 2 ground
wmerghan 0:c848f9fd4d72 546 P12 = 1; // 1 ground
wmerghan 0:c848f9fd4d72 547
wmerghan 0:c848f9fd4d72 548 wait_ms(1);
wmerghan 0:c848f9fd4d72 549
wmerghan 0:c848f9fd4d72 550 switch(ch3)
wmerghan 0:c848f9fd4d72 551 {
wmerghan 0:c848f9fd4d72 552 case 0:
wmerghan 0:c848f9fd4d72 553 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 554 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 555 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 556 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 557 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 558 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 559 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 560 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 561 break;
wmerghan 0:c848f9fd4d72 562
wmerghan 0:c848f9fd4d72 563 case 1:
wmerghan 0:c848f9fd4d72 564 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 565 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 566 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 567 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 568 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 569 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 570 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 571 P11 = 0; // A segment
wmerghan 0:c848f9fd4d72 572 break;
wmerghan 0:c848f9fd4d72 573
wmerghan 0:c848f9fd4d72 574 case 2:
wmerghan 0:c848f9fd4d72 575 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 576 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 577 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 578 P4 = 0; // C segment
wmerghan 0:c848f9fd4d72 579 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 580 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 581 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 582 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 583 break;
wmerghan 0:c848f9fd4d72 584
wmerghan 0:c848f9fd4d72 585 case 3:
wmerghan 0:c848f9fd4d72 586 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 587 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 588 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 589 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 590 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 591 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 592 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 593 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 594 break;
wmerghan 0:c848f9fd4d72 595
wmerghan 0:c848f9fd4d72 596 case 4:
wmerghan 0:c848f9fd4d72 597 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 598 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 599 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 600 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 601 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 602 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 603 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 604 P11 = 0; // A segment
wmerghan 0:c848f9fd4d72 605 break;
wmerghan 0:c848f9fd4d72 606
wmerghan 0:c848f9fd4d72 607 case 5:
wmerghan 0:c848f9fd4d72 608 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 609 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 610 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 611 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 612 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 613 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 614 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 615 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 616 break;
wmerghan 0:c848f9fd4d72 617
wmerghan 0:c848f9fd4d72 618 case 6:
wmerghan 0:c848f9fd4d72 619 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 620 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 621 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 622 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 623 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 624 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 625 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 626 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 627 break;
wmerghan 0:c848f9fd4d72 628
wmerghan 0:c848f9fd4d72 629 case 7:
wmerghan 0:c848f9fd4d72 630 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 631 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 632 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 633 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 634 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 635 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 636 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 637 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 638 break;
wmerghan 0:c848f9fd4d72 639
wmerghan 0:c848f9fd4d72 640 case 8:
wmerghan 0:c848f9fd4d72 641 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 642 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 643 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 644 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 645 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 646 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 647 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 648 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 649 break;
wmerghan 0:c848f9fd4d72 650
wmerghan 0:c848f9fd4d72 651 case 9:
wmerghan 0:c848f9fd4d72 652 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 653 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 654 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 655 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 656 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 657 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 658 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 659 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 660 break;
wmerghan 0:c848f9fd4d72 661
wmerghan 0:c848f9fd4d72 662 case 10:
wmerghan 0:c848f9fd4d72 663 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 664 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 665 P3 = 1; // Dot segment
wmerghan 0:c848f9fd4d72 666 P4 = 0; // C segment
wmerghan 0:c848f9fd4d72 667 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 668 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 669 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 670 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 671 break;
wmerghan 0:c848f9fd4d72 672
wmerghan 0:c848f9fd4d72 673 default :
wmerghan 0:c848f9fd4d72 674 break;
wmerghan 0:c848f9fd4d72 675 }
wmerghan 0:c848f9fd4d72 676
wmerghan 0:c848f9fd4d72 677 P6 = 1; // 4 ground
wmerghan 0:c848f9fd4d72 678 P8 = 1; // 3 ground
wmerghan 0:c848f9fd4d72 679 P9 = 1; // 2 ground
wmerghan 0:c848f9fd4d72 680 P12 = 1; // 1 ground
wmerghan 0:c848f9fd4d72 681
wmerghan 0:c848f9fd4d72 682 P6 = 0; // 4 ground
wmerghan 0:c848f9fd4d72 683 P8 = 1; // 3 ground
wmerghan 0:c848f9fd4d72 684 P9 = 1; // 2 ground
wmerghan 0:c848f9fd4d72 685 P12 = 1; // 1 ground
wmerghan 0:c848f9fd4d72 686
wmerghan 0:c848f9fd4d72 687 wait_ms(1);
wmerghan 0:c848f9fd4d72 688
wmerghan 0:c848f9fd4d72 689 switch(ch4)
wmerghan 0:c848f9fd4d72 690 {
wmerghan 0:c848f9fd4d72 691 case 0:
wmerghan 0:c848f9fd4d72 692 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 693 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 694 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 695 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 696 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 697 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 698 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 699 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 700 break;
wmerghan 0:c848f9fd4d72 701
wmerghan 0:c848f9fd4d72 702 case 1:
wmerghan 0:c848f9fd4d72 703 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 704 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 705 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 706 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 707 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 708 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 709 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 710 P11 = 0; // A segment
wmerghan 0:c848f9fd4d72 711 break;
wmerghan 0:c848f9fd4d72 712
wmerghan 0:c848f9fd4d72 713 case 2:
wmerghan 0:c848f9fd4d72 714 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 715 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 716 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 717 P4 = 0; // C segment
wmerghan 0:c848f9fd4d72 718 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 719 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 720 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 721 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 722 break;
wmerghan 0:c848f9fd4d72 723
wmerghan 0:c848f9fd4d72 724 case 3:
wmerghan 0:c848f9fd4d72 725 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 726 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 727 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 728 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 729 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 730 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 731 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 732 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 733 break;
wmerghan 0:c848f9fd4d72 734
wmerghan 0:c848f9fd4d72 735 case 4:
wmerghan 0:c848f9fd4d72 736 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 737 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 738 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 739 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 740 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 741 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 742 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 743 P11 = 0; // A segment
wmerghan 0:c848f9fd4d72 744 break;
wmerghan 0:c848f9fd4d72 745
wmerghan 0:c848f9fd4d72 746 case 5:
wmerghan 0:c848f9fd4d72 747 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 748 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 749 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 750 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 751 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 752 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 753 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 754 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 755 break;
wmerghan 0:c848f9fd4d72 756
wmerghan 0:c848f9fd4d72 757 case 6:
wmerghan 0:c848f9fd4d72 758 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 759 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 760 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 761 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 762 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 763 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 764 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 765 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 766 break;
wmerghan 0:c848f9fd4d72 767
wmerghan 0:c848f9fd4d72 768 case 7:
wmerghan 0:c848f9fd4d72 769 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 770 P2 = 0; // D segment
wmerghan 0:c848f9fd4d72 771 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 772 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 773 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 774 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 775 P10 = 0; // F segment
wmerghan 0:c848f9fd4d72 776 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 777 break;
wmerghan 0:c848f9fd4d72 778
wmerghan 0:c848f9fd4d72 779 case 8:
wmerghan 0:c848f9fd4d72 780 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 781 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 782 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 783 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 784 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 785 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 786 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 787 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 788 break;
wmerghan 0:c848f9fd4d72 789
wmerghan 0:c848f9fd4d72 790 case 9:
wmerghan 0:c848f9fd4d72 791 P1 = 0; // E segment
wmerghan 0:c848f9fd4d72 792 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 793 P3 = 0; // Dot segment
wmerghan 0:c848f9fd4d72 794 P4 = 1; // C segment
wmerghan 0:c848f9fd4d72 795 P5 = 1; // G segment
wmerghan 0:c848f9fd4d72 796 P7 = 1; // B segment
wmerghan 0:c848f9fd4d72 797 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 798 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 799 break;
wmerghan 0:c848f9fd4d72 800
wmerghan 0:c848f9fd4d72 801 case 10:
wmerghan 0:c848f9fd4d72 802 P1 = 1; // E segment
wmerghan 0:c848f9fd4d72 803 P2 = 1; // D segment
wmerghan 0:c848f9fd4d72 804 P3 = 1; // Dot segment
wmerghan 0:c848f9fd4d72 805 P4 = 0; // C segment
wmerghan 0:c848f9fd4d72 806 P5 = 0; // G segment
wmerghan 0:c848f9fd4d72 807 P7 = 0; // B segment
wmerghan 0:c848f9fd4d72 808 P10 = 1; // F segment
wmerghan 0:c848f9fd4d72 809 P11 = 1; // A segment
wmerghan 0:c848f9fd4d72 810 break;
wmerghan 0:c848f9fd4d72 811
wmerghan 0:c848f9fd4d72 812 default :
wmerghan 0:c848f9fd4d72 813 break;
wmerghan 0:c848f9fd4d72 814 }
wmerghan 0:c848f9fd4d72 815
wmerghan 0:c848f9fd4d72 816 P6 = 1; // 4 ground
wmerghan 0:c848f9fd4d72 817 P8 = 1; // 3 ground
wmerghan 0:c848f9fd4d72 818 P9 = 1; // 2 ground
wmerghan 0:c848f9fd4d72 819 P12 = 1; // 1 ground
wmerghan 0:c848f9fd4d72 820 }
wmerghan 0:c848f9fd4d72 821
wmerghan 0:c848f9fd4d72 822 void display_thread(void const *args)
wmerghan 0:c848f9fd4d72 823 {
wmerghan 0:c848f9fd4d72 824 while(true)
wmerghan 0:c848f9fd4d72 825 {
wmerghan 0:c848f9fd4d72 826 disp_str(ch1, ch2, ch3, ch4);
wmerghan 0:c848f9fd4d72 827 }
wmerghan 0:c848f9fd4d72 828 }