interrupt management

If doesn't fit into any other category ....
User avatar
PeterN
Posts: 97
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 41 times
Been thanked: 45 times
Contact:

Re: interrupt management

Post by PeterN »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jul 20, 2021 1:09 pm
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jul 20, 2021 6:08 am ... and take a look at the "Projects" thread in this forum. There you will find very good examples from which you can learn.

This example may correspond to your display setting:
[Local Link Removed for Guests]

And this example could give some hints to display and log the status and runtime of two pumps on a regular basis
[Local Link Removed for Guests]
thank you. I will dive in this to understand. if I manage the file writing without interrupt,
my only issue is to move the logo on the screen to avoid burning it, and to detect a pin state change at any time, even if the programm is halted waiting for the next logo move.


If you use the timer this will call your routine(s) regularly. Interrupts will work fine.
User avatar
PeterN
Posts: 97
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 41 times
Been thanked: 45 times
Contact:

Re: interrupt management

Post by PeterN »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jul 20, 2021 1:15 pm VERY CLEAR ! thank you.
and not too much dangerous? SD card are not so reliable...
I tried this with an ESP32CAM, and did frequently write fotos to the SD. No problem until now
its1000
Posts: 55
Joined: Thu May 20, 2021 6:57 pm
Has thanked: 1 time
Been thanked: 1 time

Re: interrupt management

Post by its1000 »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jul 20, 2021 1:17 pm
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jul 20, 2021 1:09 pm
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jul 20, 2021 6:08 am ... and take a look at the "Projects" thread in this forum. There you will find very good examples from which you can learn.

This example may correspond to your display setting:
[Local Link Removed for Guests]

And this example could give some hints to display and log the status and runtime of two pumps on a regular basis
[Local Link Removed for Guests]
thank you. I will dive in this to understand. if I manage the file writing without interrupt,
my only issue is to move the logo on the screen to avoid burning it, and to detect a pin state change at any time, even if the programm is halted waiting for the next logo move.


If you use the timer this will call your routine(s) regularly. Interrupts will work fine.
the timer function does not put the program in "handle" mode? i mean if i program a timer1 asking to move the logo each 15 mn for example and another timer of 300ms putting an if test on the button press detection on a pin they will run both at the same time ?
User avatar
PeterN
Posts: 97
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 41 times
Been thanked: 45 times
Contact:

Re: interrupt management

Post by PeterN »

I am not the expert in this field, sorry, but ....
ANNEX can be event driven - there is not just a simple linear script execution.

The timers and event handling are worth a look in the online help.

A timer regularly interrupts the linear script execution - if the program is not waiting at the WAIT statement anyway. The two timers run independently of each other. Timer0 runs with higher priority than Timer1.
Do not set the timers too quickly, but give the timer subroutine enough time to do its job completely.

The interrupts ( pin, html-event ...) in fact interrupt a running program (without a blocking command), make the sub and return back to the next program line to continue.

It is worth reading (not only :-) the first pages of the online help, because there is good information about the inner concept.
For example, take a look at: [Local Link Removed for Guests]
its1000
Posts: 55
Joined: Thu May 20, 2021 6:57 pm
Has thanked: 1 time
Been thanked: 1 time

Re: interrupt management

Post by its1000 »

haaa. you light my search... i thought the interrupt command must be followed by a wait in the structure, and that the wait halted the programm.
it seems that I can use an interrupt without putting a wait command
User avatar
PeterN
Posts: 97
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 41 times
Been thanked: 45 times
Contact:

Re: interrupt management

Post by PeterN »

Now, if you have a program code that is in an infinite loop - that's right, since your code does not contain an END statement or a "last line of code"

But it might be better to make some settings, initialize the interrupts, set one or two timers and end the main program code with a WAIT.

Have a look at the sample programs under "Projects" - There are many different ways to Rome
its1000
Posts: 55
Joined: Thu May 20, 2021 6:57 pm
Has thanked: 1 time
Been thanked: 1 time

Re: interrupt management

Post by its1000 »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Wed Jul 21, 2021 8:09 am Now, if you have a program code that is in an infinite loop - that's right, since your code does not contain an END statement or a "last line of code"

But it might be better to make some settings, initialize the interrupts, set one or two timers and end the main program code with a WAIT.

Have a look at the sample programs under "Projects" - There are many different ways to Rome
I will.
thank you
Post Reply