Pages: [1]   Go Down
Author Topic: Can I set digitalWrite other than analog and digital pins?  (Read 337 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to set the pinMode to a specific pin like in the pin 29 of atmega32. Can I do that?
« Last Edit: March 04, 2013, 06:49:33 pm by jepoy12 » Logged

0
Offline Offline
Shannon Member
****
Karma: 199
Posts: 11639
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ATmega32 ??   Do you mean ATmega328 or ATmega32U4 ?

Basically pinMode works with pins that are defined via the pins_arduino.h file for the relevant variant.
Logged

[ I won't respond to messages, use the forum please ]

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 596
Posts: 33288
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't understand what you are asking.
But the pin mode can be set as an input r output for any pin on the arduino
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry Im not good at explaining. its Atmega328
heres what Im planing.

Code:
int reset= 29;                 // pin no. of atmega328 which is the reset

void setup()
{
  pinMode(reset, OUTPUT);      // set reset as output
}


  digitalWrite(reset, low);   // use it when I want to reset the atmega328


I think digitalWrite is for analog and digital only.
« Last Edit: March 04, 2013, 06:48:46 pm by jepoy12 » Logged

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

Sorry Im not good at explaining. its Atmega328
heres what Im planing.

Code:
int reset= 29;                 // pin no. of atmega328 which is the reset

void setup()
{
  pinMode(reset, OUTPUT);      // set reset as output
}


  digitalWrite(reset, low);   // use it when I want to reset the atmega328


I think digitalWrite is for analog and digital only.

You can't do what you are trying to do. The reset pin on a 328P can be set with fuse settings to be either the hardware reset signal for the chip or a general purpose I/O pin, it can't be used for both purposes. If fuses are set to use the reset pin as an I/O you lose the ability to program the chip via bootloader or ISP method so that pin is always used as a hardware reset pin only for any arduino IDE compatible board, and you have no program control over it.

If you want to be able to reset the chip while it's running your sketch, read up on using the watch dog time (WDT), it's easy to do and is the only correct method to perform a chip reset without using external components.

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you sir.
Logged

Pages: [1]   Go Up
Jump to: