58TP326 V4.indd
ÖćøĔÿŠ ×š ĂöĎ úđך ćĒïï×îćîĔĀš ĒÖŠ ĒñÜüÜÝøĕöēÙøÙĂîēìøúđúĂøŤ đóČę ĂÖćøđøĊ ÷îøĎš Ĝġě üćøÿćøøćßïĆ èæĉ ê÷ÿëćî ðŘ ìĊę ǰĤĪǰÞïĆ ïìĊę ǰĥǰê Ù í Ù ǰģĦĦĨ org 8000h main proc cli mov ax,0 mov ds,ax mov es,ax mov ss,ax mov ax,8000h mov sp,ax FRQ¿J V IRU PRGH RQ $ % ;ports A, C = input, B = output mov al,10011001b out ppi_ctrl_port1,al out ppi_ctrl_port2,al sti ;scan 8 switches for closed one scanloop: mov bl,01h mov cx,8 inloop: call delay1 in al,ppi_port1_a mov bh,bl not bh cmp al,bh je getone shl bl,1 loop inloop mov al,0 getone: not al out ppi_port2_b,al call delay2 jmp scanloop ;start of prog. in ROM ;prevent other interrupts ;set all segments to 0000h ;set stack top at 8000h ;enable system interrupts ;closed SW ==> logic 0 ;start with LS bit ;delay before reading in data ;read 8 bits of data ;check for 1 closed SW ;1 SW being closed ==> display ;not this SW ==> go to next SW ;ERROR ==> light all 8 LEDs ;invert data ;port2B has inverters on output ;delay after outputting data ;start over again main endp ;*********************************** delay1 proc push cx mov cx,4000h delay5: loop delay5 pop cx ret delay1 endp ;*********************************** delay2 proc push cx mov cx,0F000h delay6: loop delay6 pop cx ret delay2 endp ;*********************************** org 0FFF0h db 0EAh,0,80h,0,0 end main ;shorter delay ;save CX ;count down CX ;restore CX ;longer delay ;address of 1st instruction on boot ;far jump to start at 0000:8000h øĎ ðìĊę ǰĥǰàĂôêŤ ĒüøŤ ìĊę Ĕßš êøüÝøĎš ÖćøÖéÿüĉ êߍ Ĕîÿć÷ך ĂöĎ úđך ćǰĩǰÿć÷×ĂÜĒñÜüÜÝøĕöēÙøÙĂîēìøúđúĂøŤ 58TP326 V4.indd 160 8/7/2558 BE 3:44 PM
Made with FlippingBook
RkJQdWJsaXNoZXIy NTk0NjM=