melabs U2 programmer won't program 12F675


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default melabs U2 programmer won't program 12F675

    I have a simple LED candle simulator used in a stage musical. I built a dozen of them 3 years ago and they worked a treat. I went to build some more with newer brighter LEDs but the old code in the same programmer only gives me 'target device does not match selected device'. I took an older unit and tried to re-program it. It too gave me the device mismatch error and now a previously working unit has died.

    The code is attached. I suspect the problem is a setup issue in the programmer but I just can't find it. MCSPX, PBP3, melabs programmer ver 4.40

    /code
    '************************************************* ***************
    '* Name : Mack & Polly Candle 1.pbp *
    '* Author : Brian Taylor *
    '* Notice : Copyright (c) 2011 Brian Taylor *
    '* : All Rights Reserved *
    '* Date : 19 NOV 2011 *
    '* Version : 2.0 *
    '* Notes : Revised for brighter LEDs for M&P New York 2011 *
    '************************************************* ***************
    data @0, "Candle 1 rev2 19 NOV 2011"

    'cccccccccc CONFIG set via melabs USB serial pgmr ccccccccccccccc
    'INTOSC no clock out.
    'WDT enabled
    'PWRTE enabled
    'MCLRE = 0 = pin is I/O
    'BODEN enabled
    'CP Code Protect disabled
    'CPD Data Code Protection disabled
    'cccccccccccccccccccccccc end configuration ccccccccccccccccccccc

    'DEVICE PIC12F675 Power pin 1, Gnd pin 8

    LED1 var GPIO.0 ' LED pin 7
    LED2 var GPIO.1 ' LED pin 6
    LED3 var GPIO.2 ' LED pin 5
    SpareIO3 var GPIO.3 ' Input pin 4 also MCLR & Vpp. Ground via 10k
    LED4 var GPIO.4 ' LED pin 3
    SpareIO5 var GPIO.5 ' pin 2

    TRISIO = %00001000 ' all outputs except MCLR.
    CMCON = %00000111 ' disable comparators
    OPTION_REG = %10000000 ' WPU disabled
    ANSEL = %00000000 ' All digital
    INTCON = %00000000 ' All interrupts disabled
    OSCCAL = %10000000 ' mid range

    A var byte : B var byte
    W var word : X var word

    define osc 4

    Blink:
    for a = 0 to 3
    low led1 : pause 200 : high led1 : pause 300
    next a

    Main: 'mmmmmmmmmmmmmmmmmmmmmmmm MAIN mmmmmmmmmmmmmmmmmmmmmmmmmm


    TRISIO = %00001000 ' all outputs except GPIO.3
    CMCON = %00000111 ' disable comparators
    OPTION_REG = %10000000 ' WPU disabled
    ANSEL = %00000000 ' All digital
    INTCON = %00000000 ' All interrupts disabled
    OSCCAL = %10000000 ' mid range

    SelectLEDs:
    random w
    a = w.byte0 & %00111111
    gpio = a

    SelectOnTime:
    random x
    b = x.byte0
    pause b

    DoItAgain
    goto main
    ZZZZ: 'zzzzzzzzzzzzzzzzzzzzzzzzzz end zzzzzzzzzzzzzzzzzzzzzzzzzz

    /endcode


    Any suggestions gratefully received.

    BrianT

  2. #2
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default Re: melabs U2 programmer won't program 12F675

    Hi Brian,

    I don't know if this is the correct way, or if there are other ramifications, but I was just working on a similar problem that I caused myself by accidentally erasing the OSCCON on a 10F222. I'm using a similar setup: MCSPX, PBP3, melabs programmer ver 4.41. The workaround that got me out of the jam was in the programmer (U2):
    <OPTIONS>,
    <More options>
    un-select <Verify Target Device ID>

    Hope this helps
    Bo

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


    Did you find this post helpful? Yes | No

    Default Re: melabs U2 programmer won't program 12F675

    This may be a stupid question but...
    'target device does not match selected device'
    Do you have the corect chip selected any and every place it can be selected, (IDE,Compiler, Programmer ) ?
    Dave
    Always wear safety glasses while programming.

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: melabs U2 programmer won't program 12F675

    I can program fresh SMD PIC12F675 with the melabs U2 USB programmer via the melabs 8/14 pin programming adapter but that assumes loose chips before soldering to the board. I have my candle board set up for ICSP and I have a short, ~35 mm, cable between the U2 and the board with the 12F675 on it. That cable is the exact one I used when I first built the boards and I do not recall ever having any problems. Now it definitely does not work so I suspect there may have been some timing tweaks in the melabs programmer code that render my ICSP lead invalid.

    I will remove all the PIC12F675 from the boards and reprogram them off board.

    Thanks for your help.

    Cheers
    Brian

  5. #5
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default Re: melabs U2 programmer won't program 12F675

    Brian, if fresh devices program ok, and you have a problem only with re-programming, try enabling Vpp-before-Vdd in your programming software. This is a common problem with these devices if you are using the internal oscillator, AND have disabled mclr.

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: melabs U2 programmer won't program 12F675

    Hi Ardhuru,
    Thanks for the tip but I am not sure I can use it. On a scope I can see Vpp jumps from zero to about 14 volts about 100 microseconds before switched Vdd comes up. Is that what you mean? I can't change timing inside the melabs U2 programmer.

    I have tried powering the target PCB three ways.
    One was to power the PIC via the melabs programmer Vdd line. They give a caution that current is limited but I am only powering the PIC chip and there are no other components on the board. The programming voltage reads 13.8 with Vdd 4.88.
    Two was to power the PIC via switched Vdd. Again no other components on the board.
    Three was to power the target board with the normal 5 volt supply and then attempt programming.

    I am sure the target PIC is getting erased as I can do a READ and see all memory cells are 3fff.

    When I hit 'program' the device appears to be taking code but on verify it gives me a 'code programming error at location 0000'.

    I give up.

    BrianT

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