Real2Virtual202111

٤Ƴ٤Ĥ
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
|
|
|
!
 
-
|
|
!
 
-
|
|
!
 
-
|
|
|
!
 
-
|
|
|
!
 
-
|
!
 
-
|
|
|
!
 
-
|
|
|
!
 
 
 
 
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
 
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
-
|
|
|
|
|
|
!
!
-
|
|
|
|
|
|
|
|
|
!
 
-
-
!
|
-
!
|
-
!
!
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
|
-
!
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
!
|
-
!
|
-
!
!
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
-
-
-
!
|
-
!
|
-
!
!
 
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
-
-
|
!
!
 
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
-
-
|
|
!
!
 
-
-
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
 
#include "Initialize.h"
#include "mbed.h"
 
DigitalInOut pe0(p27);
DigitalInOut pe1(p28);
DigitalInOut pe2(p29);
DigitalInOut pe3(p30);
DigitalInOut pe4(p26);
DigitalInOut pe5(p25);
DigitalInOut pe6(p24);
DigitalInOut pe7(p23);
DigitalInOut pe8(p22);
DigitalInOut pe9(p21);
DigitalInOut pea(p20);
DigitalInOut peb(p19);
DigitalInOut pec(p18);
DigitalInOut ped(p17);
DigitalInOut pee(p16);
DigitalInOut pef(p15);
 
/* */
#define PXMAX 16
#define PBMAX 6
  unsigned char (*getPEX[PXMAX])(void);
  unsigned char (*getPMEX[PXMAX])(void);
  void (*setPEX[PXMAX])(unsigned char);
  void (*setPMEX[PXMAX])(unsigned char);
  unsigned char (*getPBX[PBMAX])(void);
  unsigned char (*getPMBX[PBMAX])(void);
  void (*setPBX[PBMAX])(unsigned char);
  void (*setPMBX[PBMAX])(unsigned char);
/* */
 
unsigned char getPEX_i(int i){
     if(i<0) return (unsigned char)(-1);
     if(i>PXMAX) return (unsigned char)(-1);
     return (*getPEX[i])();
}
 
unsigned char getPMEX_i(int i){
    if(i<0) return(unsigned char)(-1);
     return (*getPMEX[i])();
}
 
void setPEX_i(int i, unsigned  char c){
     if(i>PXMAX) return;
      (*setPEX[i])(c);
}
 
void setPMEX_i(int i, unsigned char c){
    if(i<0) return;
    if(i>PXMAX) return;
    (*setPMEX[i])(c);
}
 
unsigned char getPBX_i(int i){
     if(i<0) return (unsigned char)(-1);
     if(i>PBMAX) return (unsigned char)(-1);
     return (*getPBX[i])();
}
 
unsigned char getPMBX_i(int i){
     return (*getPMBX[i])();
}
 
void setPBX_i(int i, unsigned  char c){
     if(i>PBMAX) return;
      if(i<0) return;
      (*setPBX[i])(c);
}
 
void setPMBX_i(int i, unsigned  char c){
     if(i>PBMAX) return;
     if(i<0) return;
      (*setPMBX[i])(c);
}
 
 
int pinIO[16];
 
void setPE0(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//    LPC_GPIO0->DATA |= (1<<8);
//  else
//    LPC_GPIO0->DATA &= ~(1<<8);
    pe0=s;
}
void setPE1(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO0->DATA |= (1<<9);
//  else
//    LPC_GPIO0->DATA &= ~(1<<9);
    pe1=s;
}
void setPE2(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO0->DATA |= (1<<11);
//  else
//    LPC_GPIO0->DATA &= ~(1<<11);
    pe2=s;
}
void setPE3(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO1->DATA |= (1<<5);
//  else
//    LPC_GPIO1->DATA &= ~(1<<5);
     pe3=s;
}
void setPE4(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO0->DATA |= (1<<6);
//  else
//    LPC_GPIO0->DATA &= ~(1<<6);
     pe4=s;
}
void setPE5(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO0->DATA |= (1<<7);
//  else
//    LPC_GPIO0->DATA &= ~(1<<7);
    pe5=s;
}
void setPE6(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO0->DATA |= (1<<4);
//  else
//    LPC_GPIO0->DATA &= ~(1<<4);
    pe6=s;
}
void setPE7(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO0->DATA |= (1<<3);
//  else
//    LPC_GPIO0->DATA &= ~(1<<3);
    pe7=s;
}
void setPE8(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO0->DATA |= (1<<2);
//  else
//    LPC_GPIO0->DATA &= ~(1<<2);
    pe8=s;
}
void setPE9(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO1->DATA |= (1<<0);
//  else
//    LPC_GPIO1->DATA &= ~(1<<0);
    pe9=s;
}
 
void setPEA(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO1->DATA |= (1<<1);
//  else
//    LPC_GPIO1->DATA &= ~(1<<1);
     pea=s;
}
void setPEB(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO1->DATA |= (1<<2);
//  else
//    LPC_GPIO1->DATA &= ~(1<<2);
    peb=s;
}
void setPEC(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO1->DATA |= (1<<4);
//  else
//    LPC_GPIO1->DATA &= ~(1<<4);
    pec=s;
}
void setPED(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO1->DATA |= (1<<5);
//  else
//    LPC_GPIO1->DATA &= ~(1<<5);
    ped=s;
}
void setPEE(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO1->DATA |= (1<<8);
//  else
//    LPC_GPIO1->DATA &= ~(1<<8);
    pee=s;
}
void setPEF(unsigned char s){
  //LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
  //    LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
  //LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
//  if(s==1)
//      LPC_GPIO1->DATA |= (1<<9);
//  else
//    LPC_GPIO1->DATA &= ~(1<<9);
    pef=s;
}
/*
// 1. port initialize
LPC_IOCON->PIO0_7 = 0xd0;
LPC_IOCON->PIO1_5 = 0xd0;
LPC_IOCON->PIO0_1 = 0xd0;
 
// 2. port direction
LPC_GPIO0->DIR |= (1<<7); //PIO0-7 to output
LPC_GPIO1->DIR |= (1<<5); //PIO0-5 to output
LPC_GPIO0->DIR &= ~(1<<1); //PIO0-1 to input
*/
 
void setPME0(unsigned char s){
//    LPC_IOCON->PIO0_8 = 0xd0;
      pinIO[0]=s;
      if(s==1)
//      LPC_GPIO0->DIR |= (1<<8); // output
        pe0.output();
      else
//      LPC_GPIO0->DIR &= ~(1<<8); // input
        pe0.input();
}
void setPME1(unsigned char s){
//    LPC_IOCON->PIO0_9 = 0xd0;
      pinIO[1]=s;
      if(s==1)
//      LPC_GPIO0->DIR |= (1<<9); // output
        pe1.output();
      else
//      LPC_GPIO0->DIR &= ~(1<<9); // input
        pe1.input();
}
//void setPME2(unsigned char s){ PD.DDR.BIT.B2 = s; PMD.RM.B2=s;}
void setPME2(unsigned char s){
//    LPC_IOCON->R_PIO0_11 = 0xd0;
      pinIO[2]=s;
      if(s==1)
//      LPC_GPIO0->DIR |= (1<<11); // output
        pe2.output();
      else
//      LPC_GPIO0->DIR &= ~(1<<11); // input
        pe2.input();
}
//void setPME3(unsigned char s){ PD.DDR.BIT.B3 = s; PMD.RM.B3=s;}
void setPME3(unsigned char s){
//    LPC_IOCON->PIO0_5 = 0xd0;
      pinIO[3]=s;
      if(s==1)
//      LPC_GPIO0->DIR |= (1<<5); // output
        pe3.output();
      else
//      LPC_GPIO0->DIR &= ~(1<<5); // input
        pe3.input();
}
//void setPME4(unsigned char s){ PD.DDR.BIT.B4 = s; PMD.RM.B4=s;}
void setPME4(unsigned char s){
//    LPC_IOCON->PIO0_6 = 0xd0;
      pinIO[4]=s;
      if(s==1)
        pe4.output();
//      LPC_GPIO0->DIR |= (1<<6); // output
      else
//      LPC_GPIO0->DIR &= ~(1<<6); // input
        pe4.input();
}
//void setPME5(unsigned char s){ PD.DDR.BIT.B5 = s; PMD.RM.B5=s;}
void setPME5(unsigned char s){
//    LPC_IOCON->PIO0_7 = 0xd0;
      pinIO[5]=s;
      if(s==1)
//      LPC_GPIO0->DIR |= (1<<7); // output
         pe5.output();
      else
//      LPC_GPIO0->DIR &= ~(1<<7); // input
         pe5.input();
}
//void setPME6(unsigned char s){ PD.DDR.BIT.B6 = s; PMD.RM.B6=s;}
void setPME6(unsigned char s){
//    LPC_IOCON->PIO0_4 = 0xd0;
      pinIO[6]=s;
      if(s==1)
//      LPC_GPIO0->DIR |= (1<<4); // output
        pe6.output();
      else
//      LPC_GPIO0->DIR &= ~(1<<4); // input
        pe6.input();
}
//void setPME7(unsigned char s){ PD.DDR.BIT.B7 = s; PMD.RM.B7=s;}
void setPME7(unsigned char s){
//    LPC_IOCON->PIO0_3 = 0xd0;
      pinIO[7]=s;
      if(s==1)
//      LPC_GPIO0->DIR |= (1<<3); // output
        pe7.output();
      else
//      LPC_GPIO0->DIR &= ~(1<<3); // input
        pe7.input();
}
void setPME8(unsigned char s){
//    LPC_IOCON->PIO0_2 = 0xd0;
      pinIO[8]=s;
      if(s==1)
//      LPC_GPIO0->DIR |= (1<<2); // output
        pe8.output();
      else
//      LPC_GPIO0->DIR &= ~(1<<2); // input
        pe8.input();
}
void setPME9(unsigned char s){
//    LPC_IOCON->PIO1_0 = 0xd0;
      pinIO[9]=s;
      if(s==1)
//      LPC_GPIO1->DIR |= (1<<0); // output
         pe9.output();
      else
//      LPC_GPIO1->DIR &= ~(1<<0); // input
        pe9.input();
}
//void setPME2(unsigned char s){ PD.DDR.BIT.B2 = s; PMD.RM.B2=s;}
void setPMEA(unsigned char s){
//    LPC_IOCON->PIO1_1 = 0xd0;
      pinIO[10]=s;
      if(s==1)
//      LPC_GPIO1->DIR |= (1<<1); // output
        pea.output();
      else
//      LPC_GPIO1->DIR &= ~(1<<1); // input
        pea.input();
}
//void setPME3(unsigned char s){ PD.DDR.BIT.B3 = s; PMD.RM.B3=s;}
void setPMEB(unsigned char s){
//        LPC_IOCON->PIO1_2 = 0xd0;
      pinIO[11]=s;
      if(s==1)
//          LPC_GPIO1->DIR |= (1<<2); // output
          peb.output();
       else
//          LPC_GPIO1->DIR &= ~(1<<2); // input
         peb.input();
}
//void setPME4(unsigned char s){ PD.DDR.BIT.B4 = s; PMD.RM.B4=s;}
void setPMEC(unsigned char s){
//    LPC_IOCON->PIO1_4 = 0xd0;
      pinIO[12]=s;
      if(s==1)
//      LPC_GPIO1->DIR |= (1<<4); // output
        pec.output();
      else
//      LPC_GPIO1->DIR &= ~(1<<4); // input
        pec.input();
}
//void setPME5(unsigned char s){ PD.DDR.BIT.B5 = s; PMD.RM.B5=s;}
void setPMED(unsigned char s){
//    LPC_IOCON->PIO1_5 = 0xd0;
      pinIO[13]=s;
      if(s==1)
//      LPC_GPIO1->DIR |= (1<<5); // output
        ped.output();
      else
//      LPC_GPIO1->DIR &= ~(1<<5); // input
        ped.input();
}
//void setPME6(unsigned char s){ PD.DDR.BIT.B6 = s; PMD.RM.B6=s;}
void setPMEE(unsigned char s){
//    LPC_IOCON->PIO1_8 = 0xd0;
      pinIO[14]=s;
      if(s==1)
//      LPC_GPIO1->DIR |= (1<<8); // output
        pee.output();
      else
//      LPC_GPIO1->DIR &= ~(1<<8); // input
        pee.input();
}
//void setPME7(unsigned char s){ PD.DDR.BIT.B7 = s; PMD.RM.B7=s;}
void setPMEF(unsigned char s){
//    LPC_IOCON->PIO1_9 = 0xd0;
      pinIO[15]=s;
      if(s==1)
//      LPC_GPIO1->DIR |= (1<<9); // output
        pef.output();
      else
//      LPC_GPIO1->DIR &= ~(1<<9); // input
        pef.input();
}
 
