Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pinguio MICRO digitalWrite: which pins?
13-02-2013, 08:14 PM,
#1
Pinguio MICRO digitalWrite: which pins?
How can I know which pins on Pinguino PIC32 micro can be used as digital I/O?

This is the content of digitalw.c:

Code:
#ifdef PIC32_PINGUINO_MICRO

const u32 portmask[]= {     pB,  pB,  pB,  pB,  pB,  pB,  pB,  pB,    // 0-7
                           pB,  pB,  pD,  pD,  pD,  pD,  pD,  pD,    // 8-15
                           pB,  pD,  pD,  pD,  pG,  pF,  pE,  pE,    // 16-23
                           pE,  pE,  pE,  pE,  pE,  pE,  pC,  pC,    // 24-31
                           pG,  pF,  pF,  pD,  pD,  pG,  pG,  pF, // 32-39
                           pB,  pD };                                // 40-41  P41 strapped with P13

const u32 pinmask[]=  {  _1,  _2,  _3,  _4,  _8,  _9, _10, _11,    // 0-7
                          _12, _14,  _1,  _2,  _3,  _4,  _5,  _6,    // 8-15
                           _0,  _7,  _8, _11,  _9,  _1,  _7,  _6,    // 16-23
                           _5,  _4,  _3,  _2,  _1,  _0, _13, _14,    // 24-31
                           _6,  _4,  _5,  _9, _10,  _8,  _7,  _0, // 32-39
                          _13,  _0 };                                // 40-41  P41 strapped with P13
#endif

But... what does it mean?!? Why are numbers repeated?!? Huh
Reply
14-02-2013, 12:24 PM,
#2
RE: Pinguio MICRO digitalWrite: which pins?
pA = Port A, pB = Port B, ....
_0 = bit 0, _1 = bit 1, ...

portmask[0]= pB;
pinmask[0]= _1;
Pinguino pin 0 = { pB, _1 } = RB1

portmask[32]= pG;
pinmask[32]= _6;
Pinguino pin 32 = { pG, _6 } = RG6
...

So, for ex. :
digitalWrite( 0, 0) <=> LATBbits.LATB1 = 0
digitalWrite(32, 0) <=> LATGbits.LATG6 = 0
...

(13-02-2013, 08:14 PM)jumpjack Wrote: How can I know which pins on Pinguino PIC32 micro can be used as digital I/O?

This is the content of digitalw.c:

Code:
#ifdef PIC32_PINGUINO_MICRO

const u32 portmask[]= {     pB,  pB,  pB,  pB,  pB,  pB,  pB,  pB,    // 0-7
                           pB,  pB,  pD,  pD,  pD,  pD,  pD,  pD,    // 8-15
                           pB,  pD,  pD,  pD,  pG,  pF,  pE,  pE,    // 16-23
                           pE,  pE,  pE,  pE,  pE,  pE,  pC,  pC,    // 24-31
                           pG,  pF,  pF,  pD,  pD,  pG,  pG,  pF, // 32-39
                           pB,  pD };                                // 40-41  P41 strapped with P13

const u32 pinmask[]=  {  _1,  _2,  _3,  _4,  _8,  _9, _10, _11,    // 0-7
                          _12, _14,  _1,  _2,  _3,  _4,  _5,  _6,    // 8-15
                           _0,  _7,  _8, _11,  _9,  _1,  _7,  _6,    // 16-23
                           _5,  _4,  _3,  _2,  _1,  _0, _13, _14,    // 24-31
                           _6,  _4,  _5,  _9, _10,  _8,  _7,  _0, // 32-39
                          _13,  _0 };                                // 40-41  P41 strapped with P13
#endif

But... what does it mean?!? Why are numbers repeated?!? Huh
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
14-02-2013, 01:44 PM, (This post was last modified: 14-02-2013, 01:46 PM by jumpjack.)
#3
RE: Pinguio MICRO digitalWrite: which pins?
Thanks a lot.
So the mapping should be (as at your own risk...):

Code:
IDE    PIC    Board    Detail
0    RB1    CON2-16    analog 1
1    RB2    CON2-15    analog 2
2    RB3    CON2-14    analog 3
3    RB4    CON2-13    analog 4
4    RB8    CON2-12    analog 8
5    RB9    CON2-11    analog 9
6    RB10    CON2-10    analog 10
7    RB11    CON2-9    analog 11
8    RB12    CON2-8    analog 12
9    RB14    CON2-7    analog 14
10    RD1    CON2-6    pwm
11    RD2    CON2-5    pwm
12    RD3    CON2-4    pwm
13    RD4    CON2-3    pwm
14    RD5    CON2-2    
15    RD6    CON2-1    
16    RB0    CON1-16    analog 0
17    RD7    CON1-15    
18    RD8    CON1-14    
19    RD11    CON1-13    
20    RG9    CON1-12    
21    RF1    CON1-11    
22    RE7    CON1-10    
23    RE6    CON1-9    
24    RE5    CON1-8    
25    RE4    CON1-7    
26    RE3    CON1-6    
27    RE2    CON1-5    
28    RE1    CON1-4    
29    RE0    CON1-3    
30    RC13    CON1-2    
31    RC14    CON1-1    
32    RG6    UEXT-9    
33    RF4    UEXT-4    
34    RF5    UEXT-3    
35    RD9    UEXT-6    
36    RD10    UEXT-5    
37    RG8    UEXT-8    
38    RG7    UEXT-7    
39    RF0    UEXT-10    
40    RB13    ?    
41    RD0    button?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)