CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

communication with Vinculum VNC2 VDAP rom

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Lemosek



Joined: 15 Oct 2011
Posts: 36

View user's profile Send private message

communication with Vinculum VNC2 VDAP rom
PostPosted: Wed May 02, 2012 10:14 am     Reply with quote

Hello,
Can someone explain to me how write some data (string) to data.txt file on flash drive. I use V2DIP1-32 and PIC 16f1936. At vnc2 I have installed VDAP rom.

Best regards
R.L.
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu May 03, 2012 6:24 pm     Reply with quote

code snippets..

variables used..
Code:

//flash drive data bytes
char zro=00;   //#of bytes to store(long 00 00 00 nn)
char alf=0x0a;   //a line feed
char acr=0x0d;   //a carriage return
//default date,date,temp
char str_yer[3]="12";
char str_mth[3]="34";
char str_day[3]="56";
char str_hrs[3]="12";
char str_min[3]="34";
char str_sec[3]="56";
char str_t1[6]="-999";
char str_t2[6]="+999";
char str_s1[3]="JM";

function to save data to file already opened on flashdrive
Code:

void usbfd_save_data(){
fprintf(usbfd,"WRF %C%C%C%C\r%C%C,%C%C,%C%C,%C%C,%C%C,%C%C,%C%C%C%C,%C%C%C%C,%C,%C%C%C\r",zro,zro,zro,0x21
,str_yer[0],str_yer[1]
,str_mth[0],str_mth[1]
,str_day[0],str_day[1]
,str_hrs[0],str_hrs[1]
,str_min[0],str_min[1]
,str_sec[0],str_sec[1]
,str_t1[0],str_t1[1],str_t1[2],str_t1[3]
,str_t2[0],str_t2[1],str_t2[2],str_t2[3]
,str_s1[0],str_s1[1]
,acr,alf
);
}

This function dumps data as a 'CSV' format allowing easy importing on a PC into say Excel or other program.
usbfd refers to the serial port connected to the flashdrive,all data are strings.The time info comes from a DS1307.str_t1[] and str_t2[] are the data from 2 I2C temp sensors,s1[] is data from 16 binary sensors.

The 'trick' is to code your data for CSV format.Yes it takes some thought, but once configured it's easy to add/delete data to the records stored onto the drive.

I currently run the V2DIP2 at 115K200 without handshaking and haven't had any bad data in almost a year of collecting remote temperatures from a solar collector system.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group