Help pic18f2620


Closed Thread
Results 1 to 4 of 4

Thread: Help pic18f2620

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133

    Exclamation Help pic18f2620

    I need to change the RA0 and RA1 to Analog

    i using ADCON1=$0d but no work
    My Hobbies is PicBasic PRO

  2. #2


    Did you find this post helpful? Yes | No

    Default Section 19

    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

  3. #3
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133


    Did you find this post helpful? Yes | No

    Exclamation

    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

  4. #4
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    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...

Similar Threads

  1. I2C Slave with a PIC
    By ralfmayr in forum mel PIC BASIC Pro
    Replies: 129
    Last Post: - 21st August 2016, 17:44
  2. Need help with a pulse counter project PIC18F2620
    By blackrider in forum Schematics
    Replies: 1
    Last Post: - 29th April 2009, 00:08
  3. pic18f2620 freezing
    By jetpr in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th January 2009, 16:50
  4. Serout2 pic18f2620
    By cerio in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd May 2007, 23:06
  5. PIC18F2620 "out of memory"??
    By Ron Marcus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 3rd January 2006, 01:01

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts