|
Tài trợ cho PIC Vietnam |
Cảm biến Camera, siêu âm, hồng ngoại, gyro, la bàn... |
|
Ðiều Chỉnh | Xếp Bài |
14-12-2010, 09:23 AM | #1 |
Nhập môn đệ tử
Tham gia ngày: Oct 2010
Bài gửi: 2
: |
chương trình đọc adc dùng pic 16f877a lm35
đây là đoạn lệnh của mình. k biết sai gì mà báo đến 59 lỗi hiz
Mong các sư huynh giúp đỡ gấp.Vì mai là nộp bài rồi Chân thành cảm ơn PROCESSOR 16F877A #INCLUDE <P16F877A.INC> ORG 0000H BSF STATUS,5 BCF STATUS,6 BSF TRISA,0 BSF TRISA,3 CLRF TRISB BCF STATUS,5 CLRF PORTA CLRF PORTB MAIN CALL ADC CALL XULYMACH GOTO MAIN XULYMACH MOVLW D'10' SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XULY MOVLW D'20' SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XULY1 MOVLW D'30' SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XULY2 MOVLW D'40' SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XULY3 MOVLW D'50' SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XULY4 MOVLW D'60' SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XULY5 MOVLW D'70' SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XULY6 MOVLW D'80' SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XULY7 MOVLW D'90' SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XULY8 XULY BCF STATUS,5 MOVLW D'6' ADDWF ADRESL,0 GOTO XUAT XULY1 MOVLW D'12' ADDWF ADRESL,0 GOTO XUAT XULY2 MOVLW D'18' ADDWF Z ADRESL,0 GOTO XUAT XULY3 MOVLW D'24' ADDWF ADRESL,0 GOTO XUAT XULY4 MOVLW D'30' ADDWF ADRESL,0 GOTO XUAT XULY5 MOVLW D'36' ADDWF ADRESL,0 GOTO XUAT XULY6 MOVLW D'42' ADDWF ADRESL,0 GOTO XUAT XULY7 MOVLW D'48' ADDWF ADRESL,0 GOTO XUAT XULY8 MOVLW D'54' ADDWF ADRESL,0 GOTO XUAT XUAT BSF STATUS,5 MOVWF PORTB GOTO MAIN ADC BSF STATUS,5 BCF STATUS,6 BCF ADCON1,3 BSF ADCON1,2 BCF ADCON1,1 BSF ADCON1,0 BCF STATUS,5 BCF ADCON0,5 BCF ADCON0,4 BCF ADCON0,3 BCF ADCON0,7 BCF ADCON0,6 BSF STATUS,5 BSF ADCON1,6 BCF ADCON1,7 BCF STATUS,5 BSF ADCON0,0 BSF ADCON0,2 LOOP BCF STATUS,5 BTFSC ADCON0,2 GOTO LOOP RETURN END |
14-12-2010, 09:41 AM | #2 |
Đệ tử 2 túi
Tham gia ngày: Aug 2010
Bài gửi: 42
: |
tôi tìm 1 lỗi ở line 108. xem 877a.lst sẽ rỏ hơn nhiều
|
14-12-2010, 09:46 AM | #3 |
Nhập môn đệ tử
Tham gia ngày: Oct 2010
Bài gửi: 2
: |
vẫn 61 lỗi luôn huynh ơi. Bạn có thể text giúp mình xem rõ lổi ở đâu và sữa lại giúp mình được k???
|
21-12-2010, 11:14 PM | #4 |
Đệ tử 5 túi
Tham gia ngày: Dec 2010
Bài gửi: 101
: |
tham khao bai minh viet nhe ban
bai 1 :3led
chon noi luu 8bit cao tai thanh ghi adresh va 2 bit thap adresl bai nay khong su dung ic giai ma cho led 7 doan TITLE "MACH DO NHIET DUNG LM35 CO DO PHAN DAI TU 0 DEN 150" PROCESSOR 16F877A #INCLUDE<P16F877A.INC> __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF CHUC EQU 20H COUNT1 EQU 21H COUNTA EQU 22H COUNTB EQU 23H TRAM EQU 24H ORG 0000H BCF STATUS,6 BSF STATUS,5 CLRF TRISB CLRF TRISE CLRF TRISD BSF TRISA,0 BCF STATUS,5 CLRF PORTB CLRF PORTE CLRF PORTD CLRF PORTA MAIN CLRF TRAM CLRF CHUC CALL DOCADC RLF ADRESH,1 MOVLW B'11111110' ANDWF ADRESH,1 MOVLW D'26' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO XUAT DECF ADRESH,1 MOVLW D'66' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO XUAT DECF ADRESH,1 MOVLW D'105' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO XUAT2 DECF ADRESH,1 MOVLW D'145' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO XUAT DECF ADRESH,1 XUAT2 MOVLW B'10000000' BSF STATUS,5 SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XUATDULIEU BCF STATUS,5 MOVLW D'104' XORWF ADRESH,0 BTFSS STATUS,2 GOTO XUATDULIEU2 GOTO XUATDULIEU XUAT MOVLW B'10000000' BSF STATUS,5 SUBWF ADRESL,0 BTFSS STATUS,0 GOTO XUATDULIEU BCF STATUS,5 MOVLW D'65' XORWF ADRESH,0 BTFSS STATUS,2 GOTO XUATDULIEU2 XUATDULIEU BCF STATUS,5 GOTO KIEMTRASANGTAT XUATDULIEU2 INCF ADRESH GOTO KIEMTRASANGTAT KIEMTRASANGTAT BCF STATUS,5 MOVLW D'60' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO OFF BSF PORTD,0 GOTO TACHSO OFF BCF PORTD,0 TACHSO MOVLW D'100' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO KIEMTRACHUC INCF TRAM,1 MOVWF ADRESH GOTO TACHSO KIEMTRACHUC BCF STATUS,5 MOVLW D'10' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO XUATSO INCF CHUC,1 MOVWF ADRESH GOTO KIEMTRACHUC XUATSO MOVF TRAM,W CALL BANG MOVWF PORTB MOVLW B'1111110' MOVWF PORTE CALL DELAY MOVF CHUC,W CALL BANG MOVWF PORTB MOVLW B'11111101' MOVWF PORTE CALL DELAY MOVF ADRESH,W CALL BANG MOVWF PORTB MOVLW B'11111011' MOVWF PORTE CALL DELAY GOTO MAIN DOCADC BSF STATUS,5 BSF ADCON1,3 BSF ADCON1,2 BSF ADCON1,1 BCF ADCON1,0 BCF STATUS,5 BCF ADCON0,5 BCF ADCON0,4 BCF ADCON0,3 BCF ADCON0,7 BCF ADCON0,6 BSF STATUS,5 BSF ADCON1,6 BCF ADCON1,7 BCF STATUS,5 BSF ADCON0,0 BSF ADCON0,2 LOOP1 BCF STATUS,5 BTFSC ADCON0,2 GOTO LOOP1 RETURN BANG ADDWF PCL,1 RETLW B'11000000' RETLW B'11111001' RETLW B'10100100' RETLW B'10110000' RETLW B'10011001' RETLW B'10010010' RETLW B'10000010' RETLW B'11111000' RETLW B'10000000' RETLW B'10010000' DELAY MOVLW D'10' MOVWF COUNT1 LOOP2 MOVLW D'199' MOVWF COUNTA MOVLW D'1' MOVWF COUNTB LOOP0 DECFSZ COUNTA,1 GOTO $+2 DECFSZ COUNTB,1 GOTO LOOP0 DECFSZ COUNT1,1 GOTO LOOP2 RETURN END bai2 :2 led chon noi luu 8bit thap tai thanh ghi adresl va 2 bit cao adresh PROCESSOR 16F877A #INCLUDE<P16F877A.INC> __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF CHUC EQU 20H COUNT1 EQU 21H COUNTA EQU 22H COUNTB EQU 23H TAM EQU 24H DONVI EQU 25H ORG 0000H BCF STATUS,6 BSF STATUS,5 CLRF TRISB CLRF TRISE BSF TRISA,0 BCF STATUS,5 CLRF PORTB CLRF PORTE CLRF PORTA MAIN CLRF CHUC CALL DOCADC RLF ADRESH,1 MOVLW B'11111110' ANDWF ADRESH,1 MOVLW D'26' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO XUAT DECF ADRESH,1 MOVLW D'66' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO XUAT DECF ADRESH,1 XUAT MOVLW B'10000000' BSF STATUS,5 SUBWF ADRESL,0 BTFSS STATUS,0 GOTO TACHSO BCF STATUS,5 MOVLW D'65' XORWF ADRESH,0 BTFSS STATUS,2 INCF ADRESH TACHSO BCF STATUS,5 MOVLW D'10' SUBWF ADRESH,0 BTFSS STATUS,0 GOTO XUATSO INCF CHUC,1 MOVWF ADRESH GOTO TACHSO XUATSO MOVF CHUC,W CALL BANG MOVWF PORTB MOVLW B'11111110' MOVWF PORTE CALL DELAY MOVF ADRESH,W CALL BANG MOVWF PORTB MOVLW B'11111101' MOVWF PORTE CALL DELAY GOTO MAIN DOCADC BSF STATUS,5 BSF ADCON1,3 BSF ADCON1,2 BSF ADCON1,1 BCF ADCON1,0 BCF STATUS,5 BCF ADCON0,5 BCF ADCON0,4 BCF ADCON0,3 BCF ADCON0,7 BCF ADCON0,6 BSF STATUS,5 BSF ADCON1,6 BCF ADCON1,7 BCF STATUS,5 BSF ADCON0,0 BSF ADCON0,2 LOOP1 BCF STATUS,5 BTFSC ADCON0,2 GOTO LOOP1 RETURN BANG ADDWF PCL,1 RETLW B'11000000' RETLW B'11111001' RETLW B'10100100' RETLW B'10110000' RETLW B'10011001' RETLW B'10010010' RETLW B'10000010' RETLW B'11111000' RETLW B'10000000' RETLW B'10010000' DELAY MOVLW D'10' MOVWF COUNT1 LOOP2 MOVLW D'199' MOVWF COUNTA MOVLW D'1' MOVWF COUNTB LOOP0 DECFSZ COUNTA,1 GOTO $+2 DECFSZ COUNTB,1 GOTO LOOP0 DECFSZ COUNT1,1 GOTO LOOP2 RETURN END bai cua ban su dung thanh ghi adresl ma ban chua chon bank dung cho no du ban co dich khong loi thi chuong trinh no cung khong chay dc adresl la so bank1 tuc chon bank 1 truoc khi su dung adresl thay đổi nội dung bởi: phatcddt08a, 21-12-2010 lúc 11:24 PM. |
21-12-2010, 11:26 PM | #5 |
Đệ tử 5 túi
Tham gia ngày: Dec 2010
Bài gửi: 101
: |
file mo phong bai 1 va bai 2
cac ban thay can thi tham khao nhe
|
|
|