derrick826
New Member
hi guys, may i know what is the step to enable the sleep mode for PIC to allow my ADC accuracy to be precise?
thanks in advance
thanks in advance
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Are you saying it didn't work correctly with the potentiometer?Before that i used a 1Kohm potential resistor to vary my voltages to the analogue pin but the values shown in the leds (10 leds= 10bit results) are incorrect.
derrick826 said:Is there a chance whereby i can convert a analogue voltage of about (0v-25V) using PIC into 10-bit digital result.. i'm aware that a circuitry has to be placed before as a regulator to reduce this analogue voltage (0v-25v)
derrick826 said:hi eric,
currently i am using the code which i posted just to convert a dc voltage of 0-5v into 10-bit digital form to tell wheather or not the converted value is accurate or not by displaying on the 10 LEDs connected to the port B. due to the 'not accurate' conversion , i tought that sleeping mode might be best cause it might give me a good accuracy in the conversion, (based on some website i read)
i'm using a POT variable 5kohm with a supply voltage of 5v connected in series with 470ohm into AN0 and as i turn the POT variable of 5kohm, the converted results are 1 bit more than the calculated result from the equation i mentioned. (Here's my question regarding on my situation above: is there any more accurate method which i can do to get a more precise converted value?)
derrick826 said:i'm using a POT variable 5kohm with a supply voltage of 5v connected in series with 470ohm into AN0 and as i turn the POT variable of 5kohm, the converted results are 1 bit more than the calculated result from the equation i mentioned. (Here's my question regarding on my situation above: is there any more accurate method which i can do to get a more precise converted value?)
.
derrick826 said:there's this problem which came up afterthat, when i turn my pot to max to allow higher voltage, it is measured to be 4.85v and all the LEDs are lighted up. when i left it for about 2 seconds and continue to minimize the voltage using the pot, the leds does not seem to change, they still stay all lighted up. i have to reset the circuit and vary the pot again to enable the AD conversion again
MOVLW b'[COLOR="Red"]10[/COLOR]000001'
MOVWF ADCON0
derrick826 said:org 0x000
goto start
int org 0x004
goto int
start
call initial
again
call startconv
call check
call result
goto again
initial
BCF STATUS,RP1
BSF STATUS,RP0
MOVLW b'00000001'
MOVWF TRISA
MOVLW b'00000000'
MOVWF TRISB
MOVLW b'00000000'
MOVWF TRISC
MOVLW b'00000000'
MOVWF TRISD
MOVLW b'10001110'
MOVWF ADCON1
BCF STATUS,RP1
BCF STATUS,RP0
MOVLW b'10000001'
MOVWF ADCON0
RETURN
startconv
BSF ADCON0,GO
RETURN
check
BTFSS PIR1,ADIF
goto check
MOVLW b'00000001'
MOVWF PORTC
BCF PIR1,ADIF
return
result
BCF STATUS,RP1
BSF STATUS,RP0
MOVFW ADRESL
MOVWF PORTB
BCF STATUS,RP1
BCF STATUS,RP0
MOVFW ADRESH
MOVWF PORTD
RETURN
END
bananasiong said:Hi,
The sampling rate of the PIC may not be high enough for the high input frequency. How many Hz do you want?
Even you have higher baudrate, the sampling rate is still an issue for higher frequency.
SPBRG can be changed for different baudrate. The values recommended are in the datasheet for different Fosc.