Atmega 2560 pd6 control possible?

I have a custom made PCB, which is designed to be able to shut itself down.
This is done via a FET thats temporarily powered by a momentary push button, then the code activates a GPIO to power the FET, user can release the button, Arduino stays powered.

Thats the plan, however, the pin chosen to activate the FET turns out the be pd6 on the 2560, and not mapped in the arduino core as a GPIO.

Can I control it in some other way? some direct control over the pin? Will this cause me any other issues? I see it labelled as T1. Timer 1? is there a chance that I will mess up some other functionality if using it as a GPIO ?

Thanks in advance for any help

You can use direct port manipulation to control the pin.

I'm not the specialist regarding hardware timers but below is my view regarding T1. T1 is the external clock source for time/counter 1; see the datasheet. Timer/counter 1 is configured by the Arduino core and does not use the external clock source (unless your code has modified it).

from what ive seen by googling it, timer 1 is used in the servo.h library. and for pwm on D9 and D10.
There may be other libraries that I havent discovered that use it, and I will need to have a constant HIGH signal to keep the PCB running.

I guess you missed what I tried to say. T1 is the external clock source for time/counter1 and is not used. Timer/counter1 is used, but with an internal clock source.

Ah, I had not understood that correctly,

So in reality I can use the pin without affecting timer 1 as long as timer 1 is using the internal clock source? That is good to know, thanks

From the datasheet

The below program will show you the configuration for timer/counter1

void setup()
{
  Serial.begin(115200);
#if defined TCCR1B
  Serial.println("TCCR1B exists");
  if (TCCR1B < 0x10)
    Serial.print("0");
  Serial.println(TCCR1B, HEX);
  Serial.println("Clock select bits (CS12..10)");
  Serial.print((TCCR1B & 0x04) == 0x04);
  Serial.print((TCCR1B & 0x02) == 0x02);
  Serial.println((TCCR1B & 0x01) == 0x01);
#else
  Serial.println("TCCR1B does not exist");
#endif
}

void loop()
{
  // put your main code here, to run repeatedly:
}

It will show the clock select bits as set by the Arduino core; match it with the table in the second screenshot above.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.