Go Down

Topic: Multiple Hardware Interrupts for Arduino UNO (Read 587 times) previous topic - next topic

larryd

Using PORTD and PORTB instead of PIND and PINB is definitely:   X  versus  Y 
No technical PMs.
The last thing you did is where you should start looking.

blackphoenixpt

#16
Feb 10, 2019, 11:06 pm Last Edit: Feb 10, 2019, 11:33 pm by blackphoenixpt
Hi.
I used LarryD code and done some alterations to the switch so he can behave as LOW when pushed and NOTHING! The code doesn't work. Can anyone try the code in a real Arduino because with Proteus 7.9 I'm getting nowhere. Thank you for the support so far ;)

larryd

#17
Feb 11, 2019, 01:00 am Last Edit: Feb 11, 2019, 01:07 am by larryd
I just tried the code I offered.

This was put on an UNO.

The messages monitored with IDE serial monitor, works 100%.




It must be your simulator.  :(

Edit     BTW:
- In your sketch, you are using PORTD and PORTB when you should have used PIND and PINB
- Also you had no Serial.begin(9600); in your setup.
- Your if (time==millis()) digitalWrite(LEDOnOff, LOW); as wrong and so is the subsequent
   if (time>=millis()) digitalWrite(LEDOnOff, LOW);



No technical PMs.
The last thing you did is where you should start looking.

blackphoenixpt

Hi.
Thanks LarryD. So, it seems that the Proteus 7 simulator is not working properly with this piece of code (maybe my code was +-good also). At least we reach somewhere. Thank for your help ALL of you and a special thank to LarryD. I consider this post closed :)

wvmarle

Personally, I don't trust simulators, especially going as far as simulating the operation of a microcontroller.
Those things are so intricate, with so many options, that it's hard to completely simulate them. You also don't get to see real life effects such as bouncing contacts and various analog effects that mess up your digital signals.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

DrDiettrich

Emulation of a ┬ÁC is not really hard, everything happens synchronized by the (virtual) clock. The amount of gates and specialized registers is high, so that a perfect emulation will take much time even on a multicore PC.

True real time behaviour emulation is not possible. All external input signals have to be recorded or synthesized, so that they can be played back at the virtual clock speed. The same for eventual external circuitry, it's unlikely that a connected capacitive sensor can be emulated properly.

blackphoenixpt

#21
Feb 11, 2019, 12:51 pm Last Edit: Feb 11, 2019, 03:07 pm by blackphoenixpt
Hi.
Ok, emulation has his QUARKS but you can do a lot with the emulator (Proteus in this case). I just thought I can do just a little more. lol. Looks like the "little" was a "too much". Anyway, I keep in the back of my head (and in a .ino) the codes discussed here for "future" work. I was thinking (and that's when the "CAN I?" come into the picture) that I could buy a broken pinball machine and do the Board Job with an Arduino. And it make me think of interrupts inputs coming from the pinball to do stuff like flippers, lights, targets... I was dreaming lol. I saw a guy
 (TheFrogger1108 https://www.youtube.com/watch?v=rcyX2ZH9qcU) doing just that and had a look at his code. I thought that maybe I can do something like that BUT (as always) in my own way. Anyway... I thank you all for the help :)

AWOL

Hi.
Ok, emulation has his QUARKS
We all have quarks, surely? - they're part of the Standard Model.
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Go Up