Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ctboard:peripherals:gpio_cpld [2016/03/05 11:57] – [Programming Example] feurctboard:peripherals:gpio_cpld [2026/06/25 14:52] (current) – [Programming Example] scbj
Line 6: Line 6:
 > Supported [[ctboard:mode_switch|mode]]: **1** > Supported [[ctboard:mode_switch|mode]]: **1**
 \\ \\
 +
 +===== Registers =====
 +
 +==== Input ====
 +
 +\\ {{ ctboard_gpio_pinout.svg?300em}} 
 +   {{ctboard_gpio_input_reg.svg}} \\ \\
 +
 +==== Output ====
 +
 +The registers are read / write.
 +
 +\\ {{ctboard_gpio_output_reg.svg}} \\ \\
 +
 +===== Diagram =====
 +
 +\\ {{ctboard_gpio_cpld.svg}} \\ \\
  
 ===== Programming Example ===== ===== Programming Example =====
  
-The code snippet bellow shows how to use the GPIO.+The code snippets below show how to use the GPIO.
  
 <code c> <code c>
Line 24: Line 41:
 \\ \\
  
-<code asm+<code text
-ADDR_GPIO_IN    EQU      0x60000410 +.equ ADDR_GPIO_IN,   0x60000410 
-ADDR_GPIO_OUT   EQU      0x60000400+.equ ADDR_GPIO_OUT,  0x60000400
                                  
-                LDR      r0, =ADDR_GPIO_IN +        ldr     r0,  =ADDR_GPIO_IN 
-                LDRB     r1, [r0, #0]                 Read byte from P1. +        ldrb    r1,  [r0, #0]                 // Read byte from P1. 
-                LDRH     r1, [r0, #0]                 Read half word from P1 and P2. +        ldrw    r1,  [r0, #0]                 // Read half word from P1 and P2. 
-                LDR      r1, [r0, #0]                 Read word from all ports (P1..4).+        ldr     r1,  [r0, #0]                 // Read word from all ports (P1..4).
                                  
-                LDR      r0, =ADDR_GPIO_OUT +        ldr     r0,  =ADDR_GPIO_OUT 
-                STRB     r1, [r0, #2]                 Write byte of data to P3. +        strb    r1,  [r0, #2]                 // Write byte of data to P3. 
-                STRH     r1, [r0, #2]                 Write halfword of data to P3..4. +        strh    r1,  [r0, #2]                 // Write halfword of data to P3..4. 
-                STR      r1, [r0, #0]                 Write word of data to all ports (P1..4).+        str     r1,  [r0, #0]                 // Write word of data to all ports (P1..4).
 </code> </code>
 \\ \\
  
-===== Registers ===== 
- 
-==== Input ==== 
- 
-\\ {{ ctboard_gpio_pinout.svg?300em}}  
-   {{ctboard_gpio_input_reg.svg}} \\ \\ 
- 
-==== Output ==== 
- 
-The Registers are read / write. 
- 
-\\ {{ctboard_gpio_output_reg.svg}} \\ \\ 
- 
-===== Diagram ===== 
- 
-\\ {{ctboard_gpio_cpld.svg}} \\ \\ 
  • ctboard/peripherals/gpio_cpld.1457179070.txt.gz
  • Last modified: 2016/03/05 11:57
  • by feur