Timer_Start() will not reset the timer! You'll need to use the reset terminal (I used additionally a control-register and toggled a bit).
Keep in mind that the reset is NOT asynchronus, so you'll need an additional FF to sync with the input-clock.
Before I posted this thread I did try to use a control reg with an asynchronous reset that didt work, but that didt work. I will tried you suggestion soon.
When you have any troubles with your project it is much easier for us to have a look at when you upload the complete project here.
To do so:in Developer 5.2: Build -> Clean Project
then Zip (NOT Raw!) the complete folder and upload it here.
You can also try using the "Trigger Mode" as Rising edge or falling edge to trigger a shot.
After the trigger, the component will require a reset.
Look at the schematic below:
You can use the Terminal Count output of the Timer and OR it with "Low" to trigger a reset after every trigger ends. Hence, your next trigger will respond again. This will eliminate the requirement of manually resetting the Timer everytime.
To trigger, you can make a control register drive high and low (for rising or falling edge trigger). In this case, there is no necessity to use interrupt terminal, hence "Interrupt on TC" should be disabled.
Dasq, your solution will work only for higher clock frequencies. When you set the clock to 1kHz the one-shot will not trigger.There are two solutions: enlarge the trigger-pulse with DFF or use for the control-register "Pulse Mode" (which is not for all silicon versions available).See attached project.Bob
OneShot0.zip 255.3 K
Thanks for the suggestion.
My bad, I tested the project by using large delays (in order of ms) and it didn't mis-trigger.
Sorry to reply in old thread, but whenever we search for reset one shot timer this thread appears.
As Bob suggested we have control register to toggle Reset input as in project.
1. We have downloaded timer example which was UDB.
2. We changed to 16 bit fixed function.
3. Run mode One shot
4. We have used a Control reg to control Reset of timer, this control register is in "Pulse mode".
5. We have also used TC output to make Reset High
6. Reset is brought down to Low in software via setting the Contorl Register whenever you need to start again the One shot.
7. We tested it with 1KHz, 100KHz, 1MHz and 24MHz bus clock.
We used this to avoid UDB. Please comment about this approch if we are mistaken somewher.
Thanks in advance.
Timer01.cywrk.Archive01.zip 1.3 MB
I would recommend changing this -
to this -
uint8 volatile InterruptCnt;
uint8 volatile Flag_If_Int=0;
Thanks for the valuable inputs. Yes I will correct that, please also comment on the .cysch and the method I adopted for resetting One shot timer.