+ All Categories
Home > Education > Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Date post: 10-Jul-2015
Category:
Upload: sashko-krstevski
View: 72 times
Download: 3 times
Share this document with a friend
167
МИКРОПРОЦЕСОРИ И МИКРОКОНТРОЛЕРИ Контрола на лифт со две кабини со користење на микропроцесор на микропроцесор Intel 8085 Кандидат: Сашко Крстевски 161 Ментор: Проф. д-р Цветко Митровски Битола, 2014 Презентацијата претставува истражување кое може да се применува исклучиво за образовни цели. За поширока примена, потребни се дополнителни истражувања, дополнувања, измени и тестови.
Transcript
Page 1: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

МИКРОПРОЦЕСОРИ И

МИКРОКОНТРОЛЕРИ

Контрола на лифт со две кабини со користење

на микропроцесорна микропроцесор

Intel 8085

Кандидат:Сашко Крстевски 161

Ментор:

Проф. д-р Цветко Митровски

Битола, 2014

Презентацијата претставува истражување кое може да се применува исклучиво за образовни цели.За поширока примена, потребни се дополнителни истражувања, дополнувања, измени и тестови.

Page 2: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

БЛОК ДИЈАГРАМ

Page 3: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

БЛОК ДИЈАГРАМ

IF картица – централна картица која креира одвоен интерфејс кон FIF и EIF картиците

Page 4: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

БЛОК ДИЈАГРАМ

IF картица – централна картица која креира одвоен интерфејс кон FIF и EIF картиците

CPU картица – извршување на главната програма

Page 5: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

БЛОК ДИЈАГРАМ

IF картица – централна картица која креира одвоен интерфејс кон FIF и EIF картиците

CPU картица – извршување на главната програма

ECC картица – контрола на електричните мотори

Page 6: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

БЛОК ДИЈАГРАМ

IF картица – централна картица која креира одвоен интерфејс кон FIF и EIF картиците

CPU картица – извршување на главната програма

ECC картица – контрола на електричните мотори

EIF картица – обработка на сигналите од катовите (копчиња) и приказ за корисникот (дисплеи)

Page 7: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

БЛОК ДИЈАГРАМ

IF картица – централна картица која креира одвоен интерфејс кон FIF и EIF картиците

CPU картица – извршување на главната програма

ECC картица – контрола на електричните мотори

EIF картица – обработка на сигналите од катовите (копчиња) и приказ за корисникот (дисплеи)

FIF картица – обработка на сигнали од кабината и потврдување на состојбата на копчињата

Page 8: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

00000 C om m and D ata C R C

Header

Req/R

es

C ab in N um beror

N ode address

КОМУНИКАЦИЈА

8b 8b 8b 8b40b

r sp N ode address

8b1b 5b2b

Поле Значење

Header Почеток на порака

Request/Response Барање или одговор

N/A 00000 - неискористени

Cabine_number/Node_address Број на кабина и/или адреса на јазол (256)

Command Наредба

Data Податок (за наредбата)

CRC Checksum

Page 9: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

КОМУНИКАЦИЈА

Наредба Код Податок Значење Насока

start_motor 0x40 Cab. number Да започне моторот со работа CPU � ECC

slow_down_motor 0x41 Cab. number Моторот да ја намали брзината CPU � ECC

speed_up_motor 0x42 Cab. number Моторот да ја зголеми брзината CPU � ECC

stop_motor 0x43 Cab. number Да запре моторот со работа CPU � ECC

find_cabine 0x44 Level На кој кат се наоѓа кабината bothfind_cabine 0x44 Level На кој кат се наоѓа кабината both

Наредба Код Податок Значење Насока

calc_closest_cabine 0x10 Level Која кабина да стигне до корисникот IF � CPU

stop_sys_err 0x11 Да се запре системот, настаната е грешка both

cpu_error 0x12 Грешка во CPU картицата CPU � IF

start_sys 0x13 Да започне системот со работа CPU � IF

stop_sys 0x14 Да запре системот со работа CPU � IF

closest_cabine 0x15 1 or 2 Одговор на пораката calc_closest_cabine CPU � IF

ping_if 0x16 Проверка на IF картицата CPU � IF

test_equ 0x17 Тест на опремата CPU � IF

check_srvc_days 0x18 Проверка кога треба да се изврши сервис CPU � IF

Комуникација CPU-ECC

Комуникација CPU-IF и IF-CPU

Page 10: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

ПРЕСМЕТКА

кадешто:

cbn – closest cabin number (број на кабината која ќе стигне најбрзо до одредиштето)

Формирањето и пресметката на одговорот

cbn – closest cabin number (број на кабината која ќе стигне најбрзо до одредиштето)

nl – next level (кат кон кој моментално се движи кабината)

cl – current level (кат на кој моментално се наоѓа кабината)

rl – requested level (кат – одредиште)

Page 11: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

}

}}

CPU

8085A

RAM

8155

Decoder

ЕЛЕКТРОНСКА ШЕМА

}

}

}EPROM

8755

RS-485

USART (RS-232)

Page 12: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Сигналите/Линиите во микропроцесорот 8085:

•Сигнали за напојување и фреквенции

•Податочни и адресни магистрали

•Управувачка/контролна магистрала

ЕЛЕКТРОНСКА ШЕМА

•Управувачка/контролна магистрала

•Сигнали за прекини

•Сериски I/O сигнали

•DMA сигнали (меморија со директен пристап)

•Сигнали за ресет

Page 13: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Функционални блокови:

•Регистри

•Аритемтичко-логичка едница (ALU)

•Адресен бафер

•Леч коло за инкрементирање/декрементирање на адреса

•Контрола на прекини

ЕЛЕКТРОНСКА ШЕМА

•Контрола на прекини

•Контрола/управување на сериски I/O порти

•Електронски кола за контрола и тајминзи

•Декодер на инструкции и енкодер на машинските циклуси

Page 14: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

ЕЛЕКТРОНСКА ШЕМА

Статична меморија: RАМ Intel 8155 – 2kb Меморија за чување на параметри: EPROM Intel 8775 – 16kb

Page 15: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

ЕЛЕКТРОНСКА ШЕМА

RS-232 примопредавател RS-485 конвертoр

Page 16: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

ЕЛЕКТРОНСКА ШЕМА

Page 17: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

� EPROM (8755)

hex 0 1 2 3 4 5 6 7 8 9 A B C D E F

