ccreevey Posted November 18, 2020 Share Posted November 18, 2020 Hello, Very new to DAQFactory, the program I am trying to create is a simple loadcell and LVDT, has a zero loadcell and LVDT button and shows the values and logs the value - zero'd value. I have everything but the logging working, because it is only logging the V on the input. I was doing all of my conversions with V channels and when I zero my sensors and hit log it still only records the original and not zero'd value. Haven't had a great look at converting the value to a different unit yet using conversions. Assume the test channel I create are called LVDTTest andLoadcellTest. I had a look on the forum and found people saying to do something along the lines of LVDTTest.addvalue(myinput[0] * 50 + 4) to a test channel. Not exactly sure I am doing it correctly, is it meant to go into the event of the LVDTTest channel or somewhere else. Or is there an easier way that I just cant think of. Any help much appreciated. Kind Regards Cameron Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted November 18, 2020 Share Posted November 18, 2020 First, I would not use V channels. They are a left over from a very long time ago that remain because customers still like them for some things. However, they do not work directly with Logging Sets, which is why you aren't able to log them. Instead you should either create a Test channel and stuff it with your converted data as you described, or use a Conversion to convert the data as it comes in. Which you use really depends on whether you need to still see the raw, unconverted data. If you do, then you'll need two places for data, one for raw (the actual I/O channel) and one for the converted data (the Test channel). If not, then you can just apply a conversion to the actual I/O channel. The tricky part if you are using a Conversion and single channel is that when you zero, you have to back out the existing zero value. So for example, if your conversion is: Value - zeroValue where zeroValue is some global variable that is initialized to 0 on startup. If you then have a Zero button that basically takes the current raw value and make it read 0 (like a Tare), then you have to remember to back out the existing zeroValue first. So if the channel the above conversion is applied to is called LoadCell, the zero button would be: zeroValue = LoadCell[0] + zeroValue It would NOT be: zeroValue = LoadCell[0] because LoadCell[0] has been shifted based on the current value of zeroValue. Quote Link to comment Share on other sites More sharing options...
ccreevey Posted November 18, 2020 Author Share Posted November 18, 2020 Hello, So I should use global variables and put those into a test channel. The only real problem I am having is where to put the add value function. Is it in the test channel event tab or say where I run my quick sequence on the button? Eg button code: Global loadcellZero = loadcell[0] LoadcellTest. AddValue(loadcellZero) Then create a conversion for the test channel: LoadcellZero =Loadcell[0] - loadcellZero does this sound somewhat correct? kind regards Cameron Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted November 19, 2020 Share Posted November 19, 2020 You don't need addvalue() if you are using a conversion. Just create a conversion: Value - loadcellZero Then apply that conversion to your LoadCell channel, by selecting it from the list. Now your LoadCell channel will display zeroed values once you zero it. Put: global loadcellZero = 0 in a sequence marked Auto-Start so when the system loads it will initialize the zero value to nothing. Then create a button to re-zero with a Quick Sequence action: loadCellZero = LoadCell[0] + loadCellZero That is it. Don't use addValue. Don't put the channel name in the conversion. Also don't put an = sign in a conversion. A conversion is an expression, not a statement. Quote Link to comment Share on other sites More sharing options...
ccreevey Posted November 21, 2020 Author Share Posted November 21, 2020 Thank you for your help, I was a bit confused with the value as I thought you meant the channel [0] but after that misunderstanding was cleared up that I needed to put Value in, worked with the conversion. Kind Regards Cameron Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.