PIC18F4620 Programming problem


Closed Thread
Results 1 to 16 of 16
  1. #1
    Join Date
    Dec 2008
    Posts
    21

    Default PIC18F4620 Programming problem

    Hello everyone. I am having a problem with PBP where I am not able to program my PIC18F4620. I know everything is OK with my PIC and the circuit as I can use another program called PIC18 Simulator IDE to program it and everything works fine. I use a bootloader but even without the booloader it just doesn't work when I try to program it with PBP. I am thinking that I must have something not configure properly on my PBP or something. I'll appreciate if someone can help with this as I have already spent three days on this and can't locate the problem. Following my code:

    '********************
    DEFINE LOADER_USED 1 'Bootloader Used
    @ __CONFIG _CONFIG1H, _OSC_HS_1H
    DEFINE OSC 8
    loop:
    Serout2 PORTB.7,16468,["Testing123"] 'For PC
    High PORTA.0
    Low PORTD.0
    pause 1000
    Low PORTA.0
    High PORTD.0
    pause 1000
    Goto loop
    '*********************


    Thanks in advance.

    Javier.
    Last edited by JavPar; - 5th December 2008 at 04:34.

  2. #2
    fronkensteen's Avatar
    fronkensteen Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JavPar View Post
    Hello everyone. I am having a problem with PBP where I am not able to program my PIC18F4620. I know everything is OK with my PIC and the circuit as I can use another program called PIC18 Simulator IDE to program it and everything works fine. I use a bootloader but even without the booloader it just doesn't work when I try to program it with PBP. I am thinking that I must have something not configure properly on my PBP or something. I'll appreciate if someone can help with this as I have already spent three days on this and can't locate the problem. Following my code:
    Saw this one earlier today

    http://www.picbasic.co.uk/forum/showthread.php?t=10214

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

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

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

  6. #6
    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?

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

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

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

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

  11. #11
    Join Date
    Dec 2008
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Hey guys, tried both suggestions and still not working. My code looks like this:

    DEFINE LOADER_USED 1 'Bootloader Used
    '@ __CONFIG _CONFIG1H, _OSC_HS_1H
    @ __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
    ADCON1=15
    DEFINE OSC 8
    loop:
    Serout2 PORTB.7,16468,["Testing123"] 'For PC
    High PORTA.0
    Low PORTD.0
    pause 1000
    Low PORTA.0
    High PORTD.0
    pause 1000
    Goto loop

    I still think that the problem could reside in MicroCode Studio. I will continue working on it tonight.

  12. #12
    fronkensteen's Avatar
    fronkensteen Guest


    Did you find this post helpful? Yes | No

    Default

    Decrease the pauses to pause 1 and see what happens.

  13. #13
    Join Date
    Dec 2008
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Changed the pauses to 1, but nothing. No change.

  14. #14
    fronkensteen's Avatar
    fronkensteen Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JavPar View Post
    Changed the pauses to 1, but nothing. No change.
    How long did you let it run?

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


    Did you find this post helpful? Yes | No

    Default

    Hi Javier,
    Which programmer are you using when you don't use the bootloader? Did you set it up in Microcode Studio? You may have to set the configuration settings for your programmer manually, or you may have to change a setting to allow the programmer to read from your file first.

    Good Luck,

    Jerry
    If your oscilloscope costs more than your car...

  16. #16
    Join Date
    Dec 2008
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    OK, problem solved. On my MicroCode Studio Plus it was showing the In Circuit Debug (ICD) toolbar. I was pressing ICD compile and program button instead of the normal compile and debug button. Now everything is working 100%.

    Thanks to all of you for your kind help.

    Javier.

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 : 1

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