本帖最后由 ddllxxrr 于 2015-12-20 07:36 编辑
今天 这个程序不是例程,是一步一步建立的ASF工程
首先建立ASF工程,然后添加LCDcontroller driver (driver)
然后在ASF EXPLORER中打开快速开始文档。根据提示添加完整需要的模块:
根据文档提示形成程序:
- #include <asf.h>
- void lcd_init(void)
- {
- lcd_clk_init();
- // Glass connection no COM swap, no SEG swap, use 40 seg line,
- lcd_connection_init(false, false, 40, false);
- // LCD waveform timing configuration:
- // - Divide LCD source clock module (ULP) by 16
- // - 4 divider of the prescaled clock source
- // - Configure LCD module to generate low power mode
- // - Duty cycle (operating mode) applied to the LCD.
- lcd_timing_init(LCD_PRESC_16_gc, LCD_CLKDIV_DivBy4_gc,
- LCD_LP_WAVE_ENABLE_gc, 4);
- // Configure blink rate
- lcd_blinkrate_init(LCD_BLINKRATE_2Hz_gc);
- lcd_enable();
- }
- int main (void)
- {
- /* Insert system clock initialization code here (sysclk_init()). */
- sysclk_init();
- board_init();
- lcd_init();
-
- const uint8_t alpha_text[]="HELLO AVR";
- const uint8_t num_text[]="1234";
- lcd_set_pixel(1,0);
- lcd_set_blink_pixel(2,0);
- lcd_write_packet(LCD_TDG_14S_4C_gc, FIRST_14SEG_4C, alpha_text, \
- WIDTH_14SEG_4C, DIR_14SEG_4C);
- lcd_write_packet(LCD_TDG_7S_4C_gc, FIRST_7SEG_4C, num_text, \
- WIDTH_7SEG_4C, DIR_7SEG_4C);
- uint16_t result = adc_get_result(&ADCA, ADC_CH0);
-
- }
这个程序很好懂一行显示字符一行显示数字。
|