XinDưới đây là code điều khiển 32 led bằng 4 ic 595 Đầu tiên mình muốn tăng lên 12 ic 595 thì phải khai báo thế nào ạ
Thứ 2 là mình muốn các port còn lại của vi điều khiển sáng thuận thì phải viết như thế nào
Mình là mem mới nên k hiểu lắm. mong mọi người giúp ạ, cảm ơn mọi người nhiều
Thứ 2 là mình muốn các port còn lại của vi điều khiển sáng thuận thì phải viết như thế nào
Mình là mem mới nên k hiểu lắm. mong mọi người giúp ạ, cảm ơn mọi người nhiều
Code:
sh bit p2.0 st bit p2.2 da_ta bit p2.1 solan equ 2fh org 0000h ljmp main org 30H main: SETB P2.3 clr sh clr st MOV R1,0 ; ma khoi dau MOV R2,#10 ; so bang ma MOV R3,#4 ; xuat 4 byte ra 4 con 595 mov dptr, # mydata Loop4: mov solan,#39 LOOP1: mov r5,#4 ; tang bang ma 4 byte mov r4,#8 ; xuat 8 bit ra 595 mov a,R1 movc a,@a+dptr loop2: clr c rlc a mov da_ta,c setb sh clr sh djnz r4,loop2 ;dich 8 bit inc R1 djnz r3,LOOP1 ;dich 4 byte setb st clr st lcall delay LOOP3: INC DPTR djnz r5,LOOP3 djnz solan,LOOP1 djnz r2,LOOP4 ljmp main ;=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= +=+=+=+ delay: jb P2.3,delay ;xung lm555 ?u+a vao chân p3.1 ca_chu_ki: jnb P2.3,ca_chu_ki ret ;ta.i ?a^`u CT chính nho+' set bit p3.1 ;=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= +=+=+=+ delay1: MOV TMOD,#01 MOV R6,#1 AGAIN: MOV TL0,78H MOV TH0,ECH SETB TR0 AGAIN1: JNB TF0,AGAIN1 CLR TR0 CLR TF0 DJNZ R6,AGAIN ret ;=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= +=+=+=+ org 300h mydata: db 00000000b,00000001b,10000000b, 00000000b db 00000000b,00000010b,01000000b, 00000000b db 00000000b,00000100b,00100000b, 00000000b db 00000000b,00001000b,00010000b, 00000000b db 00000000b,00010000b,00001000b, 00000000b db 00000000b,00100000b,00000100b, 00000000b db 00000000b,01000000b,00000010b, 00000000b db 00000000b,10000000b,00000001b, 00000000b db 00000001b,00000000b,00000000b, 10000000b db 00000010b,00000000b,00000000b, 01000000b db 00000100b,00000000b,00000000b, 00100000b db 00001000b,00000000b,00000000b, 00010000b db 00010000b,00000000b,00000000b, 00001000b db 00100000b,00000000b,00000000b, 00000100b db 01000000b,00000000b,00000000b, 00000010b db 10000000b,00000000b,00000000b, 00000001b db 10000000b,00000000b,00000000b, 00000001b db 01000000b,00000000b,00000000b, 00000010b db 00100000b,00000000b,00000000b, 00000100b db 00010000b,00000000b,00000000b, 00001000b db 00001000b,00000000b,00000000b, 00010000b db 00000100b,00000000b,00000000b, 00100000b db 00000010b,00000000b,00000000b, 01000000b db 00000001b,00000000b,00000000b, 10000000b db 00000000b,10000000b,00000001b, 00000000b db 00000000b,01000000b,00000010b, 00000000b db 00000000b,00100000b,00000100b, 00000000b db 00000000b,00010000b,00001000b, 00000000b db 00000000b,00001000b,00010000b, 00000000b db 00000000b,00000100b,00100000b, 00000000b db 00000000b,00000010b,01000000b, 00000000b db 00000000b,00000001b,10000000b, 00000000b ;1
Comment