Writing Data to GPIO Output Pins - Writing Data to GPIO Output Pins - 1.15 English - UG585

Zynq 7000 SoC Technical Reference Manual (UG585)

Document_ID
UG585
Release_Date
2026-02-06
Version
1.15 English
For GPIO pins configured as outputs, there are two options to program the desired value.
Option 1
Read, modify, and update the GPIO pin using the gpio.DATA_0 register.
Example
Set GPIO output pin 10 using the DATA_0 register.
  1. Read the gpio.DATA_0 register: Read gpio.DATA_0 register to the reg_val variable.
  2. Modify the value: Set reg_val [10] =1.
  3. Write updated value to output pin: Write reg_val to the gpio.DATA_0 register.
Option 2
Use the MASK_DATA_x_MSW/LSW registers to update one or more GPIO pins.
Example
Set output pins 20, 25, and 30 to 1 using the MASK_DATA_0_MSW register.
  1. Generate the mask value for pins 20, 25, and 30: To drive pins 20, 25 and 30, 0xBDEF is the mask value for gpio.MASK_DATA_0_MSW [MASK_0_MSW].
  2. Generate the data value for pins 20, 25, 30: To drive 1 on pins 20, 25, and 30, 0x4210 is the data value for gpio.MASK_DATA_0_MSW [DATA_0_MSW].
  3. Write the mask and data to the MASK_DATA_x_MSW register: Write 0xBDEF_4210 to the gpio.MASK_DATA_0_MSW register.