单片机引脚直接驱动LCD
这是我的程序:(因为刚刚开始用AVR,从最简单的开始,就直接用汇编了) Timer2用外接32768晶振提供时钟,整个系统耗电大约30微安。 ; lcddisplay.asm ; Test raw LCD display .include "m48def.inc" .org 0x0000 rjmp start .org OC2Aaddr rjmp isr_timer2 .org 0x0020 table: .DB 0b11101101, 0b00101000, 0b10110101, 0b10111001 .DB 0b01111000, 0b11011001, 0b11011101, 0b10101000 .DB 0b11111101, 0b11111001 start: ldi r16, 1 ldi r16, 1 ldi r16, 31 sts OCR2A, r16 ; preset compare A ldi r16,1 ldi r16, 1 ldi r16, 1 ser r16 out DDRD, r16 ; Port D output -- LCD segment control clr r5 ldi r16, 0x55 mov r6, r16 clr r7 clr r8 ldi r16, 9 mov r10, r16 mov r11, r16 mov r12, r16 mov r13, r16 dec r10 sei ; enable global interrupt ldi r16, (1 clr r2 iniw:sleep dec r2 brne iniw ldi r16, (1 nop nop clr r2 loop: nop nop sleep nop nop dec r2 dec r2 breq adjtime rjmp loop adjtime: ldi r17, 10 inc r10 cp r10, r17 brne updcount clr r10 inc r11 cp r11, r17 brne updcount clr r11 inc r12 cp r12, r17 brne updcount clr r12 inc r13 cp r13, r17 brne updcount clr r13 updcount: rcall calcor rjmp loop isr_timer2: clr r16 out DDRC, r16 ; float all COMx pins bst r4, 1 brts show34 bst r4, 0 brts show2 mov r0, r5 ldi r18, 1 rjmp sel show2: mov r0, r6 ldi r18, 1<1 rjmp sel show34: bst r4, 0 brts show4 mov r0, r7 ldi r18, 1<2 rjmp sel show4: mov r0, r8 ldi r18, 1<3 sel: bst r4, 2 brtc lcden com r0 com r16 lcden: out PORTC, r16 out PORTD, r0 out DDRC, r18 iext:inc r4 |
单片机引脚直接驱动LC 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)