cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

Anonymous
Not applicable

i am tring to measure pulse rate by gating the the input pulses for a fixed time (0.5 mS) by using a 16 bit gating timer(T1) and the incoming pulses are counted by a 16 bit counter(C1). I noticed an error in the pulse count.  Eigther by reducing the gating time or multiplying the result with some fraction i may get the corrected resul like that i thought.

   

When i tried to multiply the counter's result with a fraction i couln't get the correct result. (i defined the counter's result as int variable).  could you please suggest?

   

regards,

   

gopal

0 Likes
2 Replies
MR_41
Employee

Try typecasting the counter output to float.  For example if you are trying to multiply the Count by a fraction 0.75:

int Count;
float Result;

Result = (float)Count * 0.75;

Best Regards,
Ganesh

0 Likes
Anonymous
Not applicable

I tried with typecasting then also i was an error.  The mistake i committed was before manipulating the counter data i didn't stop the counter. thanks for your reply.

   

regards

   

gopal

0 Likes