реклама на сайте
подробности

 
 
> Сопряжение ATmega88 и ЖК WH2004L, не удается запустить процесс инициализации ;(
Liss
сообщение Mar 6 2007, 23:17
Сообщение #1





Группа: Новичок
Сообщений: 8
Регистрация: 6-03-07
Пользователь №: 25 916



Здравствуйте, опытные специалисты и не очень wink.gif
Подскажите, пожалуйста, что может быть неправильного в приведенной ниже программульке в процессе инициализации ЖКИ WH2004L.
замучался просто, сколько не переписывал программу, индикатор, как неживой ;(
Описание ЖК здесь...Прикрепленный файл  WH2004L.pdf ( 424.36 килобайт ) Кол-во скачиваний: 596

Заранее благодарю.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;ATmega88 - 20MHz ;;;
;;;PD0-PD7= DB0-DB7 ;;;
;;;PB1=E ;;;
;;;PC4=RS ;;;
;;;PC5=R/W ;;;
;;;?E WH2004L 20x4 ;;;
;;;8bit ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

.include "m88def.inc"

.def tmp=r16
.def tmp1=r17

ldi tmp, high(ramend)
out SPH, tmp
ldi tmp, low(ramend)
out SPL, tmp
main:
ldi tmp,$ff ; PORT D,B,C
out DDRD,tmp ; Vyvody
out DDRB,tmp ;
out DDRC,tmp ;
startinit_LCD:
rcall delay_40ms
ldi tmp,$30 ; 8 bit interface, 2stroki, 5x8
rcall DispCmd
rcall Delay_40us
ldi tmp,$30 ; 8 bit interface, 2stroki, 5x8
rcall DispCmd
rcall Delay_40us
ldi tmp,$F ; aee??eou ?EE. aee??eou eo?ni?, naaeaou aai ieaa?uei
rcall DispCmd
rcall Delay_40us
ldi tmp,1 ; Display clear
rcall DispCmd
rcall Delay_1_6ms
ldi tmp,6 ; onoaiiaea iai?aaeaiey naaeaa eo?ni?a ai?aai
rcall dispcmd
rcall delay_40us
; end startinit_LCD
ldi tmp,$38 ; 8 bit interface, 2stroki, 5x8
rcall DispCmd
rcall Delay_40us
ldi r18,$30
next: rcall DispData
rcall delay_40us
inc r18
cpi r18,$40
brne next
end: rjmp end

delay_40us:
ldi tmp,2
label2:
ldi tmp1,133
label1:
dec tmp1
brne label1
dec tmp
brne label2
ret
delay_40ms:
ldi tmp,255
label4:
ldi tmp1,255
label3:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
dec tmp1
brne label3
dec tmp
brne label4
ret
delay_1_6ms:
ldi tmp,10
label6:
ldi tmp1,255
label5:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
dec tmp1
brne label5
dec tmp
brne label6
ret
DispCmd:
cbi PORTB, 1 ; RS = 0 - commandy
sbi PORTC, 5 ; E = 1
nop
out PORTD, tmp
nop
nop
nop
cbi PORTC, 5 ;E=0 strob
nop
out PORTD,tmp
nop
nop
nop
nop
nop
nop
nop
nop
sbi PORTC,5
ret
Dispdata:
sbi PORTB, 1 ; RS = 1 - dannye
sbi PORTC, 5 ; E = 1
nop
out PORTD, tmp
nop
nop
nop
cbi PORTC, 5 ;E=1 strob
nop
out PORTD,tmp
nop
nop
nop
nop
nop
nop
nop
nop
sbi PORTC,5
ret
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 19th July 2025 - 12:58
Рейтинг@Mail.ru


Страница сгенерированна за 0.01365 секунд с 7
ELECTRONIX ©2004-2016