4000 10 11 12 13 14 15 16 17 18 00 00 00 00 00 00 00

4010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

4020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

4030 40 41 42 43 00 00 00 00 00 00 00 00 00 00 00 00

4040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

4050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

4060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

4070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

ОРГАНИЗАЦИЈА НА МЕМОРИЈАТА

4070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

4080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

4090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

40A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

40B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

40C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

40D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

40E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

40F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Мемориски опсег Искористено за Променлива

4000h – 402Fh Наредби за работа со IF картицата /

4030h – 405Fh Наредби за работа со ECC картицата /

Page 18: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

� RAM (8155)

hex 0 1 2 3 4 5 6 7 8 9 A B C D E F

2000 10 11 12 13 14 15 16 17 18 00 00 00 00 00 00 00

2010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2030 40 41 42 43 00 00 00 00 00 00 00 00 00 00 00 00

2040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Мемориски опсег Искористено за Променлива

2000h – 202Fh Наредби за работа со IF картицата /

2030h – 205Fh Наредби за работа со ECC картицата /

2060h – 2064h Формирање на порака /

2070h – 2074h Примање на порака /

2080h Локација кон која се движи кабина 1 r_cabin_01

ОРГАНИЗАЦИЈА НА МЕМОРИЈАТА

2070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

20A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

20B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

20C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

20D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

20E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

20F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2081h Локација кон која се движи кабина 2 r_cabin_02

2082h Број на катови од кабина 1 до бараниот кат r_diff_cabin_01

2083h Број на катови од кабина 2 до бараниот кат r_diff_cabin_02

2084h Кат на кој се наоѓа кабина 1 (моментално) r_curr_cabin_01

2085h Кат на кој се наоѓа кабина 2 (моментално) r_curr_cabin_02

2090h Код На CPU грешка (грешка во CPU картица) r_cpu_err_adr

2091h Код на системска грешка r_sys_err_adr

20A0h Бројач за примена порака rx_msg_counter

Page 19: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 20: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

start: nop

; read parameters form the EPROM memory

; - read available messages

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

Page 21: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

start: nop

; read parameters form the EPROM memory

; - read available messages

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PC

Page 22: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

Page 23: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

read_8755:

DI ; disable interrupts

LXI H, 4000h

MOV L, C ; the address to read from ROM

MOV A, M ; load the data into reg. A

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

MOV A, M ; load the data into reg. A

ret

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

write_8155:

DI ; disable interrupts

LXI H, 2000h

MOV L, C ; the address to write to RAM

MOV M, A ; write data to memory location

ret

Page 24: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counter

PC

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

Page 25: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

PC

read_8755:

DI ; disable interrupts

LXI H, 4000h

MOV L, C ; the address to read from ROM

MOV A, M ; load the data into reg. A

Формрање на адреса за читате од EPROM:

Поставување на адресните пинови (адресирање на 8755)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

MOV A, M ; load the data into reg. A

ret

Page 26: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

PC

read_8755:

DI ; disable interrupts

LXI H, 4000h

MOV L, C ; the address to read from ROM

MOV A, M ; load the data into reg. A

Формрање на адреса за читате од EPROM:

Поставување на адресните пинови (адресирање на 8755)

Поставување на адреса на мемориска локација за читање

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

MOV A, M ; load the data into reg. A

ret

Page 27: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

PC

read_8755:

DI ; disable interrupts

LXI H, 4000h

MOV L, C ; the address to read from ROM

MOV A, M ; load the data into reg. A

Формрање на адреса за читате од EPROM:

Поставување на адресните пинови (адресирање на 8755)

Поставување на адреса на мемориска локација за читање

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC MOV A, M ; load the data into reg. A

ret

Page 28: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Формрање на адреса за читате од EPROM:

Поставување на адресните пинови (адресирање на 8755)

Поставување на адреса на мемориска локација за читање

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 29: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Формрање на адреса за читате од EPROM:

Читање на податок од мемориска локација

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 30: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

PC

read_8755:

DI ; disable interrupts

LXI H, 4000h

MOV L, C ; the address to read from ROM

MOV A, M ; load the data into reg. A

Формрање на адреса за читате од EPROM:

Читање на податок од EPROM (8755)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC MOV A, M ; load the data into reg. A

ret

Page 31: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

PC

write_8155:

DI ; disable interrupts

LXI H, 2000h

MOV L, C ; the address to write to RAM

MOV M, A ; write data to memory location

Формрање на адреса за запишување во RAM:

Поставување на адресните пинови (адресирање на 8155)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

MOV M, A ; write data to memory location

ret

Page 32: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

PC

write_8155:

DI ; disable interrupts

LXI H, 2000h

MOV L, C ; the address to write to RAM

MOV M, A ; write data to memory location

Формрање на адреса за запишување во RAM:

Поставување на адресните пинови (адресирање на 8155)

Поставување на адреса на мемориска локација за запишување

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

MOV M, A ; write data to memory location

ret

Page 33: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

PC

write_8155:

DI ; disable interrupts

LXI H, 2000h

MOV L, C ; the address to write to RAM

MOV M, A ; write data to memory location

Формрање на адреса за запишување во RAM:

Поставување на адресните пинови (адресирање на 8155)

Поставување на адреса на мемориска локација за запишување

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC MOV M, A ; write data to memory location

ret

Page 34: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Формрање на адреса за запишување во RAM:

Поставување на адресните пинови (адресирање на 8155)

Поставување на адреса на мемориска локација за запишување

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 35: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Формрање на адреса за запишување во RAM:

Запишување на податок во мемориска локација

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 36: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

PC

write_8155:

DI ; disable interrupts

LXI H, 2000h

MOV L, C ; the address to write to RAM

MOV M, A ; write data to memory location

Формрање на адреса за запишување во RAM:

Запишување на податoк во RAM

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC MOV M, A ; write data to memory location

ret

Page 37: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counterPC

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

PC

Page 38: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counter

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

PC

Page 39: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counter

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

PC

Page 40: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counter

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

PC

Page 41: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counter

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

PC

Page 42: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counter

PC

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

Page 43: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counter

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

PC

Page 44: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

read_cmds_EPROM2RAM:

DI ; disable interrupts

MVI B, 60h ; load 96 commands constant

MVI C, 00h ; init 96 commands counter

read_rom_to_ram:

call read_8755

