Hello there, wondering if this is a fake issue?
I have all real arduinos, mostly UNOs and mega2560s. I saw a deal on eBay a couple years ago so I bought some UNOs not realizing they were counterfeit/fake until they arrived. I set them aside.
I have a project that drives a couple of HP attenuators and I guess I blew the real UNO I was using as the chip is hot and one of the ports is high all the time no matter what. I am switching 15v using a transistor on the low side, must have done something wrong, etc.
So I tried the fake and it almost works. I am using PORTB as I need to set and reset the attenuator modules at the same time in order to have a smooth transfer curve.
if for instance, I do this:
// section a on is pin D8, off pin D9
// section b on is pin D10, off pin D11
// section c on is pin D12, off pin D13
// remember PORTB starts at D8 so low bit is D8
PORTB=B011010; // turn off section a&b, turn on section c
delay(100); // wait for relays to transfer
PORTB=0X00; // All relays off
PORTB controls digital pins 8-13. The attenuators I use have a transfer relay that sets three sections, call them a,b,c. So writing B000001 to PORTB sets section a; B000010 resets section a. I want to use port manipulation so that I can pick the set and reset relays at the same time.
it only works once per reset. I can switch any other pins on or off but that specific pin that controls turning on section C (D12) won't work until I reset the board. Even if I write a bunch of 0x00's to PortB or try to reset the DDRB or read PINB, nothing works. Once I write D12 it seems like PORTB is in a hung state, but just that bit. Low thankfully, not stuck high. So it works once and that's it. It is the strangest problems I've ever seen.
I tried everything and have the problem isolated to the port manipulation. Even if I then try to digitalWrite D12, it is hung at low/0. The weird thing is that I had this working last night, turned off the POS fake/clone whatever, and then started having the problem today.
I'm trying to wrap this up this weekend so any ideas short of throwing away the POS would be appreciated.
Jerry