View Full Version : Datalogger (or Vinculum VDIP1) 48bit Freespace code example

Ron Czapala
04-10-2010, 09:32 PM
The·attached program displays the amount Freespace on a USB drive using the Parallax Datalogger or Vinculum VNC1L USB Host DIP Module.

The VNC1L "FSE" command returns a 48 Bit value (6 bytes) -·least significant byte first.

Extending TRACY ALLEN's code for displaying a 32bit value using DEBUG -·http://www.emesystems.com/BS2math6.htm#showdubdec
the program divides the 48bit precision freespace value by 100 several times in a row, until there is no remainder, to extract the decimal digits and print them on the DEBUG screen.
Since the remainders come off with the least significant digits first, the program displays the digits from RIGHT TO LEFT using the CSRXY control characters.

The second program displays intermediate calculation values to give more insight as to how the math routine works.
Make sure the DEBUG window is FULL SCREEN so that data displays in nice columns...

Ron Czapala

Tracy Allen
04-11-2010, 12:43 AM
Nice work Ron. It should be noted that the first time when a USB-key is first scanned for free space scan is run it can take quite a long time.

Funny thing, this last week I ran into a USB-key (Hewlett Packard 2Gb) that seems to lock up with the FSE command, just sits there. The command has worked with every other USB-key I've tried.

Tracy Allen
www.emesystems.com (http://www.emesystems.com)

Ron Czapala
04-11-2010, 11:02 PM
·· You did most of the work with your tricky code for double precision math. I just tweaked it to handle·the Vinculum data.

I was a Math major and a programmer/analyst for 29 years and the limitations of Basic Stamp math·can still be frustrating!
Of course most of my experience was in financial/and accounting applications, relational databases, etc and later HTML, javascript, SQLServer, etc for web development.·Bit twiddling and word level math was never an issue.

I really appreciate your efforts and explanations in your App Notes pages on your site.

- Ron

As far your HP thumbdrive, did you run CHKDSK on it? Maybe the FAT is corrupted...
I used the VDIP1 on a SONY 8GB and even a Western Digital desktop 500GB external drive.

Post Edited (ronczap) : 4/11/2010 4:07:35 PM GMT