call write_8155

INR C ; increment the command counter

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

INR C ; increment the command counter

MOV A, B ; copy the data from B to A

CMP C ; compare if all cmd locations are copied

JNZ read_rom_to_ram

EI ; enable interrupts

ret

PC

Page 45: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Намена на регистри:

A – податокот од важност

B – константа, број на податоци за читање

C – бројач за прочитани податоци (наредби)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 46: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

start: nop

; read parameters form the EPROM memory

; - read available messages

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PC

Page 47: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

PCinit_8251: DI ; disable interrupts

LXI H, 06800h ; address for the 8251: CS = 0 and C/D = 1 (Control)

MVI A, 00h

MOV M, A ; write 00 to memory location 6800 (to set the address lines to 6800, only)

OUT 068h

OUT 068h ; dummy mode word

OUT 068h

MVI A, 40h ; reset command word

OUT 068h ; reset 8251

MVI A, 4Ah ; mode word initialization (1 stop bit, no parity, char length 7, baud rate x 16)

OUT 068h ; send the mode word

MVI A, 15h ; word to enable the transmitter and the receiver of the 8251

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

MVI A, 15h ; word to enable the transmitter and the receiver of the 8251

OUT 068h

check_RxRDY: IN 068h ; get 8251 status register value - check if RxRDY = 1

ANI 02h ; check the value of the RxRDY (reg A AND 02H)

JZ check_RxRDY ; jump to check_RxRDY if the receiver is not ready

check_TxRDY: IN 0FFh ; get 8251 status register value - check if TxRDY = 1

ANI 01h ; check if the transmitter is ready

JZ check_TxRDY ; jump to check_TxRDY if the transmitter is not ready

; set 8251 to transmit mode

LXI H, 07000h ; address for the 8251: CS = 0 and C/D = 0 (Data - Transmitter)

MVI A, 00h

MOV M, A ; write 00 to memory location 7000 (to set the address lines to 7000, only)

EI ; enable interrupts

ret

Page 48: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Формрање на адреса за запишување во контролниот регистар:

Поставување на адресни линии

PC

init_8251: DI ; disable interrupts

LXI H, 06800h ; address for the 8251: CS = 0 and C/D = 1 (Control)

MVI A, 00h

MOV M, A ; write 00 to memory location 6800 (to set the address lines to 6800, only)

...

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 49: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Формрање на адреса за запишување во контролниот регистар:

Поставување на адресни линии

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 50: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 51: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

PC

MVI A, 40h ; reset command word

OUT 068h ; reset 8251

Запишување во контролниот регистар:

Ресетирање на ИК (Internal Reset)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 52: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Запишување во контролниот регистар:

Ресетирање на ИК (Internal Reset)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 53: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor
Page 54: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

PC

...

MVI A, 4Ah ; mode word initialization (1 stop bit, no parity, char length 7, baud rate x 16)

OUT 068h ; send the mode word

...

Запиушвање во Mode регистарот:

Поставување на мод на работа

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 55: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Запиушвање во Mode регистарот:

Поставување на мод на работа

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 56: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor
Page 57: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

PC

...

MVI A, 15h ; word to enable the transmitter and the receiver of the 8251

OUT 068h

...

Запишување во контролниот регистар:

Овозможување на работа како примо-предавател

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 58: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Запишување во контролниот регистар:

Овозможување на работа како примо-предавател

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 59: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor
Page 60: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

PC...

check_RxRDY: IN 068h ; get 8251 status register value - check if RxRDY = 1

ANI 02h ; check the value of the RxRDY (reg A AND 02H)

JZ check_RxRDY ; jump to check_RxRDY if the receiver is not ready

...

Читање на статусниот регистар:

Проверка на статусот на примникот

PC+2

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 61: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Читање на статусниот регистар:

Проверка на статусот на примникот

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 62: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor
Page 63: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

...

check_TxRDY: IN 0FFh ; get 8251 status register value - check if TxRDY = 1

ANI 01h ; check if the transmitter is ready

JZ check_TxRDY ; jump to check_TxRDY if the transmitter is not ready

...

Читање на статусниот регистар:

Проверка на статусот на предавателот

PC

PC+2

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 64: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Читање на статусниот регистар:

Проверка на статусот на предавателот

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 65: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor
Page 66: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

...

; set 8251 to transmit mode

LXI H, 07000h ; address for the 8251: CS = 0 and C/D = 0 (Data - Transmitter)

MVI A, 00h

MOV M, A ; write 00 to memory location 7000 (to set the address lines to 7000, only)

EI ; enable interrupts

ret

Формрање на адреса за поставување на ИК 8251 како предавател:

Поставување на адресни линии

PCPC+3PC+2PC+1

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 67: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Формрање на адреса за поставување на ИК 8251 како предавател:

Поставување на адресни линии

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 68: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor
Page 69: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

init_8251: DI ; disable interrupts

LXI H, 06800h ; address for the 8251: CS = 0 and C/D = 1 (Control)

MVI A, 00h

MOV M, A ; write 00 to memory location 6800 (to set the address lines to 6800, only)

OUT 068h

OUT 068h ; dummy mode word

OUT 068h

MVI A, 40h ; reset command word

OUT 068h ; reset 8251

MVI A, 4Ah ; mode word initialization (1 stop bit, no parity, char length 7, baud rate x 16)

OUT 068h ; send the mode word

MVI A, 15h ; word to enable the transmitter and the receiver of the 8251

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

MVI A, 15h ; word to enable the transmitter and the receiver of the 8251

OUT 068h

check_RxRDY: IN 068h ; get 8251 status register value - check if RxRDY = 1

ANI 02h ; check the value of the RxRDY (reg A AND 02H)

JZ check_RxRDY ; jump to check_RxRDY if the receiver is not ready

check_TxRDY: IN 0FFh ; get 8251 status register value - check if TxRDY = 1

ANI 01h ; check if the transmitter is ready

JZ check_TxRDY ; jump to check_TxRDY if the transmitter is not ready

; set 8251 to transmit mode

LXI H, 07000h ; address for the 8251: CS = 0 and C/D = 0 (Data - Transmitter)

MVI A, 00h

MOV M, A ; write 00 to memory location 7000 (to set the address lines to 7000, only)

EI ; enable interrupts

ret

Page 70: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

start: nop

; read parameters form the EPROM memory

; - read available messages

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PC

Page 71: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

