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: 

MCU 8051 no simulation C language

Hello everyone,

 

I'm a bit new at multisim and this is also a subject for school.

I study and live in Holland, and my hobby is Electronics.

 

At school we learn about transistors and that kind of stuff.

We have learned about the 74 series as well. I'm the one who likes to

do it at home in the evening hours Smiley Embarassed

So this is for hobby.

 

I saw something about the MCU and started to try something simple. I have enough experience with Arduino

So I can program the standards in C language. I did read about #include <htc.h> and i've tried to simulate some program like

#include <htc.h>
#define LED P10
void delay(unsigned int);

main(){
while(1){
LED = 1;
delay(1000);
LED = 0;
delay(1000);
}
}

void delay(unsigned int x){
unsigned int i;
for(i = 0;i < x; i++){
;
}
}

and really no error showed up.

I build it no problem to see.

but when I press RUN nothing happend.

I cannot program in assembly, only in C.

 

And I have connected the Vcc, GND and a LED with a 150 Ohm's resistor to the ground.

The LED is connected to the pin en the upper-left corner ( P1B0T2 ).

8051_circuit.JPG

 

When I press tools >>  Update component  >> (select them all) >> Update

 

The LED turns on but nothing happend....

 

I really hope someone can help me!

I think it is just a simple button to check or something..

 

I didnt check other chips, because this one was most common on the internet.

 

Kind regards,

 

Loek Lankhorst

 

Holland

 

loeker@live.nl

0 Kudos
Message 1 of 3
(4,197 Views)

Hi,

 

Check the code against the manual for HI-TECH C51 lite, which is what I think is included with Multisim (I see it in my installed programs). There are probably differences between that and Arduino. If there is an example in the HI TECH manual, try that. It's been a while since I wrote for 8051 and it was assembly, but I think the output instructions were quite different.

 

You might find the manual looking around here:

 

C:\Program Files (x86)\HI-TECH Software\HC51\lite\9.60\docs

 

The C compilers have to generate the micro code that matches the processor and that is usually reflected in the compiler. Some C compilers can output the assembly language and that's another way to learn it.

 

An Arduino PIC architecture is much different than an 8051. There can even be differences between 8051 C compilers from different companies (Intel vs Hi-Tech).

 

Good Luck,

Jim S.

Message 2 of 3
(4,117 Views)

I make the same work as you, but an linking error occurred .

the message as following:

error.PNG

It can't find the Hi-TEch maybe, I don't know how to design the complier path.

hope for your help. thanks!

Best wishes!

mengrongge@sxqc.com

0 Kudos
Message 3 of 3
(3,997 Views)