07-28-2012 08:24 PM
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?
07-29-2012 08:47 PM
Please take a reference of this post and a document.
http://forums.ni.com/t5/Circuit-Design-Suite-Multisim/8051-C-in-multisim/m-p/1798822
http://www.ni.com/pdf/manuals/371752b.pdf
Thanks
07-30-2012 08:13 AM
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.
07-30-2012 10:16 AM - edited 07-30-2012 10:17 AM
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.