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 comment
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

  • Upvote 1
Link to comment
Share on other sites

  • MVP 2023

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

  • Upvote 1
Link to comment
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 comment
Share on other sites

  • MVP 2023

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 comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.