Pages: [1]   Go Down
Author Topic: Arduino Micro PORTD problem  (Read 549 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a Micro that seems to work ok, that is until I tried using port instructions.

I set D0-D7 to OUTPUT.
My D5 pin doesn't respond when written to with  PORTD = B11111111;
I back-tracked and digitalWrite(5,255)    works just fine.
Is there a problem in firmware?
Did I get a Dud from Radio-Shack?
Al
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

On your arduino Micro board the chip ( 32U4 ) the arduino pin 5 maps from port C bit 6, not the D port. At least that is what the schematic drawing shows.

Edit: corrected link
http://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf

Lefty
« Last Edit: January 27, 2013, 11:21:31 pm by retrolefty » Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Lefty, I think you pasted the wrong link.


Did I get a Dud from Radio-Shack?
Since digitalWrite() eventually uses the same registers you are trying to use to "write" to the ports, I don't see how it could be a "dud".

Of course as Lefty points out, digital pin 5 isn't on PORTD.  It's on PORTC.

Is there a problem in firmware?
What firmware?
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This appears even more useful:

http://arduino.cc/en/Hacking/PinMapping32u4

Lefty
Logged

Pages: [1]   Go Up
Jump to: