C

Memory-mapped I/O & registers

Në shqip: Regjistrat e harduerit

ShpjegimiSQ

Në mikrokontrollues, pajisjet (LED, kohëmatës, UART) kontrollohen duke shkruar në adresa të caktuara memorieje — „regjistra“. Në C, i arrin me pointer-ë volatile drejt atyre adresave.

EnglishEN

On microcontrollers, peripherals (LEDs, timers, UART) are controlled by writing to specific memory addresses — “registers”. In C you reach them through volatile pointers to those addresses.

Si ta mendosh

Si çelësat e dritave në një panel, ku çdo çelës ka adresën e vet.

Lexoje në anglisht

Like light switches on a panel, each with its own address.

Shembull kodic

#define GPIO_OUT (*(volatile uint32_t *)0x40020014)
GPIO_OUT |= (1u << 5);    // ndiz LED-in te pin 5

Terma të lidhur