Simulator switches not recognised by code

Status
Not open for further replies.

Superdat

Member
I'm having problems with an ATMega48/328P program.
Inputs to switch pins are via a push button switch connected to ground with a 10k resistor to 5v
So no switch = 5v , Switch = Gnd = 0v
I normally use 5v switching i.e. pin = 0 until switch press then = 5v, but this application needs earth switching.
The processor pins do not seem to do anything even though the state changes when the switch is pressed (logic probe check).

I've tried the AVR Simulator, but the code does not respond to toggling a pin on Micro View.
If I assign an Led to the same pin it comes on when toggled.
So the simulator just goes though all the gosubs to the bottom of the code. Is this correct?
If yes is there any way to have "real" switches in the simulator?

This ia also what seems to be happening for real.
The method I'm using is:
If portC.3 = 0 the gosub XXX which ought to work OK

I've found Eric's modules, I'll see if I can get them to work.....Nope, what am I suposed to do with them?

I vaguely remember asking a question like this before. The modules don't work with AVR Sim.
The Mega328P had failed so I'm back in action with another.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…