Hello everybody giving a helping hand,
got me some trouble here. I was making a program that reads out the duty cycle of an ADXL202 sensor. Everything works, except the part were i want to print my data in a file using this :
FILE *stream, *fopen(); if ( (stream = fopen(...)) != NULL) fscanf(stream,''%s'', string);
Ok this is were my problems start. The compiler gives me the error that he doesn't know this type FILE ore the function fopen (). This seems to be logical to me since i looked in my stdio.h header and found nothing really according to that declaration. Is there a posibility that this is stored in another source file or does not exist??? Or .... how do i get my data's in a *.txt file ???
Thanks for the help i'm about to receive :))
P.S: Im using a 80C535 µC, sorry for not mantuening
Now would be a good time to stop thinking like a PC programmer and start thinking like an embedded programmer.
Files require an operating system that handles files, or at least a file system driver. Either of those would be an oddity in the uC world
Or .... how do i get my data's in a *.txt file ???
Well, if you tell us where the *.txt file is (on your PCs hard drive ?) and how the uC is connected to it (serial port), maybe we can give you some hints.
My *.txt file is named test_acc.txt and is located on my desktop that means in c:/Dokumente und Einstellungen/Desktop. My controler is via serial port connected to the pc.
My controler is via serial port connected to the pc.
In that case, maybe you should have a look at the putchar(), puts() and printf() functions:
http://www.keil.com/support/man/docs/c51/c51_puts.htm http://www.keil.com/support/man/docs/c51/c51_putchar.htm http://www.keil.com/support/man/docs/c51/c51_printf.htm
They are still very much part of the PC world (and you'll be surprised about the amount of code memory that the "simple" printf functions takes up), but will work on the uC.
Of course, you will have to configure the serial port first and have something (Hyperterminal might do for starters) on the PC side that can receive the output of the uC.
If your uC application has real-time constraints, you may need to "roll your own" serial output routines that are interrupt-driven.
Thanks for the advise but this is not helping me. Maybe im not clear enought. My fault, sorry. I am using HyperTerminal to comunicate with my µC. And i can see the data he's sending me via serial port but on the terminal window. Now if i want to hape this data in a text or in a excel file (even better) i must record the transmision on the terminal. I would like to see the data in my terminal window but at the same time record it in a text file or a tabel in Excel. That would be great because i must deliver a diagram and trough that i could save a step. I mean i still receive data in my terminal, see if there are corect, record tham in txt input them in excel and make my diagramm. Now if i could transfer them directly to the Excel file and make the diagram i could save 1-2 steps and so make a "automatical" program.
"I am using HyperTerminal to comunicate with my µC. And i can see the data he's sending me via serial port but on the terminal window. Now if i want to have this data in a text or in a excel file (even better) i must record the transmision on the terminal."
That's right - this is a PC question, not a Keil question.
Hypoterminal can record the received data to a file - see 'Capture Text' on the 'Transfer' menu.
Or you can write your own PC application to automate the process.
To do it in Excel, see: www.windmill.co.uk/rs232.html
Remember: as far as the PC is concerned, it's all just serial data - the fact that it happens to be coming from an 8051 is entirely irrelevant to the PC.
Writting a serial receiving program in PC enviroment(Visual Studio,Delphi,GCC,etc) will save you out.
Yes real nice "ninja Z", thats the best solution, write myself a serial receiving program. And loose another 2 weeks on that. I'll bet that the www got something for me that does not include selfprograming serial ports and other desolating methods of human knowledge. Thanks again mister Dragon Ball Z
"write myself a serial receiving program. And loose another 2 weeks on that."
Actually, it's not entirely "losing" 2 weeks, is it?
From your original post, it sounds like getting the data onto your PC is an integral part of your project?
Of course, if you can find something ready-made and suitable, there's no point re-inventing the wheel.
Well actualy my project includes reading an ADXL202 acceleration sensor and transcribe the messurments into a table (diagram), and i figured that would do great with excel. But with the normal Hyperterminal i must record the data into an *.txt file. And then transcribe into excel and then to the table etc.... Help....
"with the normal Hyperterminal i must record the data into an *.txt file. And then transcribe into excel and then to the table etc."
Did you actually look at www.windmill.co.uk/rs232.html ?
They have a lot of stuff about getting serial data into Excel...
"with the normal Hyperterminal i must record the data into an *.txt file. And then transcribe into excel and then to the table etc"
If you won't put the effort into creating an automated application, then you're going to have to put effort into doing it manually, aren't you?
Only you can say where the break-even point is...
"Help..."
Well, as you said yourself, "I'll bet that the www got something for me ..."
Have you looked into the user of ODBC with the Microsoft Text Driver (using text or csv files) to get the data into Excel?
I don't think the problem is in getting files into Excel - the problem is in getting serial data directly into Excel without having to mess about with intermediate files & capture utilities?
Exactly, thats well put.... files directly into excel without intermediate files and capture utilities etc...
Any helpfull sugestion is more than welcome.... but without reward :)) sorry
I think you missed my point. I wasn't talking about getting files into Excel.
To be more explicit:
Have he checked if the M$ ODBC text driver can work directly on a text file, while the Hyperterminal is capturing data, i.e. can Excel do on-the-fly graphing while the data is still being being received?
In that case, it wouldn't matter that the data is being stored somewhere - Excel do need the data somewhere to be able to graph it.
"I think you missed my point."
Some of it, yes!
"if the M$ ODBC text driver can work directly on a text file, while the Hyperterminal is capturing data"
But this is still not serial data direct into Excel, is it? This still requires running Hypoterminal and setting it up to capture the data - the OP doesn't want to do that.
I think Dan's suggestion of the "Serial Wedge" is probably the best - whether this is a physical Wedge that goes in the keyboard line (but might be too slow?) or a "Virtual" wedge that works straight from the COM port...
Or perhaps the M$ ODBC text driver can handle the COM port as a "file"...?
Some HyperTerminal-like programs support DDE client/server operations. For example, I use Procomm Plus instead of HyperTerminal. Procomm Plus can be programmed as a DDE client to initiate a link to Excel and enter received data directly into Excel cells and send Excel commands.
I don't think the OP has a problem with running the HyperTerminal to capture the data. The main problem seems to be having the data getting stuck in a file and then needing a lot of manual - and repeated - work to get it further.
I was thinking that it might be possible to run a capture in Hyperterminal (or just piping the data from the com port to a file) and then have Excel do a new read of the ODBC source whenever the user wants to see a current graph.
"I don't think the OP has a problem with running the HyperTerminal to capture the data."
HyperTerminal can only capture to a file, not enter the data directly into a spreadsheet. What I am adding to the list of his options are different terminal programs (e.g., Procomm) that have DDE or OLE facilities to enter data directly into spreadsheet cells as the data arrives without manual intervention or extra manual steps.
Sounds real interesting and helpfull your idea. Thanks for that, but do you know if there's a posibility to get a free version of that Procomm Plus software ?? Because, you know, i'm a little bit thight :)
Mercy
The older DOS version are available as shareware, but not Procomm Plus to my knowledge.
Is Procomm Plus still available?
Even if it is, it's not supported.
See: www.8052.com/.../read.phtml
"The older DOS version are available as shareware"
But they won't do DDE or other such Windows stuff...
"Is Procomm Plus still available?"
Yes, it's still a boxed product. Despite its lack of support, for many clients it is still the preferred product of its type because of the features and scripting language.
"... DDE or other such Windows stuff ..."
Heavens, no -- the shareware left off all the way back at V2.4.3 or thereabouts.
Hey Guys thanks for the advices but i made myself a little program in the macros of the Excel, with that you have directly acces to the serial port. Then give the parameters to a function .... real easy .... found it in the internet ... Thanks again
Andy
View all questions in Keil forum