I wish to read from a text file within my Keil C program. However it is not possible to use the FILE command as in normal C. I was wondering if this is possible to do this in Keil C
Usually a '51 microcontroller-based design does not have an operating system with a file system support, hence the lack of file I/O in Keil's implementation of the standard C library. Where is the text file you want to read from is located? Is it on a hard drive connected to your '51 microcontroller? If it is, you'll have to write a file system implementation which will be able to read that file.
The file is on my HD. Was hoping I wouldn't have to write a file system implementation. But I will if I have to. Thanks :)
How exactly was your microcontroller supposed to access your hard drive? Remember that the compiled program runs on the target system, not on your PC.
was using hyperterminal to communicate. Alternative was hoping to pass the file through the program on HD during compiling it, then download it to the board. This requires writing a file system as stated above.
Hmmmmmm. Maybe I should take a crack at this. 1. The harddrive is connected to your computer--NOT to your 8051. So, there is no way your 8051 can directly access the hard drive in the first place. 2. You want to transfer the data FROM the harddrive (on your PC) TO the 8051. 3. You already stated you have hyperterminal working on your PC and communicating with the 8051. So...Why don't you just transmit the data file from the harddrive to the 8051 using hyperterminal? The 8051 can receive ASCII as well as BINARY data, so the format of the data would not be a problem. And, hyperterminal as well as many other terminal programs have a file upload capability. Hence...I don't see a reason to write a file system for the 8051. It sounds to me like you are confusing the features of a cross compiler (like the Keil C51 Compiler) with those of a standard C compiler (like Borland or MicroSoft C) that runs on a machine with a disk operating system. Jon