Author Topic: Interrupt question  (Read 1728 times)

0 Members and 1 Guest are viewing this topic.

E37

• Posts: 265
• Rating: +17/-0
• Trial and error is the best teacher
Interrupt question
« on: April 05, 2018, 11:36:27 am »
Quick question: Is there anyway to set an interrupt to trigger in X clock ticks? I was looking at some code and think I found a way to shave ~600-1800 clock ticks off of fastCopy (the lcd routine) if there is.
I'm still around... kind of.

Geekboy1011

• The Oneironaut
• Donator
• LV11 Super Veteran (Next: 3000)
• Posts: 2028
• Rating: +119/-2
• Dream that Awakening dream
Re: Interrupt question
« Reply #1 on: April 05, 2018, 05:38:48 pm »
Depends on the model! On the models with crystal timers yes, On the models with out sadly no.

E37

• Posts: 265
• Rating: +17/-0
• Trial and error is the best teacher
Re: Interrupt question
« Reply #2 on: April 06, 2018, 03:37:41 pm »
Depends on the model! On the models with crystal timers yes, On the models with out sadly no.
My knowledge is somewhat... lacking... in crystal timers. Can it be accomplished in > ~20 clock cycles?
In generalized pseudocode is to:
Code: [Select]
Interrupt:exx64 loop for yld i,(breakSave) // change the interrupt location (I know you can't just set I)12 loop for xset interrupt to trigger in ~25 clock ticks (15 for next 2 instructions and 10 for after)exxret//go and execute 1 or 2 instructions while we wait for the lcd to be readybreakSave: //when the interrupt triggers it will jump to right hereexxout (\$10),a // write to the lcdendXLoop:endyLoop:ld i,(Interrupt) // restore the interrupt locationexxretI'm not sure if all the code is correctly formatted. Ignore any incorrect syntax. I'm sure you get the idea of what my goal is. I want to spend time executing useful code while I wait for the lcd to be ready for another write. It only works if the function is in an interrupt of course. I don't think that it will help with greyscale display since they have less waisted time waiting for the lcd to be ready. I can't create the method since I don't know how to use crystal timers. Some code showing me how to use them would be nice.
I'm still around... kind of.

Xeda112358

• they/them
• Moderator
• LV12 Extreme Poster (Next: 5000)
• Posts: 4579
• Rating: +716/-6
• Calc-u-lator, do doo doo do do do.
Re: Interrupt question
« Reply #3 on: April 06, 2018, 04:03:39 pm »
I don't know crystals timers well, sorry. I do however remember a comment from about six years ago by thepenguin77, I think, involving this same premise. I couldn't find the post though

Hooloovoo

• Posts: 225
• Rating: +22/-0
Re: Interrupt question
« Reply #4 on: April 07, 2018, 12:02:36 am »
I believe there is a way to set an interrupt on a certain number of cpu cycles having elapsed. I haven't ever used it, though.
http://wikiti.brandonw.net/index.php?title=83Plus:Ports:30
From what I understand about the timers, you could set the counter to 15, and the on/off port to 0x80 to get interrupts every 15 ticks.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale." -tr1p1ea
Spoiler For some of the calcs I own:

(actually I have quite a few more than this, but I don't feel like making bars for them all.)

Geekboy1011

• The Oneironaut
• Donator
• LV11 Super Veteran (Next: 3000)
• Posts: 2028
• Rating: +119/-2
• Dream that Awakening dream
Re: Interrupt question
« Reply #5 on: April 10, 2018, 07:50:36 pm »
What @Hooloovoo linked is what you would want to use @E37 That page explains it all

E37

• Posts: 265
• Rating: +17/-0
• Trial and error is the best teacher
Re: Interrupt question
« Reply #6 on: April 11, 2018, 07:34:28 pm »
I believe there is a way to set an interrupt on a certain number of cpu cycles having elapsed. I haven't ever used it, though.
http://wikiti.brandonw.net/index.php?title=83Plus:Ports:30
From what I understand about the timers, you could set the counter to 15, and the on/off port to 0x80 to get interrupts every 15 ticks.

That does help. However, it is too niche a solution to make the effort worthwhile. I would only be able to have a 2% speed gain in a ti84 that used an interrupt to display a non-greyscale image. That isn't really a common case, and isn't really worth the effort. It was a fun thought experiment though.
I'm still around... kind of.