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:led [2016/02/11 07:26] feurctboard:peripherals:led [2026/06/25 15:13] (current) – [Programming Example] scbj
Line 1: Line 1:
 ====== LED ====== ====== LED ======
  
-On the CT Board are 32 LEDs mounted. They are arranged in 4 groups of 8 LEDs and are **"active-high"**. \\+The CT Board features 32 LEDs. They are arranged in 4 groups of 8 LEDs and are **"active-high"**. \\
 E.g. the LEDs are on if a logical **"1"** is written. \\ \\ E.g. the LEDs are on if a logical **"1"** is written. \\ \\
  
-> {{ctboard:ctboard_mode_1.svg?48px }} {{ctboard:ctboard_mode_2.svg?48px }} {{ctboard:ctboard_mode_3.svg?48px }} Please make sure the CT Board is in the correct mode. +> {{ctboard:ctboard_mode_1.svg?48px }} {{ctboard:ctboard_mode_2.svg?48px }} {{ctboard:ctboard_mode_3.svg?48px }} {{ctboard:ctboard_mode_4.svg?48px }} Please make sure the CT Board is in the correct mode. 
-> Supported [[ctboard:mode_switch|modes]]: **1**, **2**, **3** +> Supported [[ctboard:mode_switch|modes]]: **1**, **2**, **3**, **4**  
 +\\
  
 ===== Registers ===== ===== Registers =====
  
-The Registers are read / write.+The registers are read / write.
  
 \\ {{ctboard_led_reg.svg}} \\ \\ \\ {{ctboard_led_reg.svg}} \\ \\
Line 16: Line 17:
  
 \\ {{:ctboard:peripherals:ctboard_led.svg?700em}} \\ \\ \\ {{:ctboard:peripherals:ctboard_led.svg?700em}} \\ \\
 +
 +===== Programming Example =====
 +
 +The code snippets below show how to use the LEDs.
 +
 +<code c>
 +#include "reg_ctboard.h"
 +
 +CT_LED->BYTE.LED7_0 = (uint8_t) data_byte;            /* Write byte of data to LED7..0. */
 +CT_LED->HWORD.LED31_16 = (uint16_t) data_halfword;    /* Write half word of data to LED31..16. */
 +CT_LED->WORD = (uint32_t) data_word;                  /* Write word of data to all LEDs. */
 +</code>
 +\\
 +
 +<code text>
 +.equ ADDR_LED,       0x60000100
 +
 +        ldr     r0,  =ADDR_LED
 +        strb    r1,  [r0, #0]        // Write byte of data to LED7..0.
 +        strh    r1,  [r0, #2]        // Write half word of data to LED31..16. */
 +        str     r1,  [r0, #0]        // Write word of data to all LEDs. */
 +</code>
 +\\
 +
  • ctboard/peripherals/led.1455175591.txt.gz
  • Last modified: 2016/02/11 07:26
  • by feur