MicroLogix HSC timing

jeffprice

Member
Join Date
Oct 2014
Location
Michigan
Posts
3
I am using a Micrologix 1400 high speed counter to monitor an encoder on a rotating shaft. I have an STI running every 2ms which takes the encoder accumulated count, subtracts the previous count and then calculates the shaft speed. My problem is that at a constant shaft speed the difference between current and previous counts on successive scans fluctuates by as much as 20%.

I guess that this relates to the timing of the HSC count update within the PLC scan.

Does anyone know of a method to force an immediate update of the HSC accumulated value ?
 
Hi and Welcome to the Forum,
As I understand it the HSC runs separately from the PLC Scan. So I am sure that the HSC Accumulator is updating properly.

Can you post your program or maybe a screen shot of how you have the HSC set up? You shouldn't have to use a STI when using the HSC. You can set a preset in the HSC function file and when the ACC = PRE then it runs the subroutine number that is put in the HSC function file. It creates its own STI.

So you might be better off setting a preset and running a routine that measures the amount of time between the HSC done bits and use that to update your rate.

Is there a reason that you are trying to update your rate every 2ms? That seems pretty fast to me for a MicroLogix. I have never tried to run anything that fast so it may be possible but just seems a little fast to me.
 
Is there a reason you need to calculate the shaft speed every 2ms? Try setting it to 1 sec. Running the calc too often means that the variance between calcs is going to be much greater.

For example, if you only see an average of 5 pulses per 2ms period, then if you see 6 pulses on the next period, there's your 20% error. Not exactly the best method.
 
Last edited:
Bullzi, rupej,

thanks for your comments. To fill you in some of the details of the application, running the shaft at constant speed (1,000 rpm) is the first step in the process. I then stop the shaft in approximately 300 milliseconds. At the point of stopping I zero the HSC accumulator value and then during the stop record the HSC accumulated counts every 2 ms. The idea is to create a stop profile which can be compared to subsequent stops.

At 1,000 rpm I am getting about 150 counts every 2 ms but as previously stated this varies by about plus or minus 20%.

It could be the STI trigger time that is varying, as yet I have found no way to check this. Or it could be some issue with the HSC updating asynchronously to the PLC scan.

Any thoughts welcome.
 
Update

I changed the STI scan time to 4 ms and still saw the same variation in the HSC counts.

I then copied the value of the free running clock into a file every STI scan. Initial indications are that the STI trigger time is varying from 3.7 to 4.3 ms.

This would account for the fluctuation in the HSC counts.

Does anyone know if a 15% variation in STI trigger time is normal ?
 
I can't answer for certain, but that is about the variance between logic scans so it may be normal for STI as well.

I was thinking that maybe you can do it a different way- use a "target" accumulated value in the HSC to trigger an interrupt routine to look at the clock and see how long has passed since the last calculation and calculate speed that way. Bit I'm not sure if that can work with the HSC since that is separate hardware, as you noted. You're pushing the limits of what the little ML can do- I hope you can solve this and I'd be interested to hear how you go about it. Please keep us updated.
 
Last edited:

Similar Topics

Hi, everyone I’m working on a registration project where I’m counting encoder pulses between registration marks. I’m expecting to see around 1800...
Replies
2
Views
441
I am trying to program a Micrologix 1400 to control a beer keg filler using an IFM SM6001 flow meter. The meter will be set up for a pulse...
Replies
5
Views
1,848
Is it possible to set up the HSC in the 1766-L32BXB as a ring counter. So it will roll over to 0 counting up and continue to count up that...
Replies
2
Views
1,097
Hi everyone first of all. This is first question in the forum. I am using HSC application. I'm reading A and B pulse count. 1 round of the motor...
Replies
12
Views
4,361
Is it possible to add a HSC onto a MicroLogix 1400 processor? I am using RSLogix500 and the toolbar has the HSC button greyed out. Is there any...
Replies
5
Views
4,153
Back
Top Bottom