Jump to content

Recommended Posts

Hi support and forum members

I have successfully used the Visilogic project examples to log data using an SD Card.

However, the example program uses SB13 to write data to the SD card every 1 second. This is far too frequent for my application. I want to log data every minute, or every 10 minutes. 

How can I reduce the write frequency? Do I need to use some delay timers? Can anybody assist me with the correct/optimal ladder for this. 

Picture of code attached. 

I'd also like to know how to display the free space in MB or GB left on the SD card

Best Regards

DataLog.JPG

Link to post
Share on other sites

Hello,

 

Use a self-resetting timer with 1 min preset setting (attached example) so that you get a pulse every minute.

Then replace SB13 with the direct contact of this timer.

 

SD card's free space is shown in SBW 59.  Capacity is given in 512-byte chunks.

Note that you have to SET SB 217 to enable writing into SBW 59.

Then just link SDW 59 to a numeric entry variable on the screen.
DDFFGG.PNG

Link to post
Share on other sites

I'd use a timer set for the frequency that you want to log at as you mentioned.

As for the amount of free space on the card SDW 59 shows the amount of free space left on the card with some math you can display it in MB or GB.

Link to post
Share on other sites

In theory a self-resetting timer set at 60 seconds will count to the minute, but there are innate scan time variations involved which cause errors over time.

For all my minute by minute logging I need it done exactly on the minute, so that it can be correctly interpreted into Excel later.  I use an = 0 comparison on SI30, which turns on an MB.  I then use a positive transition of this MB to activate the log row write. The logging row itself includes time and date for reference/display in Excel.

For different "on the minute, but at minute multiples" counts, you can achieve the same thing with simple revolving count comparisons on SI36 triggering the MB.

cheers,

Aus

Link to post
Share on other sites

All good solutions - thank you everyone! I will probably go with the timer

Ausman - thanks, I like your method a lot. I probably don't need this degree of accuracy for this particular application but I will explore it nonetheless. That knowledge will certainly be useful for future. 

Link to post
Share on other sites

Thanks Clint. 

Re SDW59.  It's all pretty self-explanatory.

If you are ever bored, instead of getting a coffee, go cruising through the System operands. I still find things I didn't know about, or didn't have a previous need for which meant they weren't stored in the grey matter.     ......Oh alright then, you can get the coffee to have whilst you do this!

cheers,

Aus

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...