Sign in to follow this  
Followers 0
baptie

Equals to (UINT)

10 posts in this topic

I have used a PLS2 function to sens a servo sweeping Left to right with code inbetween working out limits, stops and home positions. All works great apart from the head requires a little offset, around 1000 steps to clear the area. I have used -(410) to subtract offset from trailing edge = trailing edge offset When scan_Sensor is off: =(301) (Ignore the 'S' I was clutching at straws) to compare the raw encoder value against the above calc. Or LH_Limit activated Scan CW If in the calc I put subrtact 0 - the scan works great. If I subtract or add any number from 1 - 10000 say, the head ignores the =301. Can anyone see where my logic has failed, as it seems a very simple calc? All figures are UINT's

Share this post


Link to post
Share on other sites
I do not do this sort of stuff but you mention the values are UINT and you maths are INT (signed). I do not know if this would have an effect or not.

Share this post


Link to post
Share on other sites
That was my exact worry Bob.

Share this post


Link to post
Share on other sites
Your explanation is not too clear, but you mentioned the PLS2 instruction. If the fragment has something with the PTO PV (present value) or positioning target, the latter are 32-bit values, while all your calculations shown are 16-bit.  

Share this post


Link to post
Share on other sites
no, i am simply using PLS2 for movement, i amaling with the posision via a limit on the sweeping head. repeatable value +/- 50 steps, i need to add offset of around 1000 to move out a bit. so i actually stop and start the PLS2 via CW & CCW wired to plc

Share this post


Link to post
Share on other sites
Where does film trailing edge come from. what is its type... not to sure of the speed of the encoder feedback... could scan time have something to do with your error ? he's a tip... i sometimes use... when assigning a symbol then for literals i will have uint, int or flt preceeding the description (old programming habit)

Share this post


Link to post
Share on other sites
(old programming habit) Programmer ain't no spring chicken either!

Share this post


Link to post
Share on other sites
I take Leading edge and trailing edge readings fed back from the encoder as a limit passes the film. As the leading edge passes I send the encoder value to leading edge and to an interrupt register. same with trailing edge. Then I am trying to compare trailing edge + offset with the raw encoder value. I am about to attempt altering values to signed, if not successful I am looking at swapping over inputs to give me an input with interrupt capability to do it at source. Hopefully, number is reached, fire interrupt and move number to Leading & Trailing edge calcs in time for compare.

Share this post


Link to post
Share on other sites
As said, i am unaware of the encoder speed, but i hazard a guess that it is cycling faster then the scan time.. hence the logic could skip your instruction of =. have a look at the CFTBL (i think thats right) as an instruction that independently does the comparison and will fire a subroutine when equal etc...

Share this post


Link to post
Share on other sites
I tried CTBL and it kept missing the downward pulse. Altered my way of doing sweep but still not happy as its not right

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0