This is done using the _delay_ms() function from which in turn needs the F_CPU macro in order to adjust the cycle counts. The function delay_1s() suspends program execution for approximately one second. from/to a PC running a terminal program), while the lcd_str stream provides a method to display character data on the LCD text display. The stream uart_str corresponds to input and output operations performed over the RS-232 connection to a terminal (e.g. Those functions that are not required by the specified intent (like the input function for lcd_str which is specified to only perform output operations) can be given as NULL. This initializer macro takes three arguments, two function macros to connect the corresponding output and input functions, respectively, the third one describes the intent of the stream (read, write, or both). The initialization is done using the FDEV_SETUP_STREAM() initializer template macro, so a static object can be constructed that can be used for IO purposes. The definitions of uart_str and lcd_str set up two stdio streams. That needs to be kept in mind when debugging, because the inlining might cause the debugger to "jump around wildly" at a first glance when single-stepping. As this function is declared to be module-internal only ( static), the compiler will notice its simplicity, and with a reasonable optimization level in effect, it will inline that function. The function ioinit() summarizes all hardware initialization tasks. The main reason is that this file defines the value of F_CPU which needs to be known before including. While conventionally, system header files (those in angular brackets ) go before application-specific header files (in double quotes), defines.h comes as the first header file here. uart.h Interface declarations for the UART driverĪs usual, include files go first.uart.c Implementation of a character IO driver for the internal UART.lcd.h Interface declarations for the LCD driver.lcd.c Implementation of LCD character IO on top of the HD44780 driver.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |