Go Down

Topic: Need to program ATmega for duplicate outputs on 2 different pins (Read 491 times) previous topic - next topic

snobound

Sorry about the confusion - mistake in my response to you earlier...  I am doing analogWrite.
This portion of my program is for dimming an LED.  I now have the same(equivalent) PWM signal on both pins so I can connect my LED driver circuit to either one with the same result.

retrolefty


Sorry about the confusion - mistake in my response to you earlier...  I am doing analogWrite.
This portion of my program is for dimming an LED.  I now have the same(equivalent) PWM signal on both pins so I can connect my LED driver circuit to either one with the same result.


But again, why must only one sketch program work for both chips? You can't upload a single sketch into both chips at the same time, so why not have two sketches that operate only the pins that chip is using? This is really a paint-yourself-into-a-corner approach to programming AVR chips.

Lefty

snobound

I have built 2 boards (old version and new and improved version) that are very similar except for this pinout.  I want to have only one version of the programmed chip (backwards compatible) in inventory that will work with whichever board I need to use it on.

Arrch

This might make it a bit simpler.

Code: [Select]
#define bothPinMode(x) pinMode(ledPin1, x); pinMode(ledPin2, x)
#define bothAnalogWrite(x) analogWrite(ledPin1, x); analogWrite(ledPin2, x)


You could (slightly) simplify your code to

Code: [Select]
void setup()
{
 bothPinMode(OUTPUT);
 bothAnalogWrite(red);
}

dc42


Since I am fabricating the boards and am limited in resources a double sided board is not a choice, else I would just run an extra trace underneath the chip.


I used to fabricate my own single-sided and occasionally double-side boards. But double-sided boards fabricated in China are so inexpensive (even for small quantities) that it's no longer worthwhile.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up