473,466 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how we can create .txt file in embedded c

1 New Member
int readADC(int channel)
{
int val=0;
ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0) | (1 << ADIF);; // Set ADC prescalar to 128 - 125KHz sample rate @ 16MHz
ADMUX = channel;
ADMUX |= (1 << REFS0); // Set ADC reference to AVCC
ADMUX |= (1 << ADLAR); // Left adjust ADC result to allow easy 8 bit readin
//ADCSRA |= (1 << ADFR); // Set ADC to Free-Running 4
ADCSRA |= (1 << ADEN); // Enable ADC
ADCSRA |= (1 << ADSC); // Start A2D Conversions
while(!(ADCSRA & (1<<ADIF)));
ADCSRA|=(1<<ADIF);
//val = ADCL+(ADCH<<8);
val=ADC;
return val;
}
int main()
{
FILE *f1;
char ch;
//writing char to file
//error=> f1=fopen("ADC11.txt","w");
while((ch=getchar())!=EOF)
putc(ch,f1);
fclose(f1);
Jun 18 '14 #1
3 1303
weaknessforcats
9,208 Recognized Expert Moderator Expert
Did you #include <stdio.h> ?
Jun 18 '14 #2
aleciagibbons14
18 New Member
i just research the answer i did not find yet,, hope their are someone know so that we also knows..
Jun 19 '14 #3
donbock
2,426 Recognized Expert Top Contributor
You say "embedded C"; and the name of that first function is readADC(). Are you coding for an embedded system? It is not uncommon for embedded systems to not support file I/O. What do you know about the system capabilities?
Jun 20 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Nicholas Then | last post by:
I am writing an ASP.NET application and I have a class that I have written to create a vCard...it just returns a string with all the necessarry info... Anyway...is there a way that I can create a...
1
by: egsys | last post by:
I am simply trying to create a file in access 2003. Receive an error message that: "Workgroup administrator couldn't create the workgroup information file. Make sure that you have specified a...
0
by: Randy | last post by:
Hi, is it possible (and how? ) to write an application, where I can get some informations like "artist" or "title" from a streamed file, which was played by a WindowsMediaPlayer ActiveX, which...
4
by: Bnob | last post by:
It is possible to create a file in local user-machine? With this code in code-behind: fs = New System.IO.FileStream(lFileCSV, System.IO.FileMode.Create, System.IO.FileAccess.Write) The file...
11
by: Russ Green | last post by:
I need help writing a method to create a simple text file. I want that file to be saved to a local drive (client side of my asp.net app). The filename will always be the same "license.txt" but the...
1
by: Victor | last post by:
Hi, We have following setup here Web Server (Win2000) and FTP Server (Win 2000) We have ASP.NET application which runs on Web Server and writes file(s) onto FTP Server. We created asp.net...
3
by: christiang | last post by:
Hi guys, I'd like to use Alexia thumbnail service. It's an interesting service, you pass an url to its cgi and you get a thumbnail of that url. Of course they don't have the screenshots of all the...
1
by: j7o0s5 | last post by:
How to create file help chm?
0
Kosal
by: Kosal | last post by:
Hi I have problem with vb.net I want to create file setup or exe file for run on Client Computer that no need to install vb.net 2005 but I never do so I don't know what can i do? Please help...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.