วารสารปี-40-ฉบับที่-4-resize
มงคล เดชนครินทร์ 135 วารสารราชบัณฑิตยสภา ปีที่ ๔๐ ฉบับที่ ๔ ต.ค.-ธ.ค. ๒๕๕๘ ;Program for displaying data via IC ;8255(1) of the uC8088 board ;Program name: LED2.ASM ;Date: June 26, 2015 ;use Borland’s Turbo Assembler ;assemble: tasm LED2 ;link: tlink /t LED2.OBJ, LED2.BIN ;burn LED2.BIN to 32-KB ROM or ;transfer it to ROM emulator .model tiny .code ;I/O port addresses ***** ( ดูใน LED1.ASM ตามรูปที่ ๓ ) ***** org 8000h main proc ;Initialization part of the prog. ***** ( ดูใน LED1.ASM ตามรูปที่ ๓ ) ***** ;The box below contains the principal ;part of the program ;--------------------------------- strt: ; call runled2 ; jmp strt ; ;--------------------------------- main endp ;********************************** runled2 proc ;running light in 4×4 LED array ;turn on LEDs on first row mov bl,01h begin2: ;turn on LED on first col mov dl,10h mov al,dl or al,bl ;show 8-bit data on Port2b LEDs call outport2 ;send data via port1b call outport1 ;for the next 3 cols mov cx,0003h lop21: shl dl,1 mov al,dl or al,bl ;show 8-bit data on Port2b LEDs call outport2 ;send data via port1b call outport1 ;turn on LED on 3 more cols loop lop21 ;move to next row (group) of LEDs shl bl,1 cmp bl,8 ;4th row? ;repeat for next row jbe begin2 ;turn off all LEDs mov al,0 call outport2 call outport1 ret runled2 endp ;********************************* outport1 proc ;send 8-bit data via Port1b out ppi_port1_b,al ;slow down the running of light call delay2 call delay2 ret outport1 endp ;********************************* outport2 proc ;display 8-bit data on Port2b LEDs out ppi_port2_b,al call delay2 call delay2 ret outport2 endp ;******************************** delay1 proc ;time delay of about 160 ms push cx mov cx,4000h delay5: loop delay5 pop cx ret delay1 endp ;******************************** delay2 proc ;time delay about 0.6 sec push cx mov cx,0F000h delay6: loop delay6 pop cx ret delay2 endp ;********************************* ;address of 1st instruction on boot org 0fff0h ;far jump to ROM at 0000:8000h db 0eah, 0,80h, 0,0 end main รูปที่ ๕ ซอฟต์แวร์ที่ใช้ควบคุมการแสดงผลข้อมูลออกขนาด ๑๖ บิตตามวิธีมัลติเพล็กซ์
Made with FlippingBook
RkJQdWJsaXNoZXIy NTk0NjM=