Телесистемы
 Разработка, производство и продажа радиоэлектронной аппаратуры
На главную   | Карта сайта | Пишите нам | В избранное
Требуется программист в Зеленограде
- обработка данных с датчиков; ColdFire; 40 тыс.
e-mail:jobsmp@pochta.ru

Телесистемы | Электроника | Конференция «Микроконтроллеры и их применение»

S1D13700F01

Отправлено Sergei_Ilchenko 12 марта 2007 г. 09:57
В ответ на: LCD PG320240WRF - как заставить работать??? отправлено mao 12 марта 2007 г. 02:59

InitDisplay:
push AF
push BC
push HL

ld A,40h ; Разбудим S1D13700F01 командой
out (ConRegDisp),A ;SYSTEM SET.

ld BC,0ffffh

InitDisplay_1:
nop
nop
nop
nop
nop

dec C
jr nz,InitDisplay_1

dec B
jr nz,InitDisplay_1

ld HL,System_set_cmd
call InitSeqDisp

ld HL,Scroll_cmd
call InitSeqDisp

ld HL,HDot_scr_cmd
call InitSeqDisp

ld HL,Overlay_cmd
call InitSeqDisp

ld HL,CursorForm_cmd
call InitSeqDisp

call ClearDisplay

ld HL,Display_ON_cmd
call InitSeqDisp

ld A,(CopyRegCommands)
and A,0f6h
or A,0ah ; Включение подсветки и растра.
out (RegCommands),A
ld (CopyRegCommands),A

xor A
ld (X),A
ld (Y),A

pop HL
pop BC
pop AF

ret


InitSeqDisp:
ld A,(HL)
out (ConRegDisp),A

inc HL

ld B,(HL)

inc HL

InitSeqDisp_1:
ld A,(HL)
out (DatRegDisp),A

inc HL

djnz InitSeqDisp_1

ret


System_set_cmd db 40h ; SYSTEM SET.
db 08h ; Количество параметров.
db 30h ; P1
db 87h ; P2
db 07h ; P3
db 27h ; P4
db 2bh ; P5
db 0efh ; P6
db 28h ; P7
db 00h ; P8

Scroll_cmd db 44h ; SCROLL.
db 03h ; Количество параметров.
db 00h ; P1
db 00h ; P2
db 0feh ; P3

HDot_scr_cmd db 5ah ; HDOT SCR.
db 01h ; Количество параметров.
db 00h ; P1

Overlay_cmd db 5bh ; OVLAY.
db 01h ; Количество параметров.
db 04h ; P1

CursorForm_cmd db 5dh ; CSRFORM.
db 02h ; Количество параметров.
db 07h ; P1
db 87h ; P2

Display_ON_cmd db 59h ; DISP ON
db 01h ; Количество параметров.
db 04h ; P1


ClearDisplay:
push AF
push BC
push HL

ld HL,CursorWGr_cmd
call InitSeqDisp

ld A,4ch
out (ConRegDisp),A

ld A,42h
out (ConRegDisp),A

ld C,240

xor A

ClearDisplay_1:
ld B,40

ClearDisplay_2:
out (DatRegDisp),A

djnz ClearDisplay_2

dec C
jr nz,ClearDisplay_1

pop HL
pop BC
pop AF

ret

CursorWGr_cmd db 46h
db 02h
db 00h
db 00h


PrintChar:
push AF
push BC
push DE
push HL

ld C,A

ld A,(X)
cp 28h

jr nc,PrintChar_2

ld A,(Y)
cp 0fh

jr nc,PrintChar_2

ld L,A ; HL=Y*640.
ld H,00h

sla L
sla L
sla L
sla L

sla L
rl H
sla L
rl H
sla L
rl H

push HL

sla L
rl H
sla L
rl H

pop DE

add HL,DE

ld A,(X) ; HL=HL+X
ld E,A
ld D,00h

add HL,DE

ld A,46h ; Установим позицию курсора.
out (ConRegDisp),A

ld A,L
out (DatRegDisp),A
ld A,H
out (DatRegDisp),A

ld A,4fh ; Установим направление курсора вниз.
out (ConRegDisp),A

ld A,42h
out (ConRegDisp),A

ld B,00h

sla C
rl B
sla C
rl B
sla C
rl B
sla C
rl B

ld HL,charset_8x16
add HL,BC

ld B,10h

PrintChar_1:
ld A,(HL)
out (DatRegDisp),A

inc HL

djnz PrintChar_1

ld A,(X)
inc A
ld (X),A

PrintChar_2:
pop HL
pop DE
pop BC
pop AF

ret


PrintString:
push AF
push HL

PrintString_1:
ld A,(HL)

and A
jr z,PrintString_5

cp 0ah
jr nz,PrintString_2

ld A,(Y)

cp 0fh
jr nc,PrintString_5

inc A
ld (Y),A

cp 0fh
jr nc,PrintString_5

jr PrintString_4


PrintString_2:
cp 0dh
jr nz,PrintString_3

xor A
ld (X),A

jr PrintString_4


PrintString_3:
call PrintChar

PrintString_4:
inc HL

jr PrintString_1

PrintString_5:
pop HL
pop AF

ret


Составить ответ | Вернуться на конференцию

Ответы


Отправка ответа
Имя*: 
Пароль: 
E-mail: 
Тема*:

Сообщение:

Ссылка на URL: 
URL изображения: 

если вы незарегистрированный на форуме пользователь, то
для успешного добавления сообщения заполните поле, как указано ниже:
отымите от 2 единицу:

Перейти к списку ответов | Конференция | Раздел "Электроника" | Главная страница | Карта сайта

Rambler's Top100 Рейтинг@Mail.ru
 
Web telesys.ru