Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming 8051 in Multisim (Using C)

Multisim 11

 

when i 'm getting start writing C for 8051 in multisim, an error occurs.

I used to use keil c compiler,so I don't know how to use hi-tech compiler.

even so, I wrote a simple LED blanking program, which has problemsin it.

the following is my code

 

 

===========================================================

 

#include    <htc.h>
#define LEDPin=P27;
void delay(unsigned int);

void main()
{
    while(1){
        LEDPin = 1;
        delay(10000);
        LEDPin = 0;
        delay(10000);
    }
}

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

===========================================================

 

When I tried to build it, it kept saying that there's error in the line with red mark.(expression syntax)

Could anyone tell me where I did wrong?

Message 1 of 4
(10,037 Views)
0 Kudos
Message 2 of 4
(10,031 Views)

Both od them are using assembly, but I'm using C.

what I don't understand is why a simple describe that set LEDPin to high or low got some problem in syntax.

0 Kudos
Message 3 of 4
(10,021 Views)

Your define statement appears to be incorrect.

 

#define LEDPin=P27

 

should be......

 

#define LEDPin   P27

 

Also, I use PIC micros and the naming convention used is (for example) RA5 which means Port A, bit 5.  Check to make sure P27 actually maps to a pin.  Sometimes the assembly definitions are not the same as the C definitions.

0 Kudos
Message 4 of 4
(10,018 Views)