Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wrong pinmask for d8 ? [pic32 pinguino (otg)] [solved - not a pinguino problem]
17-03-2013, 10:18 PM, (This post was last modified: 18-03-2013, 12:22 PM by nessnuo.)
#1
Wrong pinmask for d8 ? [pic32 pinguino (otg)] [solved - not a pinguino problem]
Hello,
I was trying to blink a led using C (without using the IDE), so I look in PIC32-Pinguino-OTG-Xref-Table.pdf to see how pin D8 is mapped on the board.

DigitalMask column, said me that the pinmask value is 0x2000. (in PORTG)
So i write this code
TRISGCLR = 0x2000; // D8 as output
PORTGSET = 0x2000; // D8 HIGH
...
But it doesn't work.
So, i decided to connect the LED to D13 (pinmask 0x30, portg)
So i edited the code as follow:
TRISGCLR = 0x40;
PORTGSET = 0x40;

And the led is turned on.

So, i believe that there's a mistake in the reference.
Reply
17-03-2013, 10:49 PM,
#2
RE: Wrong pinmask for d8 ? [pic32 pinguino (otg)]
Why did you think D8 is a LED?

John
Reply
17-03-2013, 10:55 PM,
#3
RE: Wrong pinmask for d8 ? [pic32 pinguino (otg)]
I wired a led to D8.
After i wired the same led to D13
Reply
18-03-2013, 12:09 AM, (This post was last modified: 18-03-2013, 12:21 AM by pingotg.)
#4
RE: Wrong pinmask for d8 ? [pic32 pinguino (otg)]
But why did you ever think D8 would be a LED? The Xref shows D13 is the (green aka user) LED.

D8 has another use. Since you didn't use it as intended and especially as you used your own TRISG... odd things probably happen. D8 is on port B (pin RB13), not port G. You'll really confuse an SD card if you have one, too!

Just wondering, but why not use code like:
pinMode(D8, OUTPUT);
and
digitalWrite(D8, HIGH);

(if you really want to use D8)

John
Reply
18-03-2013, 12:22 PM,
#5
RE: Wrong pinmask for d8 ? [pic32 pinguino (otg)]
I don't want to use code like your, because for studying purpose I'm working in C, without the arduino like sytnax.
Anyway, you solved my problem. I was tired and I don't know why every time I read the documentation I read PORTG insted of PORTD, lol.

Thank you!
Reply
18-03-2013, 12:43 PM,
#6
RE: Wrong pinmask for d8 ? [pic32 pinguino (otg)] [solved - not a pinguino problem]
No worries! Live and learn Smile

John
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)