From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

8051 programming in C in Multisim

I am trying to write a code in C language for 8051 MCU.

But when I include the reg51.h file, I am getting error regarding the reg51.h file.

So what should I do?

I have attached a snap shot of this error.

--damn
0 Kudos
Message 1 of 5
(8,580 Views)

put the return word void inside the parenthesis.   Some compilers expect to see the value in the main loop construct, but assumed void for all remaining functions when not defined.



Signature: Looking for a footprint, component, model? Might be here > http://ni.kittmaster.com
0 Kudos
Message 2 of 5
(8,552 Views)

Assalamualaikum Peace be on you

 

Hi there guys i am stuck in a problem

 

My code is

 

#include <reg51.h>

sbit x = P0^1;
void main()
{
while(1){
x=1;
}
}

 

It generated an error output that can not find reg51.h. No such file or directory.

You can email me as well

0 Kudos
Message 3 of 5
(7,762 Views)

Hi,

 

Multisim uses the Hi-Tech complier from Microchip, it doesn't use a reg51.h header, use <htc.h> instead.  Reg51 is use is the Keil compiler.

 

Tien P.

National Instruments
Message 4 of 5
(7,610 Views)

Hi there

In my opinion this problem might have caused by using the macro programming language (MPL) in your assembly modules.

Try including a C header file in an assembly program, where you use the C style include statement. For example:

#include "reg52.h";
While using C-style include statement, the header file is located and included.

The Keil A51 Assembler automatically includes the header file reg51.h. To stop the assembler from automaticlly including this file, go to:

Project -> 'Options for Target' -> the 'A51' tab -> and uncheck 'Define 8051 SFR Names'.

Hope this helps.

0 Kudos
Message 5 of 5
(4,505 Views)