Help running C program in 8051 emulator.

Greetings everyone,

I'm new to programming, and I'm having trouble running a c program in an 8051 emulator. I'm using emu51.exe

formatting link
projects/emu51/) with asm51.exe
formatting link
ASM51.htm). When I use asm51 to convert the c program to a HEX file, I receive the following message:

C:\UHCL\CPROGR~1\asm51>asm51.exe

8051 Cross-Assembler, Version 1.2k

(c) Copyright 1984-1996 by MetaLink

Source file drive and name [.ASM]:

1\P08-15.c Second pass

ASSEMBLY COMPLETE, 30 ERRORS FOUND

Although the HEX and LST files are created, they don't appear to load into the emu51.exe emulator. I assume it is due to the errors I'm receiving during "assembly" in asm51.exe. Below is the source that I am using. If you could help me out with this, I would certainly appreciate an email!

#include

#define MAX_ROWS 5 #define MAX_COLS 4

void fillArray (int table[][MAX_COLS], int numRows);

int main (void) {

int row; int col; int ary[MAX_ROWS][MAX_COLS];

fillArray(ary, MAX_ROWS); printf("Data: \n"); for (row = 0; row < 5; row++) { for (col = 0; col < 4; col++) printf("%8d", ary [row][col]); printf("\n"); } return 0; }

void fillArray (int table[][MAX_COLS], int numRows) {

for (int row = 0; row < numRows; row++) { table [row][0] = row * 10; for (int col = 1; col < MAX_COLS; col++) table [row][col] = table [row][col - 1] + 1; } return; }

Best regards,

Mark

Reply to
mark.puffer
Loading thread data ...

Use an assembler on assembly code and a C compiler on C code.

--
Dan Henry
Reply to
Dan Henry

SDCC is a free compiler.

formatting link

--
Dan Henry
Reply to
Dan Henry

So you ran a C file thru an assembler !?!?!

Where did you get the idea you can do that ??

I think you are in the wrong line of work !!

donald

Reply to
Donald

In article , snipped-for-privacy@earthlink.net writes

That is a simulator. An emulator in this context is hardware. See "ICE"

You don't mention which C compiler you are using to convert the C source you have into assembler.....

You have 30 errors in the source code. You need to fix the source and have NO ERRORS before you try and run it in the simulator.

I would suggest you download the Keil eval compiler/simulator and use that to test the code as the Keil 8051 tools are probably the best in the world.

Then from a solid and confirmed start point you can use the sourceforge simulator when the code is too big for the Keil eval sim.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
/\/\/ chris@phaedsys.org      www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Reply to
Chris Hills

In article , Dan Henry writes

However as it is only a very small amount of C he is better off using the Keil eval system. That will be a LOT more reliable and robust. It also had a good set of manuals and a LOT more support.

Besides the simulator in the Keil system will be a lot better than anything else he can find

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
/\/\/ chris@phaedsys.org      www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Reply to
Chris Hills

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.