Page 33 - The Journal of the Royal Society of Thailand
P. 33
วารสารราชบััณฑิิตยสภา
ปีีท่� ๔๙ ฉบัับัท่� ๑ มกิราคุม-เมษาย์น ๒๕๖๗
ศาสตราจารย์์กิิตติคุุณ ดร.มงคุล เดชนคุรินทร์ 23
delay0 proc
;delay of about 78 us (0.078 ms)
push cx ;15 CPU clock periods
mov cx,0040h ;4 CPU clock periods
delay4: loop delay4 ;64x5=320 CPU clock periods
pop cx ;12 CPU clock periods
ret ;20 CPU clock periods
delay0 endp
;Note: The instruction “call delay0” takes 19 CPU clock periods,
;so total delay after one “call delay0” is 15+4+320+12+20+19 =
;390 CPU clock periods.
;At the 8088-CPU clock freq of 5 MHz, 1 CPU clock period = 0.2 us.
;//////////////////////////////////////////////
delay1 proc
;delay of about 0.16 sec (160 ms)
push cx
mov cx,4000h
delay5: loop delay5
pop cx
ret
delay1 endp
;//////////////////////////////////////////////
delay2 proc
;delay of about 0.6 sec
push cx
mov cx,0F000h
delay6: loop delay6
pop cx
ret
delay2 endp
;//////////////////////////////////////////////
org 0FFF0h ;Instruction Pointer address at reset
db 0EAh,0,80h,0,0 ;far jump to start of ROM
end main
ผลการทดลอง
ผ้�เขีียนได�ทดลองใช�งานโป็รแกรมภาษัาแอสเซึ่มบลีต่ามภาพื่ที� ๑๐ กับแผงวงจรไมโครคอนโทรลเลอร์
เพื่่�อการเรียนร้�ต่ามภาพื่ที� ๑ ซึ่่�งต่่อป็ระสานกับหน่วยความจำอีอีพื่ร็อมแบบอนุกรม AT24C256 ต่ามภาพื่ที� ๔
โดยที�อีอีพื่ร็อมดังกล่าวอย้่ห่างจากแผงวงจรไมโครคอนโทรลเลอร์ออกไป็ป็ระมาณ ๑๐ เซึ่นต่ิเมต่ร การทดลอง
ให�ผลต่รงต่ามความคาดหมาย ค่อ สังเกต่จากชุดแสดงผลแบบไดโอดเป็ล่งแสงต่ามวงจรในภาพื่ที� ๒ พื่บว่า ขี�อม้ล
แต่่ละไบต่์ที�อ่านกลับจากอีอีพื่ร็อมนั�นสอดคล�องกับขี�อม้ลแต่่ละไบต่์ที�เขีียนลงในอีอีพื่ร็อมต่ามลำดับ