unsigned char getPE0(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<8)] >> 8;
//  return rtn;
    return pe0;
}
unsigned char getPE1(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<9)] >> 9;
//  return rtn;
    return pe1;
}
unsigned char getPE2(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<11)] >> 11;
    return pe2;
}
unsigned char getPE3(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<5)] >> 5;
    return pe3;
}
unsigned char getPE4(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<6)] >> 6;
    return pe4;
}
unsigned char getPE5(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<7)] >> 7;
    return pe5;
}
unsigned char getPE6(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<4)] >> 4;
    return pe6;
}
unsigned char getPE7(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<3)] >> 3;
    return pe7;
}
unsigned char getPE8(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<5)] >> 5;
    return pe8;
}
unsigned char getPE9(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<0)] >> 0;
    return pe9;
}
unsigned char getPEA(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<1)] >> 1;
    return pea;
}
unsigned char getPEB(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<2)] >> 2;
    return peb;
}
unsigned char getPEC(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<4)] >> 4;
    return pec;
}
unsigned char getPED(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<5)] >> 5;
    return ped;
}
unsigned char getPEE(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<8)] >> 8;
    return pee;
}
unsigned char getPEF(void){
//  unsigned char rtn;
//  rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<9)] >> 9;
    return pef;
}
 
unsigned char getPME0(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO0->DIR;
//    rtn=(unsigned char) ((d & (1<<8))>>8);
    return pinIO[0];
}
unsigned char getPME1(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO0->DIR;
//    rtn=(unsigned char) ((d & (1<<9))>>9);
    return pinIO[1];
}
unsigned char getPME2(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO0->DIR;
//    rtn=(unsigned char) ((d & (1<<11))>>11);
    return pinIO[2];
}
unsigned char getPME3(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO0->DIR;
//    rtn=(unsigned char) ((d & (1<<5))>>5);
    return pinIO[3];
}
unsigned char getPME4(void){
//  unsigned char rtn;
 //   uint32_t d=LPC_GPIO0->DIR;
 //   rtn=(unsigned char) ((d & (1<<6))>>6);
    return pinIO[4];
}
unsigned char getPME5(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO0->DIR;
//    rtn=(unsigned char) ((d & (1<<7))>>7);
    return pinIO[5];
}
unsigned char getPME6(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO0->DIR;
//    rtn=(unsigned char) ((d & (1<<4))>>4);
    return pinIO[6];
}
unsigned char getPME7(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO0->DIR;
//    rtn=(unsigned char) ((d & (1<<3))>>3);
    return pinIO[7];
}
unsigned char getPME8(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO0->DIR;
//    rtn=(unsigned char) ((d & (1<<2))>>2);
    return pinIO[8];
}
unsigned char getPME9(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO1->DIR;
//    rtn=(unsigned char) ((d & (1<<0))>>0);
    return pinIO[9];
}
unsigned char getPMEA(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO1->DIR;
//    rtn=(unsigned char) ((d & (1<<1))>>1);
    return pinIO[10];
}
unsigned char getPMEB(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO1->DIR;
//    rtn=(unsigned char) ((d & (1<<2))>>2);
    return pinIO[11];
}
unsigned char getPMEC(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO1->DIR;
//    rtn=(unsigned char) ((d & (1<<4))>>4);
    return pinIO[12];
}
unsigned char getPMED(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO1->DIR;
//    rtn=(unsigned char) ((d & (1<<5))>>5);
    return pinIO[13];
}
unsigned char getPMEE(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO1->DIR;
//    rtn=(unsigned char) ((d & (1<<8))>>8);
    return pinIO[14];
}
unsigned char getPMEF(void){
//  unsigned char rtn;
//    uint32_t d=LPC_GPIO1->DIR;
//    rtn=(unsigned char) ((d & (1<<9))>>9);
    return pinIO[15];
}
 
