This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Set IO through a register

I want to use the register of Nordic's P0 port directly to set 1 or clear 0. Like this,

p_reg-> OUTCLR = clr_mask;

P_reg - & gt; OUTSET = set_mask;

p_reg-> OUTCLR = 20;

P_reg - & gt; OUTSET = 20;

But it can't be done. Show me how to do it thanks!

Parents Reply Children
  • Did you configure pin as output? Could you show your complete code? 

  • I want to improve the driving capability of the 52840 drive LCD screen.

    To make the LCD display faster, I defined each pin like this

    # define RESET NRF_GPIO_PIN_MAP (0, 8)

    # define CSP NRF_GPIO_PIN_MAP (0, 7)

    # define RSP NRF_GPIO_PIN_MAP (0, 6)

    # define WRP NRF_GPIO_PIN_MAP (0, 5)

    # define RDP NRF_GPIO_PIN_MAP (0, 4)

    # define RESET_H () nrf_gpio_pin_set (RESET)

    # define RESET_L () nrf_gpio_pin_clear (RESET)

    I want to set nrF_GPIO_pin_set (RESET) and NRF_GPIo_pin_clear (RESET)

    Is it possible to increase the execution speed by switching to registers?

    Or in assembly language?

    static void SPI_WriteCmd8Bit( uint8_t CByte )

    {

    NRF_GPIO_Type *p_reg=NRF_P0;

    uint32_t value=0;

    RSP_L (); // NRF_P0-> OUTCLR = (1 < < RSP); This will stop the program from executing

    RDP_H (); // NRF_P0-> OUTSET = (1 < < RDP); This will stop the program from executing

    value = p_reg-> OUT;

    value &= ~(0xFF< < 24);

    value |= (CByte< < 24);

    p_reg-> OUT = value;

    WRP_L (); // NRF_P0-> OUTCLR = (1 < < WRP);

    WRP_H (); // NRF_P0-> OUTSET = (1 < < WRP);

    }

    Can you help my mom?

     

  • As I understand, it's a low-resolution LCD with parallel interface? if so, I don't think you can get any speed boost with direct register writing.

Related