init_system_vars:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

ret

Запишување на почетна вредност (reset) на покажувачот кон

мемориската локација на првиот бајт на новата порака:

Поставување на адресни линии

PCPC+3

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 72: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

init_system_vars:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

ret

Запишување на почетна вредност (reset) на покажувачот кон

мемориската локација на првиот бајт на новата порака:

Поставување на адресни линии

PCPC+3

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 73: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Запишување на почетна вредност (reset) на покажувачот кон

мемориската локација на првиот бајт на новата порака:

Поставување на адресни линии

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 74: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

Запишување на почетна вредност (reset) на покажувачот кон

мемориската локација на првиот бајт на новата порака:

Поставување на адресни линии

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 75: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

init_system_vars:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

ret

Запишување на почетна вредност (reset) на покажувачот кон

мемориската локација на првиот бајт на новата порака:

Поставување на адресни линии

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 76: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

1. Иницијализација на системот:

-Копирање на податоци од ROM во RAM

-RS-232

-Иницијализација на променливи

start: nop

; read parameters form the EPROM memory

; - read available messages

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PC

Page 77: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

start: nop

; read parameters form the EPROM memory

; - read available messages

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

Page 78: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

start: nop

; read parameters form the EPROM memory

; - read available messages

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sysPC

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PC

Page 79: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

msg_start_sys:

; header

MVI A, hdr ; copy header data into reg. A

ORI req ; set it as Request message

MVI C, rtx_hdr_msg_adr ; set the address for the header

call write_8155 ; write the message into RAM

EI ; enable interrupts

; address

MVI A, addr_if_card ; copy address of the IF card

MVI C, rtx_cabin_node_msg_adr ; set the address for the cabin/node address

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

EI ; enable interrupts

; command

MVI A, cmd_start_sys ; copy the command

MVI C, rtx_command_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

; data (irrelevant)

MVI A, 0FFh ; copy data for the command

MVI C, rtx_data_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

; CRC (irrelevant)

MVI A, 0FFh ; copy data for the command

MVI C, rtx_crc_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

ret

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

Page 80: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

msg_start_sys:

; header

MVI A, hdr ; copy header data into reg. A

ORI req ; set it as Request message

MVI C, rtx_hdr_msg_adr ; set the address for the header

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (HEADER)

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 81: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

msg_start_sys:

; header

MVI A, hdr ; copy header data into reg. A

ORI req ; set it as Request message

MVI C, rtx_hdr_msg_adr ; set the address for the header

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (HEADER)

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 82: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

msg_start_sys:

; header

MVI A, hdr ; copy header data into reg. A

ORI req ; set it as Request message

MVI C, rtx_hdr_msg_adr ; set the address for the header

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (HEADER)

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 83: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

msg_start_sys:

; header

MVI A, hdr ; copy header data into reg. A

ORI req ; set it as Request message

MVI C, rtx_hdr_msg_adr ; set the address for the header

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (HEADER)

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 84: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

; address

MVI A, addr_if_card ; copy address of the IF card

MVI C, rtx_cabin_node_msg_adr ;set the address for the cabin/node address

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (IF CARD ADDRESS)

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 85: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (IF CARD ADDRESS)

-Бесконечна јамка (чекање на прекин)

; address

MVI A, addr_if_card ; copy address of the IF card

MVI C, rtx_cabin_node_msg_adr ;set the address for the cabin/node address

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 86: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (IF CARD ADDRESS)

-Бесконечна јамка (чекање на прекин)

; address

MVI A, addr_if_card ; copy address of the IF card

MVI C, rtx_cabin_node_msg_adr ;set the address for the cabin/node address

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 87: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

; command

MVI A, cmd_start_sys ; copy the command

MVI C, rtx_command_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (COMMAND)

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 88: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

-(COMMAND)

-Бесконечна јамка (чекање на прекин)

PC

; command

MVI A, cmd_start_sys ; copy the command

MVI C, rtx_command_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 89: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (COMMAND)

-Бесконечна јамка (чекање на прекин)

PC

; command

MVI A, cmd_start_sys ; copy the command

MVI C, rtx_command_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 90: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

; data (irrelevant)

MVI A, 0FFh ; copy data for the command

MVI C, rtx_data_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (DATA – IRRELEVANT NOW)

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 91: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (DATA – IRRELEVANT NOW)

-Бесконечна јамка (чекање на прекин)

PC

; data (irrelevant)

MVI A, 0FFh ; copy data for the command

MVI C, rtx_data_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 92: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (DATA – IRRELEVANT NOW)

-Бесконечна јамка (чекање на прекин)

PC

; data (irrelevant)

MVI A, 0FFh ; copy data for the command

MVI C, rtx_data_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 93: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

; CRC (irrelevant)

MVI A, 0FFh ; copy data for the command

MVI C, rtx_crc_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

ret

PC

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (CRC – IRRELEVANT NOW)

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 94: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (CRC – IRRELEVANT NOW)

-Бесконечна јамка (чекање на прекин)

PC

; CRC (irrelevant)

MVI A, 0FFh ; copy data for the command

MVI C, rtx_crc_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

ret

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 95: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

Намена на регистри:

A – податокот од важност

C – адреса во RAM за бајт од пораката

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

- (CRC – IRRELEVANT NOW)

-Бесконечна јамка (чекање на прекин)

PC

; CRC (irrelevant)

MVI A, 0FFh ; copy data for the command

MVI C, rtx_crc_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

ret

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

Page 96: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

start: nop

; read parameters form the EPROM memory

; - read available messages

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PC

Page 97: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

start: nop

; read parameters form the EPROM memory

; - read available messages

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PC

Page 98: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

start: nop

; read parameters form the EPROM memory

; - read available messages

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PC

Page 99: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

start: nop

; read parameters form the EPROM memory

; - read available messages

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PCPC+1PC+1PC+1

Page 100: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

start: nop

; read parameters form the EPROM memory

; - read available messages

; *** initialize the system ***

call read_cmds_EPROM2RAM

call init_8251

call init_system_vars

call msg_start_sys

2. Почеток на работа на системот

-Формирање и испраќање на порака за стартување на системот

-Бесконечна јамка (чекање на прекин)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

call msg_start_sys

call transmit_8251 ; send over RS-485

endless_loop: nop

nop

nop

JMP endless_loop

hlt

PCPC+1PC+1PC+1