void setPortFunctions(){
    /*
unsigned char (*getPEX[16])()={
    getPE0,  getPE1,  getPE2,  getPE3,
    getPE4,  getPE5,  getPE6,  getPE7,
    getPE8,  getPE9,  getPEA,  getPEB,
    getPEC,  getPED,  getPEE,  getPEF
};
*/
   getPEX[0]=getPE0;
   getPEX[1]=getPE1;
   getPEX[2]=getPE2;
   getPEX[3]=getPE3;
   getPEX[4]=getPE4;
   getPEX[5]=getPE5;
   getPEX[6]=getPE6;
   getPEX[7]=getPE7;
   getPEX[8]=getPE8;
   getPEX[9]=getPE9;
   getPEX[10]=getPEA;
   getPEX[11]=getPEB;
   getPEX[12]=getPEC;
   getPEX[13]=getPED;
   getPEX[14]=getPEE;
   getPEX[15]=getPEF;
 
   getPBX[0]=getPEA;
   getPBX[1]=getPEB;
   getPBX[2]=getPEC;
   getPBX[3]=getPED;
   getPBX[4]=getPEE;
   getPBX[5]=getPEF;
 
   setPEX[0]=setPE0;
   setPEX[1]=setPE1;
   setPEX[2]=setPE2;
   setPEX[3]=setPE3;
   setPEX[4]=setPE4;
   setPEX[5]=setPE5;
   setPEX[6]=setPE6;
   setPEX[7]=setPE7;
   setPEX[8]=setPE8;
   setPEX[9]=setPE9;
   setPEX[10]=setPEA;
   setPEX[11]=setPEB;
   setPEX[12]=setPEC;
   setPEX[13]=setPED;
   setPEX[14]=setPEE;
   setPEX[15]=setPEF;
 
   setPBX[0]=setPEA;
   setPBX[1]=setPEB;
   setPBX[2]=setPEC;
   setPBX[3]=setPED;
   setPBX[4]=setPEE;
   setPBX[5]=setPEF;
 
   getPMEX[0]=getPME0;
   getPMEX[1]=getPME1;
   getPMEX[2]=getPME2;
   getPMEX[3]=getPME3;
   getPMEX[4]=getPME4;
   getPMEX[5]=getPME5;
   getPMEX[6]=getPME6;
   getPMEX[7]=getPME7;
   getPMEX[8]=getPME8;
   getPMEX[9]=getPME9;
   getPMEX[10]=getPMEA;
   getPMEX[11]=getPMEB;
   getPMEX[12]=getPMEC;
   getPMEX[13]=getPMED;
   getPMEX[14]=getPMEE;
   getPMEX[15]=getPMEF;
 
   getPMBX[0]=getPMEA;
   getPMBX[1]=getPMEB;
   getPMBX[2]=getPMEC;
   getPMBX[3]=getPMED;
   getPMBX[4]=getPMEE;
   getPMBX[5]=getPMEF;
 
   setPMEX[0]=setPME0;
   setPMEX[1]=setPME1;
   setPMEX[2]=setPME2;
   setPMEX[3]=setPME3;
   setPMEX[4]=setPME4;
   setPMEX[5]=setPME5;
   setPMEX[6]=setPME6;
   setPMEX[7]=setPME7;
   setPMEX[8]=setPME8;
   setPMEX[9]=setPME9;
 
   setPMEX[10]=setPMEA;
   setPMEX[11]=setPMEB;
   setPMEX[12]=setPMEC;
   setPMEX[13]=setPMED;
   setPMEX[14]=setPMEE;
   setPMEX[15]=setPMEF;
 
   setPMBX[0]=setPMEA;
   setPMBX[1]=setPMEB;
   setPMBX[2]=setPMEC;
   setPMBX[3]=setPMED;
   setPMBX[4]=setPMEE;
   setPMBX[5]=setPMEF;
 
}
 

Counter: 9, today: 1, yesterday: 0

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2021-12-05 (日) 16:27:00 (173d)