gazza29 Posted August 25, 2021 Report Share Posted August 25, 2021 Hi, having problems with my program Cant seem to get the data tables to transfer all the data table to Excel also is there anyway to time how long a bit is on for for then reset the the time when the bit is off and save this in my data table also cant figure out how to set a timer to run for so long then then reset back to 0 when finished would take its trigger from the proxy sensor T2 please feel free to alter the program for the better if i have done something wrong new to this software and struggling a bit Gary Data Sampling.ulpr Link to comment Share on other sites More sharing options...
Dave Posted August 25, 2021 Report Share Posted August 25, 2021 Hi Gary. Had a look at your code. Here's what I see so far... The struct you are using to write to the data table doesn't match the format of the data table struct. They must match exactly, the format of each member of the struct, and the order of the members in the struct. I don't see any code that loads the user name into the "logging" struct. The user name is found in the User Access Control struct, and its data format is String-UTF-32. You will need to change the format of the username in the data table struct to match(its currently set to String-ASCII) Also found in the User Access Control struct, is the Event Update Bit . You can use this, along with the Event Type tag, to monitor when a user has logged in or out. The Event UTC, also found in the User Access Control struct, contains the timestamp of the event. The help file has a pretty good description of these tags. I haven't used the Event UTC tag, so I don't know what it looks like, but I'm guessing you may have to do some conversion to get it to a format of your choice. If you are OK with the format as is, then just change the data format of your LOGIN & LOGOUT tags to UINT32 and add some code to load the Event UTC timestamp into the logging struct. Keep in mind that any time the Event Update Bit is set, you must manually reset it with your code in order to be able to capture the next event. Not sure why your complete data table is not getting sent to the SD card. What is the Status code of your Store DTI function when you execute it Looks like you are almost there. Hope this helps. Link to comment Share on other sites More sharing options...
Dave Posted August 26, 2021 Report Share Posted August 26, 2021 18 hours ago, gazza29 said: "also is there anyway to time how long a bit is on for for then reset the the time when the bit is off and save this in my data table" If you don't need high precision, you could use the status of the monitored bit in series with a rising edge of the frequency.frequency 1 (s) tag to increment an integer. This would give you a rough value in seconds how long the bit was on. Store the integer value(and perform conditioning/formatting first, if needs be) in "logging" struct. Use the falling edge of the monitored bit to reset the integer to zero You could use the frequency.frequency 100 (ms) to get a bit more precision. 18 hours ago, gazza29 said: also cant figure out how to set a timer to run for so long then then reset back to 0 when finished would take its trigger from the proxy sensor T2 The output of an accumulating timer TA, turns ON when it reaches zero, while the input is still ON(starts counting on the rising edge of the input). You could use that bit to reset the timer. Once the output turns ON, it stays ON, even if the input trigger turns OFF. Link to comment Share on other sites More sharing options...
gazza29 Posted August 26, 2021 Author Report Share Posted August 26, 2021 Hi Dave, thanks for that but I don’t seem to be able to get either to work I will be doing something wrong gary Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now