08.11.2017 Views

TAI LIEU THUC HANH VXL

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Trường ĐH Bà Rịa-Vũng Tàu<br />

Khoa Điện-Điện tử<br />

;ma chu xuat ra port 0<br />

;===================================================================<br />

dind bit p2.0<br />

dinx bit p2.1<br />

clk bit p2.2<br />

oe bit p2.4<br />

st bit p2.5<br />

clr_ bit p2.6<br />

;======================================<br />

org 0h<br />

;-----------------------------------------khoi tao 6b595<br />

clr dind<br />

clr dinx<br />

clr clk<br />

setb oe<br />

clr st<br />

clr clr_<br />

setb clr_<br />

;--------------------------------------------<br />

main: mov dptr,#matranchua<br />

setb dind<br />

mov r2,#0h<br />

rep: mov a,r2<br />

movc a,@a+dptr<br />

mov p0,a<br />

setb clk<br />

clr dind<br />

clr clk<br />

setb<br />

clr<br />

st<br />

st<br />

clr oe<br />

lcall delay<br />

setb oe<br />

inc r2<br />

cjne r2,#8,rep<br />

clr clr_<br />

setb clr_<br />

sjmp main<br />

;-----------------------------------------------<br />

delay:<br />

mov r6,#5<br />

del: mov r5,#250<br />

djnz r5,$<br />

djnz r6,del<br />

ret<br />

matranchua:<br />

db 0f8h,24h,22h,21h,22h,24h,0f8h,00h<br />

end<br />

4. Thực hiện các bước giống như trên và xem kết quả.<br />

- 54 - Thực hành Vi xử lý

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!