Hello,
I want to print all my value after 1 minute without interrupting or increasing delay for other function .
for Example i am showing arduino code . it won't call PrintAllValue(); function till complete the one minute delay and won't effect or increase the delay for other function .
if((millis()- PrintDelay)>1000)
{
PrintDelay = millis();
PrintAllValue();
}
I write smiler way in cypress but it showing error ...
if ((CyDelay()-PrintDelay)>1000))
{
PrintDelay=CyDelay(1000);
PrintAllValue();
}
Best Regards
Deepak Aagri
CyDelay() uses a timed loop just "burning" CPU power. Not what you want. See description in "System Reference Guide".
You should set up a timer with an interrupt and maintain an internal counter yourself. Granularity may be as low as one millisecond
Bob
Thanks Bob..
would you like to share the sample code for that....?
You cannot convert that directly, since there is no corresponding millis() function. Your Ardiono example uses a function that returns a time value (milli seconds since startup), and uses that to find out how many time has passed. CyDelay() waits for the specified time, and has no return value - thats why you get a compile error.
"would you like to share the sample code for that....?" Its not a sample code, it is a simple code.
extern volatile uint32 msCounter;
void TOnkHzHandler(void)
{
msCounter++;
}
Have an interrupt connected to a 1 kHz clock
Bob