Page 101: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

Page 102: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

cabin current level next level requested level

1 8 5 2

2 5 5 2

Page 103: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

1. Оневозможување на прекини (DI)

2. Зачувување на содржината на регистрите на Stack

3. Обработка на прекинот (Interrupt Service Routine – ISR)

4. Враќање не содржината на регистрите од Stack

5. Овозможување на прекини (EI)

Page 104: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

Page 105: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

ISR_low_003CH: DI

PUSH B

PUSH D

PUSH H

call ISR_high_003CH ; process the interrupt

POP B

POP D

POP H

PCPC+1PC+1

PC+1

POP H

EI

ret

Page 106: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ3. Обработка на прекин

- Обработка на примена порака

-Примен е Прв бајт на порака

- Составување и испраќање на одговор

Page 107: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PCISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

...

...

new_message:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

MOV A, B ; return the value to the acc A

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

ret

Page 108: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PC

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

...

...

new_message:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

MOV A, B ; return the value to the acc A

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

ret

Page 109: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PC

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

...

...

new_message:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

MOV A, B ; return the value to the acc A

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

ret

Page 110: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PC

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

...

...

new_message:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

MOV A, B ; return the value to the acc A

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

ret

Page 111: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PC

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

...

...

new_message:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.PC+78 LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

MOV A, B ; return the value to the acc A

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

ret

PC+78

Page 112: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PC

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

...

...

new_message:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.PC LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

MOV A, B ; return the value to the acc A

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

ret

PC

Page 113: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

...

...

new_message:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

PC

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

MOV A, B ; return the value to the acc A

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

ret

…PC

Page 114: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

...

...

new_message:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the location of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

MOV A, B ; return the value to the acc A

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

ret

PC

Page 115: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

MOV A, B ; return the value to the acc A

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

INR M ; increment the counter

PC

PC

PC0x422C

INR M ; increment the counter

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

; check if it was the last byte of a message

MVI C, rx_msg_counter ; set address for the counter

call read_8155 ; move the counter value into the acc. A

CPI 65h ; compare the counter with value 65h �

; � (last mem. location, addr. of the last byte of a message)

JZ message_received

; if not, ret and wait for another byte to complete it

ret

Page 116: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

MOV A, B ; return the value to the acc A

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

INR M ; increment the counter

PC

… INR M ; increment the counter

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

; check if it was the last byte of a message

MVI C, rx_msg_counter ; set address for the counter

call read_8155 ; move the counter value into the acc. A

CPI 65h ; compare the counter with value 65h �

; � (last mem. location, addr. of the last byte of a message)

JZ message_received

; if not, ret and wait for another byte to complete it

ret

PC

Page 117: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

MOV A, B ; return the value to the acc A

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

INR M ; increment the counterINR M ; increment the counter

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

; check if it was the last byte of a message

MVI C, rx_msg_counter ; set address for the counter

call read_8155 ; move the counter value into the acc. A

CPI 65h ; compare the counter with value 65h �

; � (last mem. location, addr. of the last byte of a message)

JZ message_received

; if not, ret and wait for another byte to complete it

ret

PC

PC

PC0x423F

Page 118: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

ISR_high_003CH:

call receive_8251

MOV B, A ; make a copy

ANI hdr ; logical AND to get the (Start of Frame - SOF) bits, only

CPI hdr ; compare if the value in A is 0Ch (SOF)

JZ new_message

MOV A, B ; return the value to the acc A

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

INR M ; increment the counterINR M ; increment the counter

MOV C, M ; copy the counter value into reg. C (form the mem. address)

call write_8155 ; copy the received data into the RAM recv. buffer

; check if it was the last byte of a message

MVI C, rx_msg_counter ; set address for the counter

call read_8155 ; move the counter value into the acc. A

CPI 65h ; compare the counter with value 65h �

; � (last mem. location, addr. of the last byte of a message)

JZ message_received

; if not, ret and wait for another byte to complete it

ret; if it is then a msg is received: process the message and set the counter to zero

message_received:

PC

PC

PC0x4240

Page 119: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

Page 120: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

; if it is then a msg is received: process the message and set the counter to zero

message_received:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the locatin of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

; processing of a message

; check if the msg. is for the CPU card

MVI C, rtx_cabin_node_msg_adr ; set the pointer to 61h �

; � address/receiver specified in the msg.

call read_8155

PC…

PC

call read_8155 ; read the address

CPI addr_cpu_card ; compare the address recv. with the address of the CPU card

JZ message_for_cpu; if not CPU add - ret.

ret

Page 121: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

; if it is then a msg is received: process the message and set the counter to zero

message_received:

LXI H, rx_msg_counter_16b ; point to the counter in RAM mem.

MVI A, 60h ; set acc. A to 60h - the locatin of the first recv. byte of a msg.

MOV M, A ; reset the counter to 60h (prepare it for a new message)

; processing of a message

; check if the msg. is for the CPU card

MVI C, rtx_cabin_node_msg_adr ; set the pointer to 61h �

; � address/receiver specified in the msg.

call read_8155

PC

… call read_8155 ; read the address

CPI addr_cpu_card ; compare the address recv. with the address of the CPU card

JZ message_for_cpu; if not CPU add - ret.

ret

message_for_cpu:

PC

PC0x4251

Page 122: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

Page 123: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

message_for_cpu:

; check if it is a request message

MVI C, rtx_hdr_msg_adr ; set the pointer to the SOF/header

call read_8155 ; read the address

PC… call read_8155 ; read the address

ANI req ; acc. A AND 0001 0000 (if it is a request)

JNZ message_is_req

; if not req. then ret

ret

message_is_req:

PC

PC0x425D

#2060h: D0h = 1101 0000b

req = 10h = 0001 0000b

1101 0000b

AND 0001 0000b

------------------------

0001 0000b = 10h

Page 124: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

Page 125: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

message_is_req:

; check if the command is known for this system

; skip this step, the command exists, check if it is calc_closest_cabin msg

MVI C, rtx_command_msg_adr ; set the pointer to the command field �

; � of the recv. msg

call read_8155 ; read the address

CPI cmd_calc_closest_cabin ; check if it is the cmd_calc_closest_cabin msg/req

JZ check_data_of_the_msg ; if it is the msg. then jump to...

call send_msg_err_cmd ; if it is an unknown command then send err msg. �

; � OR NOT calc_closest_cabin send err. msg

