I need to write a code for reading values from the serial port and dumping them onto a text file,
can someone help me?
Whats required is that the changing values in the serial port has to to be updated frequently onto a text file.

thanks for any help

i am using the windows platform and am using C compiler


Which operating system and compiler are you using?

This has been discussed many times before.

Try say http://www.lvr.com/serport.htm

commented: Starting thinking about changing your compiler soon. +2

Off hand, I can list about a dozen C compilers for windows.
I figured it was 'C' from the forum you chose to post in.

Dev-C++ 4.9.9.2 is an accurate description of a compiler (for example).
Oh, and "windows" isn't exactly precise either, covering as it does 3.1, 95, 98, ME, NT, 2K, XP, Vista.

sorry for being so vague, but i am just starting with this and this is my first project,

well i am using turbo C version 3
and i am developing for windows XP

thanks


Off hand, I can list about a dozen C compilers for windows.
I figured it was 'C' from the forum you chose to post in.

Dev-C++ 4.9.9.2 is an accurate description of a compiler (for example).
Oh, and "windows" isn't exactly precise either, covering as it does 3.1, 95, 98, ME, NT, 2K, XP, Vista.

sorry for being so vague, but i am just starting with this and this is my first project,

well i am using turbo C version 3
and i am developing for windows XP

thanks

Well, Turbo C compiler o more supported. Try think of changing to a new compiler. Like Dev-C++. Which is really good. Perhaps if get standard libraries to access Serial port from windows. If i can still remember you have a library bios.h which allows your access serial port. Is it iport and oport.

ssharish

i saw the libary there are a few commands like biascom in bios.h, i feel that will do the job of getting the values from the serial port.

but how do i transfer it on to a test file??

Well, Turbo C compiler o more supported. Try think of changing to a new compiler. Like Dev-C++. Which is really good. Perhaps if get standard libraries to access Serial port from windows. If i can still remember you have a library bios.h which allows your access serial port. Is it iport and oport.

ssharish

Here is a good tutorial on how to access with serial port. Perhaps this guy is using turbo C compiler.

http://ontrak.net/c.htm

Well, if you wanted to read an data format he port and write them on to the file. It should be pretty straight forward. Because all data which are received from serial port on in the format of string. Well not necessarily but you could read them as string and then write them on to file, in which ever format you want. Well for read you would use fscanf function i guess. It link shows how to do that.

But still, you should consider changing your compiler.

ssharish

i saw the libary there are a few commands like biascom in bios.h, i feel that will do the job of getting the values from the serial port.

but how do i transfer it on to a test file??

First things first. Read data from the serial port. Don't try to do the entire program in one shot. Once you get the reading part running, then consider writing to the file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.