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

how to setand clear all bit P1.15-P1.23

Hellow,
I used LPC 1768 microcontroller interface with LCD module pin P1.16-P1.23.
The information is sent to the LCD module. The problem is I can not set up all the incoming data signals simultaneously. Please give instructions to send the information to me.

thank you

Parents
  • Maybe you should help yourself by actually telling what problem you have. Setting up all incomming data signals simultaneously? Sorry, but it really isn't easy to understand what you mean with that. Incomming signals aren't setup by you - they are set up by the LCD. You are responsible for setting up the outgoing signals...

Reply
  • Maybe you should help yourself by actually telling what problem you have. Setting up all incomming data signals simultaneously? Sorry, but it really isn't easy to understand what you mean with that. Incomming signals aren't setup by you - they are set up by the LCD. You are responsible for setting up the outgoing signals...

Children
  • OK,
    now ,I connected a 16x2 character LCD for I know that it is very easy to connect.
    But the problem is to use the compiler's scheduler function of the PIN that is connected.
    To send the same one I use PIN is.
    P2.11 = RS.
    P2.13 = Enable.
    RW = 0 V.
    P1.16 - P1.23 = data.
    I want to control the order P1 pin 16 - P1 pin 23 at the same time only. Please give the right answer to solve the problem with me.

  • The compiler don't have any scheduler function.

    And it is still not obvious what you mean with "I want to control the order P1 pin 16 - P1 pin 23 at the same time only."

    If you read the datasheet for the processor - wich you obviously should - you would know that you can change the data direction of P1.16 .. P1.23 at the same time with the assign to a single register. And you would also know that you can assign new values - in a single register write - to P1.16..P1.23.

    Maybe you just don't like to read the processor documentation?

    The right answer, is that you should spend time reading the processor documentation. Only by doing that will you understand the processor functionality.

  • P1 pin 16 is Port1 bit 16 or P[1.16]
    P1 pin 23 is Port1 bit 23 or P[1.23]

    In the data sheet that can be set from 16 to 23 bits. At the same time, or simultaneously by a single set of instructions that are provided.

    FIOxSET2 Fast GPIO Port x output Set
    register 2. Bit 0 in FIOxSET2
    register corresponds to pin
    Px.16 … bit 7 to pin Px.23.
    8 (byte)
    R/W

    Now my problem is that I can not set up this function by using the compiler.

  • Of course you can. Why should the compiler not allow _you_ to write to these registers? You can either do it directly based on the information available in the processor user manual. But the more recommended (or at least quicker) way would be to use the variables/data types already available in LPC17xx.h - haven't you spent some time looking closer at that file? So where are you stuck?

    Note also that besides the SET and CLR registers (that can only writes ones or zeroes) you can also perform a direct write to all bits affected by a control register - or mask a subset of bisks before assigning values.

  • Here is the code that I wrote to their portfolio. However, because it makes the display slowly.
    I want to send command to port, all the bit at the same time.
    void sent_data(unsigned char data)
    { if(data & (1<<0)) LPC_GPIO1->FIOSET = (1<<16); else LPC_GPIO1->FIOCLR = (1<<16); if(data & (1<<1)) LPC_GPIO1->FIOSET = (1<<17); else LPC_GPIO1->FIOCLR = (1<<17); . . . LPC_GPIO1->FIOSET = (1<<23); else LPC_GPIO1->FIOCLR = (1<<23);

    }

    but the function not good because data transfer slowly.

  • So what you are saying is that you have _not_ read through the chapter about GPIO in the processur users manual. And you have also decided to ignore what I did write in my previous post and what I implied in my first post.

    Set and clear aren't the only operations supported by the GPIO of the LPC17xx processors. You can make a direct 8-bit assign to P1.16 .. P1.23 too. But you really do need to spend time reading the processor documentation. You will always fail to take advantage of the processor if you don't make sure you read through the user manual so you see what advanced features the processor has. There are no short cut available.