PC

PC

; � OR NOT calc_closest_cabin send err. msg

check_data_of_the_msg:; check the data of the command/packet

; it must be a cmd_calc_closest_cabin, so transfer the data into �

; �reg. B (as req. by the subroutines)

MVI C, rtx_data_msg_adr ; load address of the data field of the recv. msg

call read_8155 ; read the data

MOV B, A ; move it to reg. B, as requested by the subroutines

call find_cabins ; do not modify reg. B. find the cabines and �

; �calc. the closest to send. and send it

ret

PC0x426B

Page 126: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

message_is_req:

; check if the command is known for this system

; skip this step, the command exists, check if it is calc_closest_cabin msg

MVI C, rtx_command_msg_adr ; set the pointer to the command field �

; � of the recv. msg

call read_8155 ; read the address

CPI cmd_calc_closest_cabin ; check if it is the cmd_calc_closest_cabin msg/req

JZ check_data_of_the_msg ; if it is the msg. then jump to...

call send_msg_err_cmd ; if it is an unknown command then send err msg. �

; � OR NOT calc_closest_cabin send err. msg; � OR NOT calc_closest_cabin send err. msg

check_data_of_the_msg:; check the data of the command/packet

; it must be (for this example) a cmd_calc_closest_cabin, so transfer the data into �

; �reg. B (as req. by the subroutines)

MVI C, rtx_data_msg_adr ; load address of the data field of the recv. msg

call read_8155 ; read the data

MOV B, A ; move it to reg. B, as requested by the subroutines

call find_cabins ; do not modify reg. B. find the cabines and �

; �calc. the closest to send. and send it

ret

PC

PC

Page 127: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

find_cabins:

MVI A, 01h ; parameter for find_cabin (first cabin)

call find_cabin ; prepare and send msg

MVI A, 02h ; parameter for find_cabin (second cabin)

call find_cabin ; prepare and send msg

;if msgs for cab_01/02 were received, then calc the closest cabin

call msg_calc_closest_cabin

call transmit_8251

ret

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PCPC+2

find_cabin:

call msg_find_cabin

call transmit_8251

ret

PC

симулација

Page 128: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

msg_find_cabin:

MOV D, A ; make a copy

; header

MVI A, hdr ; copy header data into reg. A

ORI req ; set it as Request message

MVI C, rtx_hdr_msg_adr ; set the address for the header

call write_8155 ; write the message into RAM

EI ; enable interrupts

; address

MVI A, addr_ecc_card ; ECC address

MVI C, rtx_cabin_node_msg_adr ; set the address for the cabin/node address

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

MVI C, rtx_cabin_node_msg_adr ; set the address for the cabin/node address

call write_8155 ; write the message into RAM

EI ; enable interrupts

; command

MVI A, cmd_find_cabin ; copy the command

MVI C, rtx_command_msg_adr; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

; data (from reg. A)

MOV D, A ; return the copy

MVI C, rtx_data_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

; CRC (irrelevant)

MVI A, 055h ; copy data for the command

MVI C, rtx_crc_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

ret

Намена на регистри:

A – податокот од важност

B – кат - одредиште

C – адреса во RAM за бајт од пораката

Page 129: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

msg_find_cabin:

MOV D, A ; make a copy

; header

MVI A, hdr ; copy header data into reg. A

ORI req ; set it as Request message

MVI C, rtx_hdr_msg_adr ; set the address for the header

call write_8155 ; write the message into RAM

EI ; enable interrupts

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC

PC

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (HEADER)

Намена на регистри:

A – податокот од важност

B – кат - одредиште

C – адреса во RAM за бајт од пораката

Page 130: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

; address

MVI A, addr_ecc_card ; ECC address

MVI C, rtx_cabin_node_msg_adr ; set the address for the cabin/node address

call write_8155 ; write the message into RAM

EI ; enable interrupts

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (ADDRESS)

PC…

PC

Намена на регистри:

A – податокот од важност

B – кат - одредиште

C – адреса во RAM за бајт од пораката

Page 131: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

; command

MVI A, cmd_find_cabin ; copy the command

MVI C, rtx_command_msg_adr; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (COMMAND)

PC…

PC

Намена на регистри:

A – податокот од важност

B – кат - одредиште

C – адреса во RAM за бајт од пораката

Page 132: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

; data (from reg. A)

MOV D, A ; return the copy

MVI C, rtx_data_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (DATA)

PC…

PC

Намена на регистри:

A – податокот од важност

B – кат - одредиште

C – адреса во RAM за бајт од пораката

Page 133: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

; CRC (irrelevant)

MVI A, 055h ; copy data for the command

MVI C, rtx_crc_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

ret

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (CRC - irrelevant)

PC…

PC

Намена на регистри:

A – податокот од важност

B – кат - одредиште

C – адреса во RAM за бајт од пораката

Page 134: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Примен е одговор)

Намена на регистри:

A – податокот од важност

B – кат - одредиште

C – адреса во RAM за бајт од пораката

2080h Локација кон која се движи кабина 1 r_cabin_01

2081h Локација кон која се движи кабина 2 r_cabin_02

2082h Број на катови од кабина 1 до бараниот кат r_diff_cabin_01

2083h Број на катови од кабина 2 до бараниот кат r_diff_cabin_02

2084h Кат на кој се наоѓа кабина 1 (моментално) r_curr_cabin_01

2085h Кат на кој се наоѓа кабина 2 (моментално) r_curr_cabin_02

Page 135: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

find_cabins:

MVI A, 01h ; parameter for find_cabin (first cabin)

call find_cabin ; prepare and send msg

MVI A, 02h ; parameter for find_cabin (second cabin)

call find_cabin ; prepare and send msg

;if msgs for cab_01/02 were received, then calc the closest cabin

call msg_calc_closest_cabin

call transmit_8251

ret

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PCPC+2

find_cabin:

call msg_find_cabin

call transmit_8251

ret

PC

симулација

Page 136: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Примен е одговор)

Намена на регистри:

A – податокот од важност

B – кат - одредиште

C – адреса во RAM за бајт од пораката

2080h Локација кон која се движи кабина 1 r_cabin_01

2081h Локација кон која се движи кабина 2 r_cabin_02

2082h Број на катови од кабина 1 до бараниот кат r_diff_cabin_01

2083h Број на катови од кабина 2 до бараниот кат r_diff_cabin_02

