-
1. Re: Timer dropping out too soon
user_1377889 Mar 12, 2015 5:19 AM (in response to user_343349849)It is always advisable to upload a complete project showing the error, there are a bunch of settings that may influence the timer's behaving. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Bob -
2. Re: Timer dropping out too soon
user_343349849 Mar 12, 2015 6:11 AM (in response to user_343349849)Good Point, I have attached the bundle.
-
TimerExample.cywrk.Archive01.zip 689.1 K
-
-
3. Re: Timer dropping out too soon
user_343349849 Mar 12, 2015 6:12 AM (in response to user_343349849)Note: I did also try with Timer-Flag set as volatile
-
4. Re: Timer dropping out too soon
user_1377889 Mar 12, 2015 7:21 AM (in response to user_343349849)Some corrections: volatile for the flag is mandantory, program will fail when compiled with "Release" setting
INT should be "Rising Edge" for UDBs
Flag was not initialized.
Period was set, but counter has value from initialization or last stop
_StartEx() for interrupt was called within loop, same for Timer_Init()
Happy coding
Bob
PS: I changed the target to PSoC5, please reverse to PSoC4 4247
-
5. Re: Timer dropping out too soon
user_1377889 Mar 12, 2015 3:14 PM (in response to user_343349849)1 of 1 people found this helpfulTook me some time to find that "counter-bug", but I'd like you to tell how:
When you start the debug-session and the program stops at the first executable instruction of your program
Debug -> Windows -> Components -> Check the timer and watch relevant timer registers.
When setting a BP at the right place you will see that the counter of the timer runs amok.
Bob
-
6. Re: Timer dropping out too soon
user_342122993 Mar 12, 2015 3:03 PM (in response to user_343349849)1 of 1 people found this helpfulYour "ms_delay" function is blocking. It already has standard implementation in Creator:
CyDelayUs( 1000*ms);
odissey1
-
7. Re: Timer dropping out too soon
user_343349849 Mar 12, 2015 3:10 PM (in response to user_343349849)No, I am not using it as blocking timer in my application. The project uploaded only contains the timer part.
In the actualy project it does this
Start Timer();
while(!Timeout){
do stuff;
}
-
8. Re: Timer dropping out too soon
user_343349849 Mar 12, 2015 3:18 PM (in response to user_343349849)Thanks Bob,
The code works fine. I could not determine from the datasheet that you have to set up the counter and timer registers to reset count.
Also, the rising edge on the interrupt was something I was not aware of.
By the way, how to you see if the Interrupts are enabled? Is there a register you can watch.
Regards
David
-
9. Re: Timer dropping out too soon
user_1377889 Mar 12, 2015 3:25 PM (in response to user_343349849)1 of 1 people found this helpfulThere is an icon in the Creator menu to switch interrupts on and off. The Icon always shows the current state.
Bob
PS: When do you sleep???
-
10. Re: Timer dropping out too soon
user_343349849 Mar 12, 2015 3:38 PM (in response to user_343349849)Bob,
I was just about to ask you when you sleep.
Thanks again.
I know this question is regarding a different issue than this thread but I am hoping you could help while I "have you" here.
I have a PSOC 4 project with digital inputs on P4[2] and P4[0] that I want to set up interrupt on rising edge.
However, it appears these pins cannot be "used for routed connections". Referring to the PINS technical guide I see you can access the pins directly but I am not sure how you attach interrupt to them.
A while ago I had a similar issue and tech support advised to change the Input Synch mode. This time it does not appear to make any difference. Would using the Pins own INTERRUPT method solve the issue?
At the moment I enabled hardware connection and attached isr component
-
11. Re: Timer dropping out too soon
user_1377889 Mar 12, 2015 4:16 PM (in response to user_343349849)I cannot get that to run, too. Best for you is to try to call the technical support again.
Bob (Local Time 10:15 pm)
-
12. Re: Timer dropping out too soon
user_343349849 Mar 12, 2015 4:37 PM (in response to user_343349849)Will do thanks Bob,
The night is but young in your neck of the woods.
Local time here is 8:30 am
David
-
13. Re: Timer dropping out too soon
user_78878863 Mar 12, 2015 5:51 PM (in response to user_343349849)I think you need to set the input sync mode to "transparent". The default of "double-sync" needs an UDB which is not available on port 4.
-
14. Re: Timer dropping out too soon
user_343349849 Mar 12, 2015 5:57 PM (in response to user_343349849)Yes, I have tried transparent node also.
I have looked at the incoming waveform on a scope and it is correct but I cannot seem to properly read the pins.
After not being able to detect high going, I tried the cypins_readpin and can detect the clock going high but not data
Attached is the waveform. It is fairly slow (clock period is 2ms), data is supposed to be read on high clock.
-
DAT and CL_DAT waveform.JPG 100.4 K
-