I need to change the RA0 and RA1 to Analog
i using ADCON1=$0d but no work
I need to change the RA0 and RA1 to Analog
i using ADCON1=$0d but no work
My Hobbies is PicBasic PRO
You need to set
TRISA.0 = 1 to make the pin an input
TRISA.2 = 1
ADCON0 = %xxxx
ADCON1 = %xxxxx
ADCON2 = %xxxx
You will have to sort out the xxx's to suit your particular application which you have told us nothing about.
Section 19 has it all.
HTH
Brian
i am reading Volts from 7.2v but the problems is my reading is 0 volts
i look the Data sheet for the pic18f2620 but i don now how i change to picbasic code.
this work example
ADCON0=000
ADCON1=001
please some example of the Data Sheet
My Hobbies is PicBasic PRO
Jetpr,
You do know that you cannot read 7.2 volts directly into the PIC, don't you? In the example Brian gave you you just replace the x with either a 1 or a 0, depending upon your needs. So if the datasheet says that a bit should be set, put a 1 in place of the x. If it should be cleared, then put a 0 in place of the x. You're setting it using hexadecimal, $0d, in the method Brian suggested 'ADCON1 = %xxxxxxxx' the percent sign means that you are using binary. So $0d becomes %00001101. The leftmost bit is bit seven, and the rightmost bit is bit zero. It's easier to make a change to a single bit if you get in the habit of using binary, although it can be confusing in the beginning. There are tables in the datasheet that will help you, just keep playing with it, and keep telling yourself that this is fun! You might also take a look on MeLabs website, find the examples for the LABX-USB board, they have examples for using an 18F4550 on that board, it should be close enough to get you started.
Good Luck,
Jerry.
If your oscilloscope costs more than your car...
Bookmarks