2084h Кат на кој се наоѓа кабина 1 (моментално) r_curr_cabin_01

2085h Кат на кој се наоѓа кабина 2 (моментално) r_curr_cabin_02

Page 137: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

msg_calc_closest_cabin:

; header

MVI A, hdr ; copy header data into reg. A

ORI res ; set it as Response message

MVI C, rtx_hdr_msg_adr ; set the address for the header

call write_8155 ; write the message into RAM

EI ; enable interrupts

; address

MVI A, addr_if_card ; broadcast address

MVI C, rtx_cabin_node_msg_adr ; set the address for the cabin/node address

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PC

… MVI C, rtx_cabin_node_msg_adr ; set the address for the cabin/node address

call write_8155 ; write the message into RAM

EI ; enable interrupts

; command

MVI A, cmd_closest_cabin ; copy the command

MVI C, rtx_command_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

PC2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 /

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

A: C0h = 1100 0000b

res = 20h = 0010 0000b

1100 0000b

OR 0010 0000b

------------------------

1110 0000b = E0h

Page 138: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; enable interrupts

; calc the closest cabin

; - the location of the second cabin is in 2086h

MVI C, r_curr_cabin_01 ; get the current location

call read_8155 ; get the data from predefined memory location in RAM

LXI H, r_cabin_01_16b ; (next) setup the mem. location of the next location of cabin 01

SUB M ; substract (next - current), ignore the sign

JP not_negative_01 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина I)

PCPC+2

CMA ; first complement (it is negative number)

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_01:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 /

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 139: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; enable interrupts

; calc the closest cabin

; - the location of the second cabin is in 2086h

MVI C, r_curr_cabin_01 ; get the current location

call read_8155 ; get the data from predefined memory location in RAM

LXI H, r_cabin_01_16b ; (next) setup the mem. location of the next location of cabin 01

SUB M ; substract (next - current), ignore the sign

JP not_negative_01 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина I)

CMA ; first complement (it is negative number)

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_01:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 /

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 140: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; enable interrupts

; calc the closest cabin

; - the location of the second cabin is in 2086h

MVI C, r_curr_cabin_01 ; get the current location

call read_8155 ; get the data from predefined memory location in RAM

LXI H, r_cabin_01_16b ; (next) setup the mem. location of the next location of cabin 01

SUB M ; substract (next - current), ignore the sign

JP not_negative_01 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина I)

CMA ; first complement (it is negative number)

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_01:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 /

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 141: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; enable interrupts

; calc the closest cabin

; - the location of the second cabin is in 2086h

MVI C, r_curr_cabin_01 ; get the current location

call read_8155 ; get the data from predefined memory location in RAM

LXI H, r_cabin_01_16b ; (next) setup the mem. location of the next location of cabin 01

SUB M ; substract (next - current), ignore the sign

JP not_negative_01 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина I)

CMA ; first complement (it is negative number)

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_01:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 /

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

PC

Page 142: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_01:

MVI C, r_diff_cabin_01 ; store diff_01 (temp)

call write_8155

LXI H, r_cabin_01_16b ; (next) setup the mem. location of the next location of cabin 01

MOV A, M ; copy next msg_calc_closest_cabin level to reg. A

SUB B ; sub. A-B (next - requested) and store in reg. A

JP not_negative_02 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PCPC+2

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина I)

CMA

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_02:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 3

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 143: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_01:

MVI C, r_diff_cabin_01 ; store diff_01 (temp)

call write_8155

LXI H, r_cabin_01_16b ; (next) setup the mem. location of the next location of cabin 01

MOV A, M ; copy next msg_calc_closest_cabin level to reg. A

SUB B ; sub. A-B (next - requested) and store in reg. A

JP not_negative_02 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PCPC+3

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина I)

CMA

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_02:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 3

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 144: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_01:

MVI C, r_diff_cabin_01 ; store diff_01 (temp)

call write_8155

LXI H, r_cabin_01_16b ; (next) setup the mem. location of the next location of cabin 01

MOV A, M ; copy next msg_calc_closest_cabin level to reg. A

SUB B ; sub. A-B (next - requested) and store in reg. A

JP not_negative_02 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина I)

CMA

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_02:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 3

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 145: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_01:

MVI C, r_diff_cabin_01 ; store diff_01 (temp)

call write_8155

LXI H, r_cabin_01_16b ; (next) setup the mem. location of the next location of cabin 01

MOV A, M ; copy next msg_calc_closest_cabin level to reg. A

SUB B ; sub. A-B (next - requested) and store in reg. A

JP not_negative_02 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина I)

CMA

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_02:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 3

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

PC

Page 146: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_02:

LXI H, r_diff_cabin_01_16b ; point to the diff_01

ADD M ; add (next - current) + (next - requested)

call write_8155 ; store the difference into RAM

; add 1 to get the actual result (absolute value)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

PC…

PC

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина I)

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 147: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; calc the closest cabin

; - the location of the second cabin is in 2085h

MVI C, r_curr_cabin_02 ; get the current location

call read_8155 ; get the data from predefined memory location in RAM

LXI H, r_cabin_02_16b ; setup the mem. location of the next location of cabin 01

SUB M ; substract (next - current), ignore the sign

JP not_negative_03 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

ADI 01h ; add 1 to get the actual result (absolute value)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина II)

PCPC+2

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_03:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 148: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; calc the closest cabin

; - the location of the second cabin is in 2085h

MVI C, r_curr_cabin_02 ; get the current location

call read_8155 ; get the data from predefined memory location in RAM

LXI H, r_cabin_02_16b ; setup the mem. location of the next location of cabin 01

SUB M ; substract (next - current), ignore the sign

JP not_negative_03 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

ADI 01h ; add 1 to get the actual result (absolute value)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина II)

PC

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_03:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 149: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; calc the closest cabin

; - the location of the second cabin is in 2085h

MVI C, r_curr_cabin_02 ; get the current location

call read_8155 ; get the data from predefined memory location in RAM

LXI H, r_cabin_02_16b ; setup the mem. location of the next location of cabin 01

SUB M ; substract (next - current), ignore the sign

JP not_negative_03 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

ADI 01h ; add 1 to get the actual result (absolute value)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина II)

PC

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_03:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 150: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; calc the closest cabin

; - the location of the second cabin is in 2085h

MVI C, r_curr_cabin_02 ; get the current location

