View previous topic :: View next topic |
Author |
Message |
asiklariskostas
Joined: 07 Jul 2013 Posts: 16 Location: Greece
|
Open files with PIC |
Posted: Fri Jan 10, 2014 3:38 am |
|
|
Hello everyone,
i want to make a datalogger with my PIC. I wonder if i can save for example, a Temperature measure to my Desktop in a text document, via RS232. Is something like that possible using CCS Compiler??? Does CCS Compiler support a feature like fopen???
I prefer not to use external eeprom or any usb/sd card module.
Thanks anyway. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Fri Jan 10, 2014 4:09 am |
|
|
Er.
No.
The PIC has no code in the PC, so can't open a file on the PC.
However any basic PC program (including things like hyperterm), can write data from the serial port to a file, and obviously a tiny amount of PC programming could generate something that even allowed the PIC to send the file-name it wanted the data to go to.
The compiler can't support this, it is down to a program on the PC. SIOW that comes with the compiler can 'do' this, but not automatically (human interface required, inputting the file-name etc.).
Best Wishes |
|
|
asiklariskostas
Joined: 07 Jul 2013 Posts: 16 Location: Greece
|
|
Posted: Fri Jan 10, 2014 4:25 am |
|
|
Thanks Ttelmah for your answer.
I understood what you've said. If i can't make it with CCS, maybe I can try to write a program in Visual Basic that supports hyperterminal features in order to show my measures. I want the user to select a directory in order to save the data and then to use in a excel form and that makes it difficult for me.
Thanks again for your answer. |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Fri Jan 10, 2014 1:21 pm |
|
|
The PIC on whatever hardware you have can take the measurements, format it and send it via serial etc, however, it has no knowledge of anything on the PC. It is your responsibility on the PC side to create some sort of application VB or whatever) that takes the serial data being sent to the PC and do something with it. You can format the data you are sending from the PIC to make life easier for yourself by sending the data with a letter or other tag on the front of it for example so your PC program had an easy time of deciding which data was T1, T2 or whatever measurements you are sending, but it is up to your program on the PC to figure out what to do with the data from the PIC.
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1353
|
|
Posted: Fri Jan 10, 2014 7:17 pm |
|
|
Actually, if you have the IDE and an ICD programmer, there are some options. The ICD has a serial emulator built into it which can be (from your code) linked to the SIOW.exe program that comes with the IDE. This program has logging options as well. I've never tried it myself, but you are welcome to play with it.
There is a video on the CCSinfo website:
http://www.ccsinfo.com/content.php?page=video_tutorials
Look for the Data Streaming tutorial
That said, I do prefer just dumping to a regular RS-232 port and having PuTTY save it, but one day I may play with the CCS option. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Sat Jan 11, 2014 12:54 pm |
|
|
If you format your data in dotCSV format, eXcel can open and automatically organize the data for you! It's also very easy for any language to capture and store.
As others have said it's the PC side you'll have to decide upon. I know Realterm has 'capture' mode( just tried it) however to have the PIC program name the file, you'll have to use something like Delphi,VB, Qbasic to create the 'listening/capture' program. What language you choose will be based upon what you're good at.
hth
jay |
|
|
|