Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| ctboard:peripherals:dipsw [2016/01/26 09:55] – feur | ctboard:peripherals:dipsw [2022/12/27 16:38] (current) – [Registers] ruan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | > Please make sure the CT Board is in the correct mode. {{ ctboard_mode_3.svg?64px}} {{ ctboard_mode_2.svg? | + | The CT Board features 32 DIP switches. They are arranged in 4 groups of 8 DIP switches. \\ |
| - | > Supported modes: **1**, **2**, **3** | + | If a DIP switch |
| - | > | + | |
| + | > {{ctboard: | ||
| + | > Supported | ||
| + | \\ | ||
| + | |||
| + | ===== Registers ===== | ||
| + | |||
| + | The registers are read only. | ||
| + | |||
| + | \\ {{ctboard_dipsw_reg.svg}} \\ \\ | ||
| + | |||
| + | ===== Diagram ===== | ||
| + | |||
| + | \\ {{: | ||
| + | |||
| + | ===== Programming Example ===== | ||
| + | |||
| + | The code snippets below show how to use the DIPSW. | ||
| + | |||
| + | <code c> | ||
| + | #include " | ||
| + | |||
| + | uint8_t data_byte = CT_DIPSW-> | ||
| + | uint16_t data_hword = CT_DIPSW-> | ||
| + | uint32_t data_word = CT_DIPSW-> | ||
| + | </ | ||
| + | \\ | ||
| + | |||
| + | <code asm> | ||
| + | ADDR_DIPSW | ||
| + | |||
| + | LDR r0, =ADDR_DIPSW | ||
| + | LDRB r1, [r0, #0] ; Read byte from S7..0. | ||
| + | LDRH r1, [r0, #2] ; Read half word from S31..16. | ||
| + | LDR r1, [r0, #0] ; Read all DIPSW at once into a word. | ||
| + | </ | ||
| + | \\ | ||