call read_8155 ; get the data from predefined memory location in RAM

LXI H, r_cabin_02_16b ; setup the mem. location of the next location of cabin 01

SUB M ; substract (next - current), ignore the sign

JP not_negative_03 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

ADI 01h ; add 1 to get the actual result (absolute value)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина II)

PC

… ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_03:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 /

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

PC

Page 151: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_03:

MVI C, r_diff_cabin_02 ; store diff_02 (temp)

call write_8155

LXI H, r_cabin_02_16b ; (next) setup the mem. location of the next location of cabin 02

MOV A, M ; copy next level to reg. A

SUB B ; sub. A-B (next - requested) and store in reg. A

JP not_negative_04 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина II)

PCPC+2

CMA

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_04:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 0

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 152: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_03:

MVI C, r_diff_cabin_02 ; store diff_02 (temp)

call write_8155

LXI H, r_cabin_02_16b ; (next) setup the mem. location of the next location of cabin 02

MOV A, M ; copy next level to reg. A

SUB B ; sub. A-B (next - requested) and store in reg. A

JP not_negative_04 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина II)

PCPC+3

CMA

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_04:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 0

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 153: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_03:

MVI C, r_diff_cabin_02 ; store diff_02 (temp)

call write_8155

LXI H, r_cabin_02_16b ; (next) setup the mem. location of the next location of cabin 02

MOV A, M ; copy next level to reg. A

SUB B ; sub. A-B (next - requested) and store in reg. A

JP not_negative_04 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина II)

PC

CMA

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_04:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 0

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 154: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_03:

MVI C, r_diff_cabin_02 ; store diff_02 (temp)

call write_8155

LXI H, r_cabin_02_16b ; (next) setup the mem. location of the next location of cabin 02

MOV A, M ; copy next level to reg. A

SUB B ; sub. A-B (next - requested) and store in reg. A

JP not_negative_04 ; jump to the next instruction if not negative

CMA ; first complement (it is negative number)

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина II)

PC

…CMA

ADI 01h ; add 1 to get the actual result (absolute value)

not_negative_04:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 0

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

PC

Page 155: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

not_negative_04:

LXI H, r_diff_cabin_02_16b ; point to the diff_02

ADD M ; add (next - current) + (next - requested)

call write_8155 ; store the difference into

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Кабина II)

PC…

PC

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 3

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 156: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; both difference are available now (first is stored in RAM, second in reg. A)

LXI H, r_diff_cabin_01_16b ; setup mem. addr. for the diff. of the first cabin

SUB M ; substract it with the diff. of the second cabin, stored in reg. A

JМ use_the_second_cabin

MVI A, 01h ; use the first cabin

JMP continue_with_msg

use_the_second_cabin:

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Пресметка која кабина да биде испратена)

PC

use_the_second_cabin:

MVI A, 02h ; use the second cabin

continue_with_msg:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 3

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 157: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; both difference are available now (first is stored in RAM, second in reg. A)

LXI H, r_diff_cabin_01_16b ; setup mem. addr. for the diff. of the first cabin

SUB M ; substract it with the diff. of the second cabin, stored in reg. A

JМ use_the_second_cabin

MVI A, 01h ; use the first cabin

JMP continue_with_msg

use_the_second_cabin:

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Пресметка која кабина да биде испратена)

PC

use_the_second_cabin:

MVI A, 02h ; use the second cabin

continue_with_msg:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 3

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 158: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; both difference are available now (first is stored in RAM, second in reg. A)

LXI H, r_diff_cabin_01_16b ; setup mem. addr. for the diff. of the first cabin

SUB M ; substract it with the diff. of the second cabin, stored in reg. A

JМ use_the_second_cabin

MVI A, 01h ; use the first cabin

JMP continue_with_msg

use_the_second_cabin:

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Пресметка која кабина да биде испратена)

PC

PC use_the_second_cabin:

MVI A, 02h ; use the second cabin

continue_with_msg:

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 3

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

PC

Page 159: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

…; both difference are available now (first is stored in RAM, second in reg. A)

LXI H, r_diff_cabin_01_16b ; setup mem. addr. for the diff. of the first cabin

SUB M ; substract it with the diff. of the second cabin, stored in reg. A

JМ use_the_second_cabin

MVI A, 01h ; use the first cabin

JMP continue_with_msg

use_the_second_cabin:

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор- (Пресметка која кабина да биде испратена)

use_the_second_cabin:

MVI A, 02h ; use the second cabin

continue_with_msg:

PC

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 3

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 160: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

continue_with_msg:

; data (set to mem. loc. (80)64h)

MVI C, rtx_data_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

; CRC (irrelevant)

MVI A, 55h ; copy data for the command

MVI C, rtx_crc_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PC…

PC

call write_8155 ; write the message into RAM

EI ; enable interrupts

Ret

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 3

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 161: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

continue_with_msg:

; data (set to mem. loc. (80)64h)

MVI C, rtx_data_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

EI ; enable interrupts

; CRC (irrelevant)

MVI A, 55h ; copy data for the command

MVI C, rtx_crc_msg_adr ; set the address for the command

call write_8155 ; write the message into RAM

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PC

…call write_8155 ; write the message into RAM

EI ; enable interrupts

ret

PC

2080h r_cabin_01 5

2081h r_cabin_02 5

2082h r_diff_cabin_01 6

2083h r_diff_cabin_02 3

2084h r_curr_cabin_01 8

2085h r_curr_cabin_02 5

Page 162: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

Page 163: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

Page 164: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

PC

find_cabins:

MVI A, 01h ; parameter for find_cabin (first cabin)

call find_cabin ; prepare and send msg

MVI A, 02h ; parameter for find_cabin (second cabin)

call find_cabin ; prepare and send msg

;if msgs for cab_01/02 were received, then calc the closest cabin

call msg_calc_closest_cabin

call transmit_8251

ret

Page 165: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor
Page 166: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

АЛГОРИТАМ НА ИЗВРШУВАЊЕ

3. Обработка на прекин

-Обработка на примена порака

-Составување и испраќање на одговор

cabin current level next level requested level closest cabin number

1 8 5 2 6

2 5 5 2 3

Page 167: Implementaion of an elevator control with two cabins, by using Intel's 8085A microprocessor

БЛАГОДАРАМ НА ВНИМАНИЕТО


Recommended