Help needed

Arduino projects on the go
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Help needed

Post by Martin »

Thanks Mike.

I normally bypass the Arduino firmware and use the timer/counter hardware and interrupts natively in my projects - so I'd not realized that.

The Arduino platform is a great thing, but it tends to get in the way when you want really accurate timing. You can still use the IDE of course - it's just a matter of a few lines of code to shut down the Arduino platform timers, and then reconfigure them to do exactly what's needed for your project.

I wrote a context switcher for the ATmega2560 yesterday in assembler. I needed it for my Space Invaders project where I'm copying the original 1978 TAITO ROM 8080 code layout. There are two different interrupt tasks both driven at 60Hz when the CRT beam reaches different points on the video screen. When the player loses a life in one of the interrupts, the 8080 code resets its stack pointer, and jumps out of the interrupt routine back to a point in the main, non-interrupt loop. That was impossible for me to code in standard Arduino C++, but with a bit of assembler (which the Arduino platform fully supports) I've now got it working. :ugeek:
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Re: Help needed

Post by MaxZ »

Hi Guys,

First the good news, removing the noInterrupt() indeed solved my problem about delay() not working.

However, tot test the theory I left it in place initially, and changed the delay() statements in the setup section into delayMicroseconds() (with the argument multiplied by 1000 of course), but it still did not work! But the ppm generation part, using the same delayMicroseconds(), was functional all the time. Could it be that the noInterrupt is not propagated to the main loop?

Anyway, my immediate problem is solved, thanks.

Cheers,
Max.
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: Help needed

Post by bluejets »

Nothing happens during "delay".
Post Reply