DCPĐệ tử 2 túi |
Lần cuối: 04-07-2014 12:15 PM
- User Lists
Visitor Messages
Showing Visitor Messages 1 to 3 of 3
-
20-11-2010 10:00 PMDCPsơ đồ em đấu như sau: ra0,ra1,ra2,ra3( đấu vào các chân địa chỉ của 74595)
rb0=data ;rb1=clock ;rb2=clear ;rb3=latch;
ct của em dùng để suất dữ liệu ra hai led ma trận 8x8,đấu chung hàng và quét cột. -
20-11-2010 09:52 PMDCPchả là em mày mò viết được cái ct nhưng không hiểu sao nó lại không chịu chạy hết mà chỉ chạy đến nửa chừng.
đây là ct của em:
;chuong trinh QUET 2LED 8X8
;su dung 74595 de suat du lieu hang
;74154 de quet cot
LIST P=16F84A
INCLUDE P16F84A.INC
__CONFIG _HS_OSC &_WDT_OFF &_PWRTE_ON &_CP_OFF
CBLOCK 0X0C
SHIFT,COUNTS,CNTTAB,CNTSC1,DELAY_L,DELAY_M
ROW1,ROW2,ROW3,ROW4,ROW5,ROW6,ROW7,ROW8
ROW9,ROW10,ROW11,ROW12,ROW13,ROW14,ROW15,ROW16
ENDC
#DEFINE DATA PORTB,0
#DEFINE CLOCK PORTB,1
#DEFINE CLEAR PORTB,2
#DEFINE LATCH PORTB,3
ORG 0X00
INIT
BSF STATUS,5
MOVLW B'10000'
MOVWF TRISA
MOVLW B'11110000'
MOVWF TRISB
BCF STATUS,5
RUN1 MOVLW 0XFF
MOVWF ROW1
MOVWF ROW2
MOVWF ROW3
MOVWF ROW4
MOVWF ROW5
MOVWF ROW6
MOVWF ROW7
MOVWF ROW8
MOVWF ROW9
MOVWF ROW10
MOVWF ROW11
MOVWF ROW12
MOVWF ROW13
MOVWF ROW14
MOVWF ROW15
MOVWF ROW16
CLRF CNTTAB;CHO BIEN DEM VAO TABLE VE 0
RUN2
MOVLW D'100'; SO LAN SCAN
MOVWF CNTSC1; CHO BIEN DEM VAO SCAN1
CALL UP; GOI CT UP HANG
INCF CNTTAB ;TANG BIEN DEM TABLE THEM 1
MOVF CNTTAB,W
CALL TABLE
MOVWF ROW16 ;DUA GIA TRI TABLE VAO ROW8
XORLW D'20'
BTFSC STATUS,Z
GOTO RUN1
RUN3 DECFSZ CNTSC1
GOTO RUN4
GOTO RUN2
RUN4 CALL QUET_ROW
GOTO RUN3
QUET_ROW CALL CLR
MOVF ROW16,W
CALL SHIFTOUT
CALL CHOT
CALL SCR16
CALL T1M
CALL CLR
MOVF ROW15,W
CALL SHIFTOUT
CALL CHOT
CALL SCR15
CALL T1M
CALL CLR
MOVF ROW14,W
CALL SHIFTOUT
CALL CHOT
CALL SCR14
CALL T1M
CALL CLR
MOVF ROW13,W
CALL SHIFTOUT
CALL CHOT
CALL SCR13
CALL T1M
CALL CLR
MOVF ROW12,W
CALL SHIFTOUT
CALL CHOT
CALL SCR12
CALL T1M
CALL CLR
MOVF ROW11,W
CALL SHIFTOUT
CALL CHOT
CALL SCR11
CALL T1M
CALL CLR
MOVF ROW10,W
CALL SHIFTOUT
CALL CHOT
CALL SCR10
CALL T1M
CALL CLR
MOVF ROW9,W
CALL SHIFTOUT
CALL CHOT
CALL SCR9
CALL T1M
CALL CLR
MOVF ROW8,W
CALL SHIFTOUT; GOI CT DICH BIT
CALL CHOT
CALL SCR8
CALL T1M ;DELAY 1MS
CALL CLR
MOVF ROW7,W
CALL SHIFTOUT
CALL CHOT
CALL SCR7
CALL T1M
CALL CLR
MOVF ROW6,W
CALL SHIFTOUT
CALL CHOT
CALL SCR6
CALL T1M
CALL CLR
MOVF ROW5,W
CALL SHIFTOUT
CALL CHOT
CALL SCR5
CALL T1M
CALL CLR
MOVF ROW4,W
CALL SHIFTOUT
CALL CHOT
CALL SCR4
CALL T1M
CALL CLR
MOVF ROW3,W
CALL SHIFTOUT
CALL CHOT
CALL SCR3
CALL T1M
CALL CLR
MOVF ROW2,W
CALL SHIFTOUT
CALL CHOT
CALL SCR2
CALL T1M
CALL CLR
MOVF ROW1,W
CALL SHIFTOUT
CALL CHOT
CALL SCR1
CALL T1M
RETURN
UP
MOVF ROW2,W
MOVWF ROW1
MOVF ROW3,W
MOVWF ROW2
MOVF ROW4,W
MOVWF ROW3
MOVF ROW5,W
MOVWF ROW4
MOVF ROW6,W
MOVWF ROW5
MOVF ROW7,W
MOVWF ROW6
MOVF ROW8,W
MOVWF ROW7
MOVF ROW9,W
MOVWF ROW8
MOVF ROW10,W
MOVWF ROW9
MOVF ROW11,W
MOVWF ROW10
MOVF ROW12,W
MOVWF ROW11
MOVF ROW13,W
MOVWF ROW12
MOVF ROW14,W
MOVWF ROW13
MOVF ROW15,W
MOVWF ROW14
MOVF ROW16,W
MOVWF ROW15
RETURN
T1M
CLRF DELAY_L
MOVLW D'1'
MOVWF DELAY_M
LOOP DECFSZ DELAY_L
GOTO LOOP
DECFSZ DELAY_M
GOTO LOOP
RETURN
SHIFTOUT
MOVWF SHIFT
MOVLW D'8';DEM 8 BIT DU LIEU
MOVWF COUNTS
TESTBIT
BCF DATA
BTFSC SHIFT,7
BSF DATA
BSF CLOCK
NOP
BCF CLOCK
RLF SHIFT,1
; MOVWF SHIFT
DECFSZ COUNTS
GOTO TESTBIT
RETURN
CLR
BCF CLEAR
NOP
BSF CLEAR
RETURN
CHOT
BSF LATCH
NOP
BCF LATCH
RETURN
SCR1 MOVLW D'1'
MOVWF PORTA
RETURN
SCR2
MOVLW D'2'
MOVWF PORTA
RETURN
SCR3
MOVLW D'3'
MOVWF PORTA
RETURN
SCR4
MOVLW D'4'
MOVWF PORTA
RETURN
SCR5
MOVLW D'5'
MOVWF PORTA
RETURN
SCR6
MOVLW D'6'
MOVWF PORTA
RETURN
SCR7
MOVLW D'7'
MOVWF PORTA
RETURN
SCR8 MOVLW D'8'
MOVWF PORTA
RETURN
SCR9 MOVLW D'9'
MOVWF PORTA
RETURN
SCR10 MOVLW D'10'
MOVWF PORTA
RETURN
SCR11 MOVLW D'11'
MOVWF PORTA
RETURN
SCR12 MOVLW D'12'
MOVWF PORTA
RETURN
SCR13 MOVLW D'13'
MOVWF PORTA
RETURN
SCR14 MOVLW D'14'
MOVWF PORTA
RETURN
SCR15 MOVLW D'15'
MOVWF PORTA
RETURN
SCR16 MOVLW D'16'
MOVWF PORTA
RETURN
TABLE ADDWF PCL
RETLW 0X00
RETLW B'10000001'
RETLW B'01111110'
RETLW B'01111110'
RETLW B'10111101'
RETLW B'11111111'
RETLW B'11111111'
RETLW B'10000000'
RETLW B'01111111'
RETLW B'01111111'
RETLW B'10000000'
RETLW B'11111111'
RETLW B'11111111'
RETLW B'00000000'
RETLW B'11111011'
RETLW B'11101111'
RETLW B'00000000'
RETLW B'11111111'
RETLW B'11111111'
RETLW B'10000001'
RETLW B'01111110'
RETLW B'01101110'
RETLW B'00001101'
RETLW B'11111111'
RETLW B'11111111'
RETLW B'11111111'
RETLW B'11111111'
RETLW B'11111111'
RETLW B'11111111'
RETLW D'20'
END -
20-11-2010 09:48 PMDCPcó bác nào giúp em một chút không?