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
  • 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.

Reply
  • 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.

Children
  • 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.