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

Using LCD and LED_Block at the same time

Hello, i'm working on a project where I have to use the LCD and two LEDs at the same time.

LCD is commonly on Port 3. So the LEDS are !
LCD will use 7 bits from the port 3, and both LEDs will use one bit each.

The problem is that the port is 8-bit.

Can I use the LCD on another port, for the example Port 1 ? (Silicion laboratories tells that we should use 4 bits of data on the Port 1). If it is effectively possible, how should I proceed ?

Or, can I use LEDs on another port ? Then, how to initialize the port to handle the LED_Block.

Parents Reply Children
  • can you be more explicit please ??
    an example would be welcomed.

    I 'm a novice, I know...

  • if you want LCD data on Px, then
    asm:
    mov Px,variable_that_hold_data_to_ be outpout
    c:
    Px = variable_that_hold_data_to_ be outpout;

    Erik


    PS if you are asking: how do I make some code I have change the port it uses, post the code, It is almost as if you think that all LCDs are connected to the same port

  • This is my problem, I want to use 2 LEDs and the LCD, but my LEDs work on port 3 and the LCD too. I have to use 9 pins, but I have only 8. So I tried to use port 1 but it doesn't work...

    sbit LCD_D7 = P1^7;
    sbit LCD_D6 = P1^6;
    sbit LCD_D5 = P1^5;
    sbit LCD_D4 = P1^4;
    sbit LCD_EN = P3^2;
    sbit LCD_RW = P3^1;
    sbit LCD_RS = P3^0;

    sbit LED0 = P3^3 ;
    sbit LED1 = P3^4 ;

    PRT0CF |= 0x40; // Enable TX0 as a push-pull output

    PRT1CF |= 0x40; // Enable P1.6 (LED) as push-pull output

    PRT2CF = 0x00; // Enable Port2 as input
    P2= 0xff;

    PRT3CF = 0xff; // Enable Port3 as push-pull output


    I'm sorry but I'm really a beginner with C8051...

  • sbit LCD_D7 = P1^7;
    sbit LCD_D6 = P1^6;.........

    I doubt data is moved to the LCD bitwise

    PRT0CF |= 0x40; // Enable TX0 as a push-pull output

    This does not exist on a standard '51 what derivative fdo you use.

    "in my previous post I asked: "if you are asking: how do I make some code I have change the port it uses, post the code"

    There is no such in your answer.