1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Simulator switches not recognised by code

Discussion in 'Oshonsoft' started by Superdat, Feb 18, 2018.

  1. Superdat

    Superdat Member

    Joined:
    Mar 3, 2015
    Messages:
    128
    Likes:
    5
    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: Feb 20, 2018

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice