Timer 2 Tutorial
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Timer 2 Tutorial
Morning All
Is there a tutorial for setting and using timer 2 ?
have found a few posts on here and excel sheet etc but these not making sense
wanting to set on Eico modules
Steve
Is there a tutorial for setting and using timer 2 ?
have found a few posts on here and excel sheet etc but these not making sense
wanting to set on Eico modules
Steve
Success always occurs in private and failure in full view.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Timer 2 Tutorial
Hi Steve,
Lest assume your are after a 1000Hz interrupt frequency.
1) Run flowchart and add the timer interrupt, select timer 2, then select properties.
2) Download the great timer app from here.
3) After extracting and running app Select More check box, just in case the exact frequency is not possible.
4) Enter the Oscillator speed, in the case 48000000
5) On flowchart interrupt properties select the Prescaler rate drop-down and see if maximum is 1:16 or 1:64 then select the maximum correct prescaler on the timer app.
In the case of ECIO 1:16.
6) Enter the target frequency of 1000 on the time app then select Do it!
7)The settings you should set timer 2 (I have highlighted) to are then displayed in the app Results window: Enter then within flowchart timer 2 properties: Hope this helps.
Martin
Lest assume your are after a 1000Hz interrupt frequency.
1) Run flowchart and add the timer interrupt, select timer 2, then select properties.
2) Download the great timer app from here.
3) After extracting and running app Select More check box, just in case the exact frequency is not possible.
4) Enter the Oscillator speed, in the case 48000000
5) On flowchart interrupt properties select the Prescaler rate drop-down and see if maximum is 1:16 or 1:64 then select the maximum correct prescaler on the timer app.
In the case of ECIO 1:16.
6) Enter the target frequency of 1000 on the time app then select Do it!
7)The settings you should set timer 2 (I have highlighted) to are then displayed in the app Results window: Enter then within flowchart timer 2 properties: Hope this helps.
Martin
Martin
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Timer 2 Tutorial
cheers martin will have a go and see how i get on
Steve
Steve
Success always occurs in private and failure in full view.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Timer 2 Tutorial
Your welcome Steve.
Out of curiosity, do you have an interrupt frequency in mind?
Out of curiosity, do you have an interrupt frequency in mind?
Martin
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Timer 2 Tutorial
not got a clue to be honest was going to try 1000Hz like you said and see if it works correctly - maybe not the correct way to go
wanting to generate an internal event at 20msec's
Steve
wanting to generate an internal event at 20msec's
Steve
Success always occurs in private and failure in full view.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Timer 2 Tutorial
That would be one way to go.Steve001 wrote:wanting to generate an internal event at 20msec's
All you do is place count variable that increments by one within the interrupt macro.
E.e
Code: Select all
Count = Count +1
Code: Select all
If Count = 20 then count = 0 : Do whatever as another 20ms has elapsed since last here e.g. toggle an output.
The 1000 = interrupt frequency.
50 = 1/required time period = 1/20E-3
Martin
Martin
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Timer 2 Tutorial
Thanks martin
bit more clear now thank you for explaining
trying to finish some ongoing projects after erm cough months
Steve
bit more clear now thank you for explaining
trying to finish some ongoing projects after erm cough months
Steve
Success always occurs in private and failure in full view.
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Timer 2 Tutorial
attached test file not behaving as expected runs at warp factor 10
not sure what is wrong was hoping A0 to be 50Hz and A5 to be 1Hz, have 506 and 102 admittedly not checked on a scope found my lead to be iffy
used Hz on my fluke
Steve
not sure what is wrong was hoping A0 to be 50Hz and A5 to be 1Hz, have 506 and 102 admittedly not checked on a scope found my lead to be iffy
used Hz on my fluke
Steve
- Attachments
-
- timer 2.fcfx
- (14.21 KiB) Downloaded 304 times
Success always occurs in private and failure in full view.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Timer 2 Tutorial
One way is attached.
Hopefully only thrusters are engaged this time.
Martin
Hopefully only thrusters are engaged this time.
Martin
- Attachments
-
- timer 2 V2.fcfx
- (15.44 KiB) Downloaded 343 times
Martin
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Timer 2 Tutorial
cheers martin
simulation looking better will try on hardware tomorrow
what does this do ?
Steve
simulation looking better will try on hardware tomorrow
what does this do ?
Code: Select all
(int_count1Hz = 0) || (int_count1Hz = 100)
Success always occurs in private and failure in full view.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Timer 2 Tutorial
working thank you martin
Steve
Steve
Success always occurs in private and failure in full view.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact: