![]() ![]() If a pin is set to output (in the MODER register) then writing a 1 into the appropriate bit will drive the I/O pin high. In the Output Data Register (ODR) each bit represents an I/O pin on the port. So, for example, to configure pin 8 for output, we must write the value 01 into bits 16 and 17 in the MODER register (that is, bit 16 => 1, bit 17 => 0). ![]() 10 Alternative function (details configured via other registers).Output Data Register – Writing a ‘ 1‘ to the appropriate pin will generate voltage and writing a ‘ 0‘ will ground the pin.Įach port pin has four modes of operation, thus requiring two configuration bits per pin (pin 0 is configured using mode bits 0-1, pin 2 uses mode bits 2-3, and so on):.we want this pin to behave as an output pin. Mode Register – this defines, on a pin-by-pin basis what its function is, e.g.The LEDS are mapped to external pins 55-58 which maps internally onto GPIO Port D pins 8-11.įlashing the LEDs is fairly straightforward, at the port level there are only two registers we are interested in. The STM32F4 uses a port-based GPIO (General Purpose Input Output) model, where each port can manage 16 physical pins. The examples are based on a STM32F407 chip using the GNU Arm Embedded Toolchain. ![]() We all know the embedded equivalent of the “Hello, world!” program is flashing the LED, so true to form I’m going to use that as an example.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |