I / O Ports | The first program | Microcontrollers from scratch #4

Опубликовано: 20 Октябрь 2024
на канале: Dmitriy Zabarilo
152,852
3.1k

I / O ports are the primary and only node through which the microcontroller interacts with external devices. Therefore, before writing the first program, you should learn how to configure the I / O ports of the microcontroller. For this purpose there are two registers: DDRx and PORTx. For example, if port B of the microcontroller needs to be set to output, then 0 should be written to the corresponding DDRB bit, and if to input - 1. By writing 0 or 1 to the PORTB register, this port pin B is set to high or low potential.