Noman Yousaf
Full Member level 4
- Joined
- Nov 19, 2003
- Messages
- 208
- Helped
- 3
- Reputation
- 6
- Reaction score
- 2
- Trophy points
- 1,298
- Location
- Lahore Pakistan
- Activity points
- 1,763
i m using 16F676 for ADC output on porta.
the problems are:
1: result is not stable even selected input is on 0V (ground). it gives 1's and 0's on porta.
system is:
i m using internal MCLR, and oscillator. Vref is VDD. and i m geting only lsb byte on the PORTA.
the program is as follows.
plz check is there any mistake in it or not
the problems are:
1: result is not stable even selected input is on 0V (ground). it gives 1's and 0's on porta.
system is:
i m using internal MCLR, and oscillator. Vref is VDD. and i m geting only lsb byte on the PORTA.
the program is as follows.
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;THIS IS THE SOFTWARE OF adc #include "P16F676.INC" BSF STATUS,RP0 CLRF TRISA MOVLW 3FH MOVWF TRISC BCF STATUS,RP0 MOVLW B'10011001' MOVWF ADCON0 BSF STATUS,RP0 MOVLW B'00110000' MOVWF ADCON1 MOVLW B'01000000' MOVWF ANSEL BCF STATUS,RP0 MAIN CALL DELAY CALL READ_ADC GOTO MAIN DELAY BCF STATUS,RP0 MOVLW 0FFH MOVWF 20H DL2 MOVLW 0FFH MOVWF 21H DL1 DECFSZ 21H GOTO DL1 DECFSZ 20H GOTO DL2 BSF STATUS,RP0 RETURN READ_ADC BCF STATUS,RP0 BSF ADCON0,1 R_AD BTFSC ADCON0,GO GOTO R_AD BSF STATUS,RP0 MOVFW ADRESL BCF STATUS,RP0 MOVWF PORTA RETURN END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
plz check is there any mistake in it or not
Last edited by a moderator: