Jump to content
43oh

shaharl2

Members
  • Content Count

    2
  • Joined

  • Last visited

Reputation Activity

  1. Like
    shaharl2 reacted to jpnorair in reading two push buttons simultaneously with interrupts   
    If I were trying to simulate synchronous logic... I would simulate synchronous logic.
    Implement a timer interrupt that occurs every 50-100ms or so. Experiment, and find a good value that is compatible with the rate at which you push the buttons. This becomes your clock period, effectively. Sample the pin values of the pins each odd clock. Latch these values on each even clock.
  2. Like
    shaharl2 reacted to roadrunner84 in reading two push buttons simultaneously with interrupts   
    In reality, you never start to press both switches at the exact same moment. So you should not read the PxIFG, but the PxIN during your interrupt. You'll still need to clear flags as required, but you need to check for the pin levels, not the signal edges, since that is also the behaviour of your logic gate.
×
×
  • Create New...