Hi benj,
Thanks for your reply earlier
i need to calculate the time that i require in a menu. To generate a start and stop pulse's.
in a interrupt i counted the number of interrupts to give the required time.
So how would i do the same thing?
Thanks,
Wayne
ARM
Moderator: Benj
-
- Posts: 234
- Joined: Thu May 31, 2007 2:18 pm
- Has thanked: 7 times
- Been thanked: 12 times
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ARM
Hello Wayne,
You already have the mechanism for a delay up to 2.7ms with a resolution of 1us.
From this you basically need to work out how many full 2.7ms chunks are going to make up your delay and if you need a remainder delay afterwards.
Once you know this set the interrupt off with a count value of 65535 and count the number of whole interrupt chunks by incrementing a counter every interrupt. Once all the whole chunks have been done change the timer rollover value to the appropriate value and let the interrupt run one more time. Once this has finished disable the interrupt until you need to delay again.
You already have the mechanism for a delay up to 2.7ms with a resolution of 1us.
From this you basically need to work out how many full 2.7ms chunks are going to make up your delay and if you need a remainder delay afterwards.
Once you know this set the interrupt off with a count value of 65535 and count the number of whole interrupt chunks by incrementing a counter every interrupt. Once all the whole chunks have been done change the timer rollover value to the appropriate value and let the interrupt run one more time. Once this has finished disable the interrupt until you need to delay again.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 234
- Joined: Thu May 31, 2007 2:18 pm
- Has thanked: 7 times
- Been thanked: 12 times
- Contact:
Re: ARM
Hi team,
Is there a flag that i can read in the interrupt to say that the interrupt has finished
to trigger an output.
Thanks,
Wayne
Is there a flag that i can read in the interrupt to say that the interrupt has finished
to trigger an output.
Thanks,
Wayne
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ARM
Hello Wayne,
The interrupt flag probably needs to be controlled by you. When you specify the length of time you wish to delay for can you create a count variable to tally the number of 2.7ms in your delay and a second variable to count the remainder in us. In the interrupt service macro I would then decrement the counter for each 2.7ms delay you do. Once this is equal to 0 then do one last final delay with the remainder value then set the remainder to 0. Once this has been done and your back in the interrupt service routine simply disable the interrupt and set your flag now to say the interrupt delay has finished.
The interrupt flag probably needs to be controlled by you. When you specify the length of time you wish to delay for can you create a count variable to tally the number of 2.7ms in your delay and a second variable to count the remainder in us. In the interrupt service macro I would then decrement the counter for each 2.7ms delay you do. Once this is equal to 0 then do one last final delay with the remainder value then set the remainder to 0. Once this has been done and your back in the interrupt service routine simply disable the interrupt and set your flag now to say the interrupt delay has finished.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 234
- Joined: Thu May 31, 2007 2:18 pm
- Has thanked: 7 times
- Been thanked: 12 times
- Contact:
Re: ARM
Hi Benj,
Sorry for the confusion i wondered if there was a way to read in the interrupt a flag to see if the interrupt has finished.
please see what i have tried to do too get a start pulse at the start of the interrupt and a stop pulse at the finish of the interrupt.
i have tried do this using a flag but the start and stop pulse happen at the same time about 8us apart from each other.
if the stop pulse happens in the main loop i will get some error in the time taken to exit the interrupt and then execute the stop pulse in main.
Thanks,
Wayne
Sorry for the confusion i wondered if there was a way to read in the interrupt a flag to see if the interrupt has finished.
please see what i have tried to do too get a start pulse at the start of the interrupt and a stop pulse at the finish of the interrupt.
i have tried do this using a flag but the start and stop pulse happen at the same time about 8us apart from each other.
if the stop pulse happens in the main loop i will get some error in the time taken to exit the interrupt and then execute the stop pulse in main.
Thanks,
Wayne
- Attachments
-
- Test2.fcf_arm
- (8 KiB) Downloaded 263 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ARM
Hi Wayne,
This program should be a bit closer to what you need.
This program should be a bit closer to what you need.
- Attachments
-
- Test3.fcf_arm
- (6 KiB) Downloaded 262 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel