LPC2468 writing a file with fopen

Everything ARM and LPC

Moderator: phalanx

Post Reply
sns22
Posts: 3
Joined: Mon Feb 10, 2014 4:55 am

LPC2468 writing a file with fopen

Post by sns22 » Fri Apr 10, 2015 2:27 am

Hi all,

I am working with LPC2468 board from embeddedartists using the IAR Embedded Workbench 7.3

I want to write my results read from a double variable into a txt file created on the PC. I read on the forums and already set the library settings to FULL to read the Dlib_Config files.

Code: Select all

#include <nxp/iolpc2468.h>
#include <stdio.h>
#include <string.h>

FILE* file;
file = fopen("H:\\test.txt","rw+");
fprintf(file,"%A\n",max_temperature_DegC);

fclose(file);
 
I used this standard code. Although I have no compiler warning/errors. But when I debug; the code it gets stuck in the undefined handler (abort handler) as I can see it in the disassembly. The output file is not created and has no output. I am not using UART or any I2C to write to the file.

Is it possible to write to a file on a PC directly or one has to use UART/I2C :?: :?:

Thanks

cfb
Posts: 214
Joined: Sat Aug 30, 2008 11:50 pm
Contact:

Re: LPC2468 writing a file with fopen

Post by cfb » Fri Apr 10, 2015 5:53 am

sns22 wrote:Is it possible to write to a file on a PC directly or one has to use UART/I2C :?: :?:
You cannot write to a PC file directly. Without knowing your requirements (e.g. how much data, how quickly it is being generated, how quickly you need to access it on the PC after it is generated etc. etc.) it is difficult to make a recommendation.

A couple of possibilities: You could connect an SDCard socket to your microcontroller via the SPI bus and write to a DOS-file system on that. You would then take the SDCard and read it on a PC. However, it is probably easier to transmit the data to a PC via the UART and write a program on the PC to copy it to a file.
Chris Burrows
Astrobe: ARM Cortex-M3, Cortex-M4 and Xilinx FPGA Development System
http://www.astrobe.com

sns22
Posts: 3
Joined: Mon Feb 10, 2014 4:55 am

Re: LPC2468 writing a file with fopen

Post by sns22 » Fri May 29, 2015 8:52 am

Hi

Sorry for late reply. Somehow I did not get an email notification for the answer. I have come back to the situation again.
I am using UART to read the data from controller and I store it in a buffer. I can see this data on putty serial connection window.
Now I just want to write to a file on the PC stored on the PC.

write a program on the PC to copy it to a file?? This part I didn't get yet. I am exploring options to write to a file from putty. Any suggestions?

Thanks I also figured out the SDcard possibility in the development board.

Thanks
Sneha

Post Reply