logging data
I'm looking for an efficient way to save data to a txt file. I am reading it off of an AtoD chip. I think the data will be recorded as bits and I will do all my other programming when I am not concerned with speed.
-Thanks for your help.
-Thanks for your help.
Comments
The attached file shows a template file that prints 16 values per line.
import stamp.core.*;
import stamp.util.text.*;
public class AdcLogging_test {
· //prototype function for ADC
· static int readAdc() {
··· return 0;
· }
· static void main() {
··· int i,value;
··· while (true) {
····· for (i=0; i<16; i++) {
······· value = readAdc();
······· Format.printf("%04x ",value); //print value as hexadecimal value
····· }
····· Format.printf("\r\n"); //CR,LF at line end
··· }
· }
}
You can also print unsigned decimal values
Format.printf("%5u ",value); //print value as unsigned decimal value
or Comma Seperated Values (CSV file)
Format.printf("%5u, ",value); //print value as comma seperated unsigned decimal·value
To log the message window output, rightclick in the main message window
and select Log. You will be prompted for a file name.
regards peter
Post Edited (Peter Verkaik) : 10/18/2007 4:13:56 AM GMT