- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey, guys, I need some help with my program. I using Timer component to generate a 5 seconds delay while execute somethings. Using a clock@10kHz the period should be 50000 to give me 5 seconds, but when I set Timer_WritePeriod(50000) the count never hits zero to generate a pulse at TC.
When I set Timer_WritePeriod(20) the TC occur, but I dont know how accurate the delay is.
Is there something wrong?
void Tempo(void)//5 seconds
{
Control_Reg_Timer_Write(0);//Enable Timer
Timer_Stop();//Stop timer
//Timer_ClearFIFO();
Timer_WriteCounter(0);//
Timer_WritePeriod(20);//
Timer_Enable() ;//Enable Timer
while(Status_Reg_Read() == 0)//wait for the TC rising edge
{
UART_PC();
LED_Write(1);
}
Control_Reg_Timer_Write(1);//Reset Timer
LED_Write(0);
return;
}
Solved! Go to Solution.
- Labels:
-
PSoC 5 Device Programming
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Reading the question and answers again, I noticed that you could connect "Interrupt" component to the "tc" pin, too.
With this you can catch the rising edge of "tc" without much hassle.
IMHO, using "interrupt" seems more "formal", though.
schematic
Note: main.c is the same with my previous post
Tera Term log
moto