We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
ek51v705.exe very simple test program, why get ERROR: PREMATURE END OF FILE ON 'ex1.hex' anyone can help me. Thank you
#include <AT89x51.h> #define uint unsigned int #define uchar unsigned char sbit P07=P0^7; void Delay(uint i) { uint j; for(;i>0;i--) for(j=0;j<125;j++) {;} } void main() { for(;;) { P07=1; //close lamp Delay(500);// delay 0.5S P07=0; //open lamp Delay(500); //delay 0.5S } } ================================= Build target 'Target 1' compiling ex1.c... linking... Program Size: data=9.0 xdata=0 code=64 creating hex file from "ex1.hex"... OBJECT TO HEX FILE CONVERTER OH51 V2.6 COPYRIGHT KEIL ELEKTRONIK GmbH 1991 - 2001 GENERATING INTEL HEX FILE: ex1.hex *** ERROR: PREMATURE END OF FILE ON 'ex1.hex' *** OH51 ABORTED. "ex1.hex" - 0 Error(s), 0 Warning(s).
I'm kinda guessing, but it sounds like you have named the output file from the linker EX1.HEX (which, by the way, is NOT a HEX file--it is an OMF51 file). Then, the Object-HEX converter tries to convert the EX1.HEX file into an Intel HEX file (named EX1.HEX). So, the first thing OH51 does is to erase EX1.HEX. And, that causes the error you receive. To solve this problem, go to the Target Options-Output Tab and change the name of the executable to EX1 and not EX1.HEX. Jon
it solved the problem, Thank you very much