Rounding Frequency Issue

I am running into a little bit of an issue and I don’t know what I’ve done wrong.

But I am working with a motor with a digital encoder. That encoder is sending pulses to a IDC-24. I am reading the frequency of that encoder from that card and from the card, it is showing the float number of the frequency. But when I grab the frequency from that port in Pac Control, it rounds the number. I need it to pull the float without rounding.

Attached image is of the card from Groov Manage and the window is a watch window from Pac Control.

Is there a setting that I am not seeing and I didn’t select?

What command are you using in PAC Control to get the frequency? Can you post a screenshot of that?

1 Like

For sure.

Here are two of them that are retrieving the frequency and they are both acting the same way. And then the variable that I am moving it to to show that I am not moving it to an integer and that is possibly the reason why it isn’t grabbing decimal places.


EDIT: Oh, I forgot that it isn’t with just one Frequency, it is with all of them. I have 10 different frequency inputs that I’m using

EDIT 2: I think I may have messed something up with this request, I said “When I retrieve the freq”. It isn’t just when I retreive it, the first screen shot that I sent was from when you double click on the I/O ports in Pac Control to watch them and it is still showing there. Attached a screen shot of the area in Pac Control that I am talking about.

This is working as expected.

Here is how to get more resolution.

3 Likes

Change to GetPeriod and divide by … nevermind Ben got to it first…

3 Likes

Thank you so much Philip and Ben, I will give that a shot.

1 Like

I tried “Get Period”, and it worked once then it didn’t update the data anymore after that.

I also tried “Get & Restart Period” and that didn’t even give me an initial value.

By any chance, do you know of any common mistakes that I could be making on getting this to work?

You will need to rework your logic a little bit and call GetPeriodMeasurementCompleteStatus to check if a period measurement is complete, then call Get & Restart Period. If you call Get & Restart before it is done (like calling in a short loop), you will restart it before it is done and get zero each time.

2 Likes

Oh, there we go. That worked. Thank you for your assistance.

2 Likes