PIC18F4620 Programming problem


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Welcome to the forum.

    Here is how it works with people trying to sell books and simulators.

    I made an LED blink on a 16F84...Now I am expert with MiroChips!
    I will write a book.

    I downloaded a compiler to use... made LED blink..Expert again!
    I will make a Simulator.

    It is obvious the person that made the simulator does not know PIC chips or they would have had an error show when you are trying to use an ADC pin as an output before it has been set up for that function.

    Stop wasting your time with that crap and spend the same time reading the data sheet and the manual of the parts/ compiler you are using.

    This thread should get you going.
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    It talks about setting the ADC to digital.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Dec 2008
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Thank you for the links, but they do not help me. Maybe I didn't explain myself clearly. I only use the simulator to write the code which I burn into the chip which works 100% in my real life circuit. I use the melabs U2 programmer. Regarding reading the datasheet, I have it and I always refer to it when working on my chip.

    I am trying to NOT use the simulator program anymore so I can only use PBP. But it is not working.

    Javier.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JavPar View Post
    I only use the simulator to write the code which I burn into the chip which works 100% in my real life circuit.
    I am trying to NOT use the simulator program anymore so I can only use PBP. But it is not working.
    I am not sure what is not working.
    Dave
    Always wear safety glasses while programming.

  4. #4
    fronkensteen's Avatar
    fronkensteen Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JavPar View Post
    Maybe I didn't explain myself clearly.
    There's no maybe about it.

    Regarding reading the datasheet, I have it and I always refer to it when working on my chip.
    And if you actually did have and/or use the datasheet, you would know that PortA.0 (and many other pin) function as analog inputs upon reset and will not function as digital outputs without further configuration.

    I am trying to NOT use the simulator program anymore so I can only use PBP. But it is not working.
    Huh?

  5. #5
    Join Date
    Dec 2008
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    I really appreciate you guys trying to help. The code that you see on my previous post makes the leds blinks, both porta.0 and portd.0. I do not know about other pics, but on the 18F4620 the port is digital as per the datasheet. If you want to use for ADC, then you must specify it on code. It is on chapter 19 of the datasheet. Again, the code works 100% when I use the Basic editor on the simulator or if I use assembler. I only use the basic editor of the simulator to write the code and create the hex file to then burn it on the chip.

    My point is, when I use MicroCode Studio to write code and I want to pass it to my chip, the code does not work. In other words, the leds do not blink. I think there might be something wrong or I am doing something wrong on my code.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    but on the 18F4620 the port is digital as per the datasheet. If you want to use for ADC, then you must specify it on code.
    That is the part you have backwards. You have to make the pins digital.

    So... refer to the link I gave you and try
    Code:
    ADCON1=15
    Keep reading chapter 19 and look at
    REGISTER 19-2: ADCON1: A/D CONTROL REGISTER 1
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Dec 2008
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    I could think that it is why led on port a is not turning on, but what about led on port d.

    I have to leave to work now but I will defenetaly try your suggestion when I get back tonight.

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Looking at your code again. The
    DEFINE OSC 8
    leads me to believe you are using the internal OSC. If so try this
    Code:
    @ __CONFIG    _CONFIG1H, _OSC_INTIO67_1H
    @ __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
    @ __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
    @ __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    in place of you config line.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. 16F676 programming problem
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th May 2009, 17:39
  2. Programming Problem with PIC16F819
    By Dick Ivers in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 24th July 2007, 18:42
  3. Problem with Interrupt on PIC18F4620 PORTB
    By rookie in forum Off Topic
    Replies: 1
    Last Post: - 22nd March 2007, 01:34
  4. Problem programming the PIC16F648A
    By Edgardo_2 in forum General
    Replies: 2
    Last Post: - 29th December 2006, 00:02
  5. Problem with "on Interrupt" and PIC18F4620
    By philtep in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st September 2005, 02:24

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