- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I have a one shot timer that I want to start multiple times on my demands in software. I have the following setup
For TopDesign see attach picture.
The isr code:
Timer_1_ReadStatusRegister();
/* Set the flag variable */
toggle_flag = 1;
the main code:
CyGlobalIntEnable; /* Uncomment this line to enable global interrupts. */
isr_1_Start();
Timer_1_Start();
for(;;)
{
if(toggle_flag == 1)
{
toggle_flag = 0;
Timer_1_Start();
}
}
But it will only goes into the isr once (because it is a one shot timer). How do I get it to go into the isr multiple time? what did I do wrong?
An other thing in the datasheet for the timer it state the following but it does make complete sence to me can anyone explain?
"Note In order to be sure that One Shot mode does not start prematurely, you should use a
Trigger Mode to control the start time, or use some form of software enable mode (Software
Only or Software and Hardware)."
Martin
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thx you.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mtraedholm,
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob,
Thanks for the suggestion.
My bad, I tested the project by using large delays (in order of ms) and it didn't mis-trigger.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would recommend changing this -
uint8 InterruptCnt;
uint8 Flag_If_Int=0;
to this -
uint8 volatile InterruptCnt;
uint8 volatile Flag_If_Int=0;
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dana,
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.