News:

;) This forum is the property of Proton software developers

Main Menu

Interrupts

Started by Fanie, Sep 21, 2025, 09:59 AM

Previous topic - Next topic

Fanie

What did you do Pepe ?

I'm getting an output as well now.

Pepe

ANSEL = $80

INTCON.6 = 1     ' 1 = Enable all high priority interrupts


IPR1.0 = 1      ' TMR1 Overflow Interrupt Priority 1 = High         TMR1IP

Cntin = 63

   
erase    Retfie

       '  DelayMS 300


Fanie

Can we add timer0 as well  :o

Pepe

timer0 added

Fanie

#64
Thank you Pepe !!!!!!!!!!

By changing the prescale values, I finally got the output to follow the input.

Sorry, I could not be here yesterday, too many other things.  As we say in the Boer language, "die ark was oop" translating to the ark was open, implying everybody came here.  With so many old people coming here (brother, nephew, friends, customers) I complained it looks like an old age home.

Tomorrow is my mother's 188th birthday and the girls made arrangements.
This means I'm losing two days this week  :'(
And as you know at our age two days is a LOT  ;D

The up side is I got to ride the scooter because the wife wanted takeaways...
https://www.youtube.com/watch?v=PVVyYpUQXeo
What Riding a Motorcycle Actually Does to Your Brain

Fanie

#65
Some feedback.

The interrupts probably worked from my previous setups as well, however, the first problem is that the 16 bit values overflowed many times creating the impression of instability.

By setting upper an lower limits to the variables helped that a lot.
Having a way to see the values is invaluable, in my case I have an 8 digit display indicating values.  I cannot afford the Proteus simulation software so thank you very much Pepe for helping there.

And win11 just disabled my keyboard AGAIN.  :'( Will update when it works again.  Win 10 is already advertised obsolete before win11's problems are sorted out.

To slow the output pulse enough I had to toggle the output every 5th interrupt

If PIR1.0 = 1 Then            ' identify the int source
                      '  BcD = cntout   ' Display Timer1 input value
        Timer1 = Cntout             ' Load the interrupt value
        If AbC = 5 Then               ' every 5th overflow
            Toggle Fout               ' toggle output pin
            AbC = 0
            Else
            Inc AbC
        EndIf
        PIR1.0 = 0                 ' restart TMR1 int
EndIf

As I mentioned, this was my first time using interrupts.
I was able to use the interrupts to do the work while the main loop at it's leisure do the A/d and display register values.

Frustrations are the timers interrupt only on overflow and one timer can compare only 8 bit values.
hence to overflow at a value you have to variable =  65536 - variable.
Used only 1388 bytes out of 16k.  All that residual silicone wasted.  It's like when the sun shine and the solar panels filled the batteries and all that available energy goes to waste.

I consider this attempt successful.  From now on I'm going to interrupt the living daylights out of the pics.  ;D

Thank you all who tried to help and your patience.

@ Les.  I never for one second though there is a problem with the Positron.  I know you test everything and if there is a limitation it is not on your side.  Positron is awesome.


trastikata

Heh, if you go back to my posts you will find that I warned exactly the same on several occasions.

In your Timer counter interrupt ISRs place a byte that you increment at each overflow and zero-it when you read that byte, so you'd know how the exact value of the timer counter.

Fanie

Quote from: trastikata on Sep 28, 2025, 07:54 AM... on several occasions.

I only realized it was overflowing after Pepe's example.  Before it looked like some random value.

QuoteThank you all who tried to help and your patience.