Jump to content

Data Table to Excel


Recommended Posts

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

  • NoamM changed the title to Data Table to Excel

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

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.test.PNG.0dfb9384ffae54048157af65f7830d00.PNG

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.

test.PNG.9afcd0ac7e13bc07ecfcb521089558f1.PNG

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...