cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

Anonymous
Not applicable

I'm new to PSoC microcontrollers, and just started using the PSoC 5LP. 

   

I'm wondering how to interpret the timer interval values captured from a timer block, for instance with Timer_ReadCapture().

   

Is the value based on the clock signal given to Timer Block, or is it scaled to seconds, microseconds, etc?

   

- thank you

0 Likes
8 Replies
Anonymous
Not applicable

 Also, 1 more question. How do you output a number with a decimal portion to the LCD. I've noticed that all decimall numbers get truncated to only its integer term when it is ouputted on the LCD using: LCD_Char_PrintNumber()

   

For examle:

   

0.1234 outputs as 0.

   

7.56 outputs as 7. 

   

-thank you

0 Likes
ETRO_SSN583
Esteemed Contributor

Is the value based on the clock signal given to Timer Block, or is it scaled to seconds, microseconds, etc?

   

 

   

You are reading the timer core counter, via capture, which is being clocked by input.

   

So if start timer, then at a later time read it you have, in the number of clocks, the time

   

expired. So if inout clock was 100 Kz (10 uS) and you read from a start 50 clocks thats

   

.5 mS has expired.

   

 

   

Note if timer is running countinuously you can take a capture as a start, then another at

   

a later time, and subtract the two for the elapsed count/time. In this case you have to detect

   

if timer rollover occured when you calculate.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

 Also, 1 more question. How do you output a number with a decimal portion to the LCD. I've noticed that all decimall numbers get truncated to only its integer term when it is ouputted on the LCD using: LCD_Char_PrintNumber()

   

 

   

By converting the float to a string and printing it with print string API. You set up a char buffer,

   

pass its pointer to the sprintf().

   

 

   

Usually use spintf() to convert float to string. Attached how to make up the formatting

   

string for sprintf().

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thank you!

   

I'm working on a program to decode the encoded signal coming from a speed sensor. What is a good way to do this? I am trying to find RPM from a signal that creates 32 pulses per RPM. I was trying to use an edge detector to count rising edges of the pulses, the edges are then counted up by a basic counter, and then I used a timer block to find the time between every 32 pulses.

   

Thanks again,

   

Deepu 

0 Likes
ETRO_SSN583
Esteemed Contributor

If you are not trying to measure shaft position, just simple RPM, then

   

just measure frequency, and divide result by 32 to get RPM.

   

 

   

So if shaft is running at 1,000 RPM, then freg from sensor, probably

   

optical or magnetic, is 1000 rpm = 32000 counts/minute =~ 533 hz.

   

Thats your conversion factor from RPM from sensor to freq cntr Hz

   

 

   

I can send you 2 different projects for freq cntrs, email me at danaaknight@gmail.com

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hi Dana, I emailed you.

   

Looking forward to your reply.

   

 

   

Thank you,

   

Deepu

0 Likes
ETRO_SSN583
Esteemed Contributor

I sent you email ~ 2 - 3 hours ago. But I see that it bounced, no reason.

   

 

   

djj110020@utdallas.edu

   

 

   

    

   

         

   

Your message did not reach some or all of the intended recipients.

   

 

   

      Subject:    RE: Frequency Counter

   

      Sent: 3/31/2015 4:46 PM

   

 

   

The following recipient(s) cannot be reached:

   

 

   

      'Jose, Deepu' on 3/31/2015 4:46 PM

   

            552 5.7.0 message content and attachment content guidelines. j94sm10667946qgd.47 - gsmtp

   

 

   

I tried IE, Chrome to post here, no luck.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

Try this -

   

 

   

    

   

          https://www.dropbox.com/sh/prpc74bdga7yijz/AAAeC-Dmmn5sYbWwRrl0-ZUoa?dl=0

   

 

   

When you get to the link, right click to download.

   

 

   

Regards, Dana.

0 Likes