Picstart plus and pic18f2331


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2008
    Posts
    2

    Default Picstart plus and pic18f2331

    I am using MPLAB IDE version 8.10 and PICSTART PLUS version 04.50.9.

    I am trying to use the picstart plus to program my PIC18F2331.

    I have read the picstart plus realease note where it mentions I need to connect Vdd to Avdd pin and insert a 0.1uF cap between Vdd and Vss pin.

    But I have not been able to program my pic18f2331.

    So,I decided to do ICP.So,I connected wires from the pictstart plus to my pic18F2331 which is in a breadboard.

    I have connected pin 1 of the picstart plus to pin 1 of the pic18f2331.Similarly I have connected PGC and PGD pins and I have connected PGM pin low using a resistor to ground.I have connected Vdd and Vss pins to a power supply of 5V.I have connected everything as shown in the following link:

    http://melabs.com/support/icsp.htm

    But still no luck.

    Attached is my code that I am trying to burn in the PIC18F2331:

    #include <18F2331.h>
    #include <stdio.h>
    #include <Stdlib.h>
    #include <MATH.h>
    #include <String.h>
    #use delay (clock=20000000)
    #fuses XT,NOWDT,NOPUT,NOPROTECT,NOLVP,NOMCLR,BORV27,HPOL_ HIGH,LPOL_HIGH,T1STANDARD
    #byte port_b=0x81

    void main() {
    set_tris_b(0x00);
    port_b=0;

    while(TRUE){
    output_high(PIN_B2);
    delay_us(500);
    output_low(PIN_B2);
    delay_us(500);
    output_high(PIN_B1);
    delay_us(500);
    output_low(PIN_B1);
    delay_us(500);
    output_high(PIN_B0);
    delay_us(500);
    output_low(PIN_B0);
    delay_us(500);
    }
    }


    I export the hex file to MPLAB and then use picstart to program my pic.

    When I do a erase I get "Erase operation is successful."

    When I do a blank check I get

    "Device is NOT blank:
    Program Memory
    Configuration Bits
    IDs
    Data Memory
    "

    When I do a read I get

    "Device is data protected! Data memory may be invalid.

    Device is code protected! Program memory may be invalid.
    "
    When I select program I get

    "PICSTART Program\Verify Report
    24-Nov-2008, 17:57:29

    Device Type: PIC18F2331
    Address Range 0-1fff


    Programming/Verification completed successfully
    "

    Does that mean my I was able to program the pic successfully?Because once I hook up the LEDS to the pin b0,b1 and b2 nothing happens it just remains off.

    Can anyone help me?

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    It looks like you are writing your code in C and we do PBP here from MeLabs.

    Anyway, not sure in C, but the fuses look wrong
    Code:
    __CONFIG    _CONFIG1H, _OSC_XT_1H
    
    __CONFIG    _CONFIG2H, _WDTEN_ON_2H & _WDPS_512_2H
    
    __CONFIG    _CONFIG4L, _LVP_OFF_4L
    In program files under microchip-mpasam suite, find the *.inc file for the chip you are using. At the end of the file it shows all of the different fuse settings.

    THe PICSTART+ - try a larger capacitor. I have had to use up to a 22 uf.

    Programming/Verification completed successfully
    Yes, that means what it says, but like I said, something is wrong with the fuses. Code Protection is also turned on.

    Try writing and compiling your code in MPLAB. Look at how the fuses are set after you compile under settings in the tool bar.

    This site may help
    http://www.piclist.com/techref/piclist/index.htm
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I had the same problem with the 18F2431, there's a thread about it here. Basicly all I had to do was add a 1k resistor between pin7 and pin11. But I programmed mine IN the PICStart socket and there's notes in the PICStart help file that you must connect ALL the power-pins in order for it to work. Any way, read the above thread and I think you'll be able to get that chip programmed.

    /Henrik.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I can't help with the PICStart+ programming for an 18F2331, but I do see a few potential problems.

    #byte port_b=0x81 should be #byte port_b=0xF81.

    Also you should have HS VS XT as your #fuses option for a 20MHz crystal. XT provides a lower drive
    level, which may not be providing enough drive signal for your 20MHz crystal.

    For help with CCS C code, config options, etc.. check here http://www.ccsinfo.com/forum/
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Join Date
    Nov 2008
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    Henrik,

    I have connected a 1k resistor between pin 7 and pin 11.Also, connected pin 7 to pin 20 (AVDD AND VDD pins) and pin 8 to pin 19 (AVSS and VSS pins).Then when I do a blank check I get:
    "
    Device is NOT blank:
    Program Memory
    Configuration Bits
    IDs
    Data Memory
    "

    Then when I do a read I get:

    "
    Device is data protected! Data memory may be invalid.

    Device is code protected! Program memory may be invalid.
    "

    I looked at the thread you asked me to take a look at and they show how to do ICSP.I have done that but still I have not solved the problem.

    Did you use MPLAB IDE version 8.10 and picstart firmware version 04.50.09?

    It seems that for some reason I cannot erase my pic18f2331???????

    Please let me know.

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    This is from when I asked MicrChip about a similar problem .
    Customer Update 3/10/2007 8:01

    I think I fixed the problem. Placed the 18F4320 in a breadbord and jumped from MCLR, RB6, RB7, and VSS. Powered the chip with an external power supply with a 4.7uf across VDD and VSS.

    Working 100% of the time now.


    Customer Update 3/9/2007 13:37

    9 out 14 chips are programming approx 75% of the time with a 4.7uf. It is getting better.

    Thank you for your help.

    Support Response 3/9/2007 12:03

    To program the 18f4320 on the PS+ may require the placement of a 0.1uF bypass capacitor from the VDD pin to the VSS pin of the device to successfully program the device. If programming failures still arise, try increasing this value incrementally to a maximum of 10uF. A low ESR capacitor such as a tantalum is recommended.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    It's been a year or two since I actually used the PICStart+ (other hobbies to has gotten my attention lately) so I don't remember what firmware it has or what version of MPLAB I used. But I know that I wrote about the whole thing in the previously linked thread, everything I had to do is in there. If it still doesn't work for you I don't think I can help, sorry.

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