Incrementing a float for Flowmeter

Martindag

Member
Join Date
Sep 2009
Location
quebec
Posts
227
Hi guys,

Im about to add a new flowmeter which pulse every 0.1 cubic meter to my Micrologix 1400.

I would like to increment of 0.1 everytime i get a pulse in a Float (F8:8)

I dont want to make it with a counter, right now im trying to do it with a ADD function but im probably missing something, it's not working like i thought it would.

Im saving everything after that in a CSV data log that reset everyday and start a new file.

If you have a quick way to make it work, i would like to see it.


Thanks !
 
Well my flowmeter pulse go in my digital input I:0/6 which pulse every 0.1 cubic meter.

and i want to totalize it into a float (F8:8) which im going to store into a datalog .CSV

What im looking for is the easiest way to addition my pulse to my total float.




sry i can't post it here, i will be able only tomorrow at work.
 
XIC - one-shot - ADD instruction.

If the number gets to large you may have problems adding .1. Then you may want to consider using a long data type and add 1. Then divide by 10 to get your float value.
 
You must use a one-shot (OSR or ONS) before ADD, or the ADD will increment every scan as long as the input is true.

My guess is that this is the reason your ADD function isn't working properly
 
Alright im going to use a DINT then for my total and convert it to a Float for the data log only.

Thanks alot for the advice !
 
DINT doesn't exist in SLC or Mircologix. ML1100 & 1400 have LONG, though. You can use INTEGER or LONG, increment by 1 (instead of 0.1) and then divide by 10, storing the result in a FLOAT. If it's just for information on an HMI, you can probably move the decimal point within the HMI program, too.
 
I tried it this morning and it seem to work good.
What i did is:

My pulse go into I:0/6 and into a ONS to get a single scan only and store it into N7:0
I do a MOV of N7:0 to F8:8
then i take F8:8 and divide it by 10 to the destination F8:9
and with a RTC i make my N7:0 reset everyday at 23:59pm

and i use the F8:9 to save into my datalog in CSV
 
the big question that everyone is worried about is this:

how BIG will the number in N7:0 ever get? ...

if it could POSSIBLY try to go higher than 32,767 then you're probably going to have some major problems at that point ...

one thing to consider: you don't have to ADD the pulses to an Integer location first - and then MOVe the total to a Floating Point location ... everything else being equal, you could just ADD the pulses directly into the Floating Point location instead ...

then there's this question to consider:

how BIG will the number in F8:8 ever get? ... if it's around 16,777,216 then more problems may occur ...
 
Last edited:
Oh yeah sorry ! i forgot to talk about it!

My Pulse will never go higher than 850, my waste system block everything after we reach a daily 85 cubic meter. So using a Integer N7 will be more than enough. But thanks for mentioning it !
 

Similar Topics

So, I get sent a heartbeat, an int that goes from 0-9 every second and then restarts, I need to detect if it stops after 3 secs. Any simple way...
Replies
11
Views
3,081
I'm sure this is an easy one for the experienced guys, how can I use an incrementing dint value to trigger a counter to count? It seems like it...
Replies
4
Views
3,175
Hello World, I am having difficulty incrementing a serial number that needs to start at 0, and go through Z. (After 9, comes A). The serial...
Replies
11
Views
1,850
Good Morning, I have a sort of easy problem that is driving me nuts. I have an application where I'd like to take a set point, lets say it...
Replies
4
Views
2,279
Hey everyone, I am hoping that i can get an answer on this matter... I have a micrologix 1100 hooked up to a signal conditioner (Omrga DMD-466-DC)...
Replies
4
Views
1,580
Back
Top Bottom