Good morning.
I use the PIC18F47Q10.
I would like to use a 16 bit timer in my program.
So I use Timer5.
It reads the values in milliseconds or Second comes a different value.
If there is an example, can I see it?
Thank you.
Timer Reading Value?
-
- Posts: 217
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 1:43 pm
- Has thanked: 6 times
- Been thanked: 7 times
-
- Matrix Staff
- Posts: 1952
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 510 times
- Been thanked: 698 times
Re: Timer Reading Value?
Hello,
I've added an example here for you which should show the basics of the timer component.
https://www.flowcode.co.uk/wiki/index.p ... )#Examples
I've added an example here for you which should show the basics of the timer component.
https://www.flowcode.co.uk/wiki/index.p ... )#Examples
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: Timer Reading Value?
Thank you for the example program.
After the timer stops, the value is read.
I want to read the value before the timer stops and use that value to stop the timer and use the read value. is it possible? Or is there a way to use that value after a certain amount of time has passed?
For example, a 500ms timer and a 1 second timer.
please answer me.
Thank you.
After the timer stops, the value is read.
I want to read the value before the timer stops and use that value to stop the timer and use the read value. is it possible? Or is there a way to use that value after a certain amount of time has passed?
For example, a 500ms timer and a 1 second timer.
please answer me.
Thank you.
Re: Timer Reading Value?
Possibly use an interrupt for the timer, and increment a variable inside the interrupt. Then outside of the interrupt, simply test the variable for the value you are wishing to stop at.
Re: Timer Reading Value?
Just insert an interrupt icon into the beginning of the program. The timer you use will dictate how often the interrupt happens.
When the interrupt happens, the macro (of your choice) will be run. In that macro, you simply add +1 to a variable That's it.
That accomplishes nothing except incrementing a variable - But in your regular program, you can now test the variable for compliance with your requirements.
The timer speed will be set when you insert the interrupt. That number will dictate how many times per minute that the interrupt will run.
Simply calculate how many times it will run to determine your variable test number for one second or millisecond.
When the interrupt happens, the macro (of your choice) will be run. In that macro, you simply add +1 to a variable That's it.
That accomplishes nothing except incrementing a variable - But in your regular program, you can now test the variable for compliance with your requirements.
The timer speed will be set when you insert the interrupt. That number will dictate how many times per minute that the interrupt will run.
Simply calculate how many times it will run to determine your variable test number for one second or millisecond.