PDA

View Full Version : * Analog and Digital



cesar35
- 23rd November 2016, 18:31
Hello

And you need to set up 2 analog ports and 4 digital ports
Analog ports work well the buttons do not work
I am in doubt about the configuration of adc
Can anybody help me
About this
Here the schematic of pic18f2550
clear
DEFINE OSC 48
define LOADER_USED 1 'USB carregador de inicialização
define RESET_ORG 1000h

'--- Setup ADC -------------------------------------------------------------
TRISA=%11111111:PORTA=%00000000
TRISB=%00000011:PORTB=%00000000
TRISC=%11000010:PORTC=%00000000
ADCON1= %00001100
ADCON2.7 = 1 'Right-justify result in ADRESH:ADRESL
Define ADC_BITS 10 'Set number of bits in result
Define ADC_CLOCK 3 'Set clock source (3=rc)
Define ADC_SAMPLEUS 50 'Set sampling time in uS
Thank you

towlerg
- 23rd November 2016, 19:01
What value are you reading on A0 and A1?

cesar35
- 23rd November 2016, 20:23
Hello, how are you
The port AO and A1 will read 2 battery
And it will show on the LCD that it is not in the scheme there.
I'm not getting the input and output port configuration
thank you

towlerg
- 23rd November 2016, 22:51
So what value do you actually read on A0 and A1 ( a number somewhere between 0 and 1023)?

cesar35
- 24th November 2016, 10:07
Yes
I already have the channel reading AO and AI
My problem and the buttons that do not work on other channels
I have not eaten them two buttons
OK

towlerg
- 24th November 2016, 12:52
Sorry I didn't read your original post correctly, show more code.