Test and Measurement Forum

How to use reading from PicoLog hardware in C code.

Post your C and C++ discussions here

How to use reading from PicoLog hardware in C code.

Postby louis1016 » Wed Nov 04, 2015 9:05 pm

Ok so I have to take the readings rom the PicoLog and put it in an excel sheet. This means I need to somehow take the readings from the PicoLog example program and instead of printing to the screen, I need to store it some other way.

Code: Select all
            {
               printf ("%f\t", AdcToMv ((HRDL_INPUTS) channel, g_values [i++]));
            }


That is the supplied code that takes the readings and display on screen. I figured I would have to use sprintf with the same format as the printf given? I modify the code to look like this:

Code: Select all
//Print this analogue channel value, derived from g_values
               char str[80];
               sprintf(str, "%f", AdcToMv ((HRDL_INPUTS) channel, g_values [i++]));
               printf ("%f\t", str);

               printf ("%f\t", AdcToMv ((HRDL_INPUTS) channel, g_values [i++]));


however, when I printf "str", the string printed is blank. When the program comes to the normal printf line, the readings are properly displayed on the screen. SOmehow it seems that printf and sprintf arent using the AdcToMv function the same way.

I just need to get this reading to instead be displayed on the screen, saved to a variable of some sort (which is what i tried to do with sprintf). From there I plan to import it to an excel sheet but I cant even get this part to work.

Please help if anyone can, it would be much appreciated. Thank you.
louis1016
Newbie
 
Posts: 0
Joined: Wed Nov 04, 2015 8:37 pm

Re: How to use reading from PicoLog hardware in C code.

Postby louis1016 » Thu Nov 05, 2015 3:25 pm

I forgot to add, the resulting string from the sprintf comes out as all 0's.
louis1016
Newbie
 
Posts: 0
Joined: Wed Nov 04, 2015 8:37 pm

Re: How to use reading from PicoLog hardware in C code.

Postby louis1016 » Sat Nov 07, 2015 12:23 am

Please delete....figured it out after posting
louis1016
Newbie
 
Posts: 0
Joined: Wed Nov 04, 2015 8:37 pm


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests