This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

can we use bdata,sbit in lpc2148??

I want to use the following code in lpc2148...but i am getting compile error..

bdata unsigned char bd1 ;
#define status=0;
sbit d0 = bd1^0;
sbit d1 = bd1^1;
sbit d2 = bd1^2;
sbit d3 = bd1^3;
sbit d4 = bd1^4;
sbit d5 = bd1^5;
sbit d6 = bd1^6;
sbit d7 = bd1^7;

After compiling i am getting,

error: #20: identifier "bd1" is undefined
error: #20: identifier "sbit" is undefined

I am using keil4..

Plz let me know how to write this code compatible with LPC2148.....

  • Andrew Neil,

    The ARM processor and compiler does not support the sbit and bdata keywords. They are extensions to the C51 compiler so it can access the special features of the x51 processor cores.

  • "can we use [...]" - no.

    why? - because it isn't part of the C language standard and exists explicit extensions for a completely different processor architecture.

    So instead of asking if you can use 8051 extensions, why not ask a more specific question about a problem you want to solve with a LPC2148 processor?

    bdata isn't a problem you want to solve. bdata does not represent anything you are interested in when using a LPC2148. You would know that, if you had understood that 8051 program you originally cut the code from. Don't cut code from programs you don't understand.

    sbit? You want to set or read status of individual GPIO pins of your LPC2148? Haven't you already seen how that is done by checking the sample applications (like "blinky") that Keil installs together with the compiler? Haven't you taken a look at the user manual for the processor, seeing what GPIO capabilities the processor has?

  • hi,

    basicaly i want to read data from external 8574 which is connect to port pin of lpc2148...
    i don't want to use internal i2c. But i was trying to use the old program that i have posted in my previous post..

    Will you plz tell me how to get data from external 8574 ic which is connected to 2 pins of lpc2148?

  • Basically, I would like you to answer me: did you read what I wrote?

    Have you found any part of the LPC2148 architecture that needs a bdata additional keyword?

    Have you found the "blinky" sample program or the user manual unable to explain how you read out GPIO pin state or sets pin state for the LPC2148?

    You want help. But what have _you_ done to try to figure out what the LPC2148 processor can do? Pasting code and getting a compilation error isn't exactly a big attempt from your side. If you want to program, then you must obviously also budget time for reading some documentation, and come back and ask questions when you are stuck, not able to understand something.

    You want to communicate using I2C - but without using any I2C hardware in the processor. Isn't that a quite big project for someone who don't manage to find the information how to set/get the pin state of a GPIO?

    What is your using for not using hardware I2C? That it forces you to learn how to use I2C with a LPC2148? Because the LPC2148 isn't pin compatible with a 8051 so you can't claim you already have existing hardware and just want to swap processor.