Advice please - Warning message


Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 40 of 51
  1. #1
    malc-c's Avatar
    malc-c Guest

    Default Advice please - Warning message

    Hi guys and gals,

    I'm playing with PBP and the 18F2550 pic (as I had one to hand), and just trying to do some basic LED flashing as a start for a new version of an old project.

    I've downloaded the latest patch for PBP 2.46, and the latest version of Microcode studio. I'm also using MPASM (I've used MPLA 7.31 as I've just re-ghosted the PC and that was what was on it at the time I made the ghost image )

    I've ported some code I used for a previous vesion of this project based on a 16F628a into a blank page in microcode studio and compiled it. It through out several warnings, which with the help of the search function of this forum I've resolved by editing the INC file. However it now compiles fine, but shows a warning.

    I know that warnings don't affect the operation of the code, but I would like to know what it means so as to further my knowledge. I'm still a noobe when it comes to working with different chips and although I've looked at the datasheet it still makes little sence. I assume that its because the 18F has a different number of bits in its words or something ??

    Anyway, here's the code

    Code:
    ;************ set up PIC *****************
    PORTA = 0                        ' declare port level BEFORE port direction = safe power-on
    CMCON = 7                        ' PortA Digital inputs
    CCP1CON = 0                      ' PWM off
    
    
    
    TRISA=%11100111                  'set PORTA as all input apart from A3 & A4
    TRISB=%00000000                  'set PORTB as all output
    
    @RC_OSC_NOCLKOUT 
    @WDT_ON
    @PWRT_ON
    @MCLR_OFF
    @BOD_ON
    @LVP_OFF
    @CPD_OFF
    @PROTECT_OFF
    
    ;************* set up pattern data **********
        
    Patt1 DATA 16,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1 
    Patt2 DATA 8,129,66,36,24,24,36,66,129 
    Patt3 DATA 16,1,3,2,6,4,12,8,24,16,48,32,96,64,192,128,0 
    Patt4 DATA 16,1,128,2,64,4,32,8,16,8,32,4,64,2,128,1,0 
    Patt5 DATA 12,24,60,126,255,231,195,129,0,129,195,231,255 
    Patt6 DATA 13,1,2,4,8,17,34,68,136,16,32,64,128,0 
    Patt7 DATA 8,128,64,32,16,8,4,2,1
    
    ;************* set up varibles ************
        
    i var byte                          ;used for for next loops
    D var byte                          ;used to store the result of the pot on port A1 and thus set timing delay
    scale var byte                      ;used in the POT command
    Scale = 254                         ;used to set range 
    SW1 var PORTA.6                     ;pattern cycle switch 
    SW2 var PORTA.0                     ;select music or clock
    mus var PORTA.2                     ;music input pin A2
    SWcount var byte                    ;used to count the button SW1 presses
    SWcount2 var byte
    swcount=1                           ;set default to pattern 1
    steps VAR BYTE                      ;used to store the number of steps in the pattern sequence
    counts VAR BYTE                     ;used in the FOR NEXT loop to run through the sequence
                                                                
    ;************* main program ****************
    counts = 0                          ;set the value of counts to the start of each pattern
    
    Main:
    Pot PORTA.1,scale,D                 ;used to read value from 10k pot
    if sw1=0 then swcount=swcount+1     ;check to see if up button pressed, if so add 1 to SWcount
    if sw2=0 then goto music
    pause 60                            ;debounce delay
    If swcount>7 then swcount=1         ;error trap for exceeding max patterns                          
    gosub sel1                          ;go to subroutine to select pattern based on Swcount value
    FOR counts = 1 TO steps             ;advance to through the entries
    gosub sel2                          ;go to subroutine to advance through sequence
    PAUSE D                             ;pause period set by varible D
    NEXT counts                         ;advance through loop to next position                    
    goto main:                          ;go back to the main program and run again
    
    
    music:
    if sw1=0 then swcount=swcount+1     ;cycles through the patterns by adding 1 to SWcount
    pause 60                            ;debounce delay
    If swcount>7 then swcount=1         ;error trap for exceeding max patterns                        
    gosub sel1                          ;go to subroutine to select pattern based on SWcount value
    If mus = 1 then counts = counts + 1 ;if bass or beat present move to the next step in pattern 
    gosub sel2                          ;go to subroutine to display pattern in current step
    If counts = steps then counts = 0   ;if counts then reset counts to 1
    goto music:                         ;go back to the start of the music section 
    
    ;************* Subroutines *****************
    Sel1:
    if swcount = 1 then read Patt1, steps   ;read the first value in data string patt1 and place it in steps
    if swcount = 2 then read Patt2, steps
    If swcount = 3 then read Patt3, steps
    if swcount = 4 then read Patt4, steps
    if swcount = 5 then read Patt5, steps
    If swcount = 6 then read Patt6, steps
    If swcount = 7 then Read patt7, steps
    return
    
    Sel2:
    if swcount = 1 then READ (Patt1+counts), PORTB  ;read the next value in patt1 and display it on PORTB
    if swcount = 2 then READ (Patt2+counts), PORTB
    if swcount = 3 then READ (Patt3+counts), PORTB
    if swcount = 4 then READ (Patt4+counts), PORTB
    if swcount = 5 then READ (Patt5+counts), PORTB
    if swcount = 6 then READ (Patt6+counts), PORTB
    if swcount = 7 then READ (Patt7+counts), PORTB
    RETURN
    And this is the warning that I get after it compiles

    Code:
    warning[202] (path and file name).mac48: Argument out of range. Least significant bit used
    Last edited by malc-c; - 9th December 2006 at 22:16.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yup but it's just a Warning, it will work... at least a simple test worked here. So just add
    @ errorlevel -202

    somewhere at the top of your code to override the MPASM error message.

    The warning problem comes with the LABEL+Byte variable.

    maybe there's something to work around in the MACRO somewhere... bah it works.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default Its amazing how rusty I am after 6 months break

    OK, I've breadboarded the 18F2550, with 8 LEDs running off port B, 4Mhz xtal across pins 9 & 10 with 22pf caps to gnd. 10K pull up on pin1 (MCLR) and power to the vdd and vss pins - but the LEDS don't run.

    My logic tells me that I need to set port be to digital, but can't for the life of me work out how to.

  4. #4
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default Thanks

    Thanks steve, I've added the line and it compiles now without showing the warning message (as you stated it would )

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    And... it was easier to hack than i thought....
    Code:
    Sel2:
    if swcount = 1 then READ ((Patt1>>0)+counts), PORTB  ;read the next value in patt1 and display it on PORTB
    if swcount = 2 then READ ((Patt2>>0)+counts), PORTB
    if swcount = 3 then READ ((Patt3>>0)+counts), PORTB
    if swcount = 4 then READ ((Patt4>>0)+counts), PORTB
    if swcount = 5 then READ ((Patt5>>0)+counts), PORTB
    if swcount = 6 then READ ((Patt6>>0)+counts), PORTB
    if swcount = 7 then READ ((Patt7>>0)+counts), PORTB
    RETURN
    OR for less code generated solution
    Code:
    Sel2:
    if swcount = 1 then READ ((Patt1+0)+counts), PORTB  ;read the next value in patt1 and display it on PORTB
    if swcount = 2 then READ ((Patt2+0)+counts), PORTB
    if swcount = 3 then READ ((Patt3+0)+counts), PORTB
    if swcount = 4 then READ ((Patt4+0)+counts), PORTB
    if swcount = 5 then READ ((Patt5+0)+counts), PORTB
    if swcount = 6 then READ ((Patt6+0)+counts), PORTB
    if swcount = 7 then READ ((Patt7+0)+counts), PORTB
    RETURN
    Enjoy!

    For sure there's way to reduce the code size but i leave this in your hand

    teaser
    Code:
    Addr=Patt7+counts
    Read addr, PORTB
    Select case is another one, LOOKUP too.

    And you can configure PORTB as digital in your config fuses with the right setting
    Code:
    _PBADEN_OFF_3H      ; PORTB<4:0> pins are configured as digital I/O on Reset
    _PBADEN_ON_3H       ; PORTB<4:0> pins are configured as analog input channels on Reset
    OR use

    ADCON1=$0F
    CMCON=7
    Last edited by mister_e; - 10th December 2006 at 02:01.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve, thanks once again for your advice. I'm stunned at how rusty I've become in the past 6 months !

    Yes I dare say that the code could be made tidy and more condensed, but I tend to do things in my illogical way first as I can get my head around what is sposed to happen. Besides, its not as if I'm short for space in this chip but I should really get in the habbit of making tighter code.

    I'm hoping to have a play with the A/D convertion later by placing the input from a CD player into the PIC so that the LEDs act as a VU type meter, so no doubt will be asking lots more questions. I will of course try and code it first (only way to really learn), but I'm sure I'll still need advice, especially on the calibration as the input will be probably be less than 1v peak to peak, so any hardware suggestions between the PIC and CD player would be welcome

    Edit:
    The code already uses CMCON = 7 so how come the LEDs won't light. could it be down to the clock settings. The 16F628 used its internal clock.. the 18F2550 uses an external 4mhz xtal...
    Last edited by malc-c; - 10th December 2006 at 10:40.

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default OK I'm stummped

    I feel like I've experienced some form of memory loss and I'm having to learn how to ride a bike all over again !

    I've breadboarded the circuit as follows:
    Pin 20 = +5v
    Pin 19 and pin 8 = GND
    Pin 1 = +ve via a 10K resistor
    Pin 9 & 10 - 4 Mhz xtal with 22pf between pins and GND
    Pins 21 - 28 LED with 120 R resistor to GND

    When power is applied RB7, RB6, RB4 and RB3 faintly light and appear to be flickering randomly (like a candle effect)

    I'm getting 1.25v on the above pins, but RB5 is showing -1.1v, RB2 = -0.8 and -0.9v on RB1 and RB0

    Does the 2550 PIC require the USB components connect to RC4 -7 to function correctly ?

    EDIT:

    Can someone confirm that I have the correct settings in the application and INC files

    Program code
    Code:
    @WDT_ON
    @PWRT_ON
    @MCLR_OFF
    @BOD_ON
    @LVP_OFF
    @CPD_OFF
    @PROTECT_OFF
    @ errorlevel -202
    and INC file (in PBP folder)
    Code:
            INCLUDE "P18F2550.INC"	; MPASM  Header
            __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
            __CONFIG    _CONFIG1H, _FOSC_HS_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
            __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
            __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    Last edited by malc-c; - 10th December 2006 at 13:09.

  8. #8
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default Now I know why I gave up six months ago !

    Just tried a test program (can't get more simpler than this)

    Code:
    CMCON = 7                        ' Digital inputs
    CCP1CON = 0                      ' PWM off
    
    TRISA=%11100111                  'set PORTA as all input apart from A3 & A4
    TRISB=%00000000                  'set PORTB as all output
     
    @WDT_ON
    @PWRT_ON
    @MCLR_OFF
    @BOD_ON
    @LVP_OFF
    @CPD_OFF
    @PROTECT_OFF
    @ errorlevel -202
    
    main:
    
    high portb.0
    pause 1000
    low portb.0
    pause 1000
    goto main
    And it compiles OK, loads and varifies in the PIC OK, but won't work ! The PIC and PSU are cold so there is nothing shorting out on the breadoard

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    try this one
    Code:
    ASM
        __CONFIG  _CONFIG1L, _CPUDIV_OSC1_PLL2_1L  
        __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H
        __CONFIG  _CONFIG3H, _PBADEN_OFF_3H
        __CONFIG  _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    ADCON1=$0F
    CMCON = 7                        ' Digital inputs
    CCP1CON = 0                      ' PWM off
    
    TRISA=%11100111                  'set PORTA as all input apart from A3 & A4
    TRISB=%00000000                  'set PORTB as all output
    PORTB=0
    
    ByteA   var byte
     
    main:
        for bytea=0 to 7
            PORTB=DCD BYTEA
            PAUSE 250
            NEXT
        PORTB=255
        PAUSE 250
        goto main
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve,

    Thanks for the reply. I've copied and pasted your code into a blank document and tried compiling. It errored with

    Error [118] (path) : Overwritting previous address contents (0000)
    Error [118] (path) : Overwritting previous address contents (0001)
    Error [118] (path) : Overwritting previous address contents (0000)
    Error [118] (path) : Overwritting previous address contents (0001)
    Error [118] (path) : Overwritting previous address contents (0004)
    Error [118] (path) : Overwritting previous address contents (0005)
    Error [118] (path) : Overwritting previous address contents (0006)
    Error [118] (path) : Overwritting previous address contents (0007)

    Could you also paste your INC file so I can replicate exactly (or as closely) your files.

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I agree... you're rusty

    check this
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #12
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Must be going senile too !

    I can't see any device line in the INC file stored in the PBP folder

    Code:
    ;****************************************************************
    ;*  18F2550.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2004 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 12/31/04                                        *
    ;*  Version   : 2.46                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F2550, r = dec, w = -230, f = inhx32
            INCLUDE "P18F2550.INC"	; MPASM  Header
            __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
            __CONFIG    _CONFIG1H, _FOSC_HS_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
            __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
            __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	32
    I've tried reming out the _config lines one at a time and that throws up other errors.
    I'm pulling what little hair I have out

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    O.K, you have two choices.

    1. You rem all _CONFIG lines and set them in your code using the old way... well as i posted before

    2. you rem all _CONFIG lines and you past those i posted.. so it should looks like

    Code:
    ;****************************************************************
    ;*  18F2550.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2004 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 12/31/04                                        *
    ;*  Version   : 2.46                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F2550, r = dec, w = -230, f = inhx32
            INCLUDE "P18F2550.INC"	; MPASM  Header
            ;__CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
            ;__CONFIG    _CONFIG1H, _FOSC_HS_1H
            ;__CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
            ;__CONFIG    _CONFIG3H, _PBADEN_OFF_3H
            ;__CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
            __CONFIG  _CONFIG1L, _CPUDIV_OSC1_PLL2_1L  
            __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H
            __CONFIG  _CONFIG3H, _PBADEN_OFF_3H
            __CONFIG  _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L        
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	32
    About now?

    For sure there's no Device line for any 18F device. DEVICE is when you compile with PM, __CONFIG is when you compile with MPASM.
    Last edited by mister_e; - 10th December 2006 at 19:56.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Ok - I've copied and pasted the code over the original INC file (I did back up the old one first) - and removed the ASM part from the PBP code and it compiled fine.

    On the breadboard RB0 is faintly lit and appears to be flickering slightly as I'm only getting +0.85v on RB0 - all other pins are low - also removing the Xtal seems to have no affect on the LED output, which to me would suggest that the timing is still not working ??

    Taking pin5 (RA3/AN3/Vref+) takes RB0 low (with or without Xtal present) if that has any bearing on what is happening.

    If I get chance I'll try and post a schematic of the basic hardware set up

  15. #15
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Kind of strange behaviour... it's working as suppose here. I suspect a faulty contact or a bad PIC first... well i think ...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #16
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Well I've tried a new Xtal and PIC and I still get the same result, only the LED appears to be more stable (+0.58v)

    I'll think I'll give up on this one...

  17. #17
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Just in case it was the application that I was using to program the chip that was the cause, I loaded up the code in Winpic and then varified and read-back the code programmed using PICpgm - It varified and readback without errors. In fact I was able to program your code to a PIC using PICpgm, then read back from that PIC using WinPIC, change to a new PIC and program that from WinPIC, so it would seem that there are no issue with programming the PIC. So the problem is leaning to either coading or hardware, and given your experience and the fact you have it working fine your side of the pond, its a case of "that when you have eliminated the impossible, whatever remains, however improbable, must be the truth?" as Sherlock would of put it.

    I'll post up the schematic - just in case there is something I've overlooked.

    EDIT:

    Schematic uploaded - and tried 0.1uf decoupling capacitor (missed it of the drawing)
    Attached Images Attached Images  
    Last edited by malc-c; - 10th December 2006 at 21:24.

  18. #18
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Well I've tried re-breadboarding it on a different breadboard and still the same.

    Any suggestions for a different PIC - preferably with 28 pins - internal oscillator and min of one A to D converter for the music input - supported by 2.46 ???

  19. #19
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    It's kinda strange but anyways..

    PIC18F2525, PIC18F2431, 2320,2220,2620,2680 are some i keep in stock here.

    i tried... even removing a Vss pin didn't provide any bad results... ARGH i hate that when it happen

    You also added the ADCON1=$0F line too?

    When you look at the config fuse in your DeviceProgrammer software... is LVP & DEBUG are set to off as well?

    The worst.. there's no revealant stuff multiplexed with PORTB.0 pin if ADCON1=$0F line is there OR if the PBADEN_OFF fuse is correctly programmed.. DAMN!
    Last edited by mister_e; - 10th December 2006 at 22:06.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  20. #20
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Hi again mate, and thanks for your continued assistance.

    My INC file is as shown in your post (#13), and the code does include the ADCON1=$0F line.

    The PICpgm appliaction doesn't have any options to change, so I assume it takes the fuse settings etc from the code / inc / dev files. Reading the code back into WinPIC, gives the following info in the log

    Reading 0x3FFFFE - 0x3FFFFF ...
    Reading 0x300000 - 0x30000D ...
    Reading 0xF00000 - 0xF000FF ...
    Reading 0x000000 - 0x007FFF ...
    Reading PIC ok.
    Cannot verify at different voltages with this hardware.
    Verifying...
    Verifying CODE, 0x000000..0x0000BE
    Verifying 0x000000..0x0000BE
    No DATA MEMORY in buffer to verify.
    Verifying CONFIG, 0x300000..0x300006
    Verifying 0x300000..0x300006
    Verify finished, no errors.
    Under Device Config - Config word#1 is C027 (hex), with Config word#2 shown as 1F3F (hex)

    I Then loaded the same HEX file that gets compiled from your code that I previously loaded with PICpgm into Winpic and it reported the following under device config

    Config word #1 = F0E7 (hex)
    Config word #2 = 1F3F (hex)

    In both cases nothing is else is listed listed (see images attached) If I try programming having loaded this file it errors

    Programming...
    Erasing ("bulk" or "chip") ...
    Programming CODE, 0x000000..0x0000BE
    Verifying CODE, 0x000000..0x0000BE
    Verifying 0x000000..0x0000BE
    Verify Error: 000000: read 000000, wanted 00EF43, mask 00FFFF ==> diff=00EF43
    Verify Error: 000002: read 000000, wanted 00F000, mask 00FFFF ==> diff=00F000
    Verify Error: 000004: read 000000, wanted 005008, mask 00FFFF ==> diff=005008
    Verify Error: 000006: read 000000, wanted 000B07, mask 00FFFF ==> diff=000B07
    More Verify Errors, unable to list all (total=95)
    Programming CONFIG, 0x300000..0x300006
    Verifying CONFIG, 0x300000..0x300006
    Verifying 0x300000..0x300006
    Verify Error: 300000: read 00C027, wanted 00F0E7, mask 00FFFF ==> diff=0030C0
    Verify Error: 300004: read 008500, wanted 00FDFF, mask 00FFFF ==> diff=0078FF
    Verify Error: 300006: read 0000A1, wanted 00FFBB, mask 00FFFF ==> diff=00FF1A
    ERROR: Programming FAILED !
    I'm really out of my depth here as I have no idea what all these numbers are - I opted for the PICpgm program because it auto detected the PIC and had less setting to change - it also seemed to work as it reported no errors
    Attached Images Attached Images   

  21. #21
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default Additions images

    If it helps here are the captures from the other tabs

    I've also tried taking of the checks for OSCAL etc and that made no difference
    Attached Images Attached Images   

  22. #22
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Last post tonight as its getting late

    I've tried another version of winpic, Winpic800 and it has the settings as shown in the attached image - and this too errors when programming.

    Gut feeling, its something to do with hardware / config settings in the programmer - I just don't have the experience to understand what it is.
    Attached Images Attached Images  

  23. #23
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c
    The PICpgm appliaction doesn't have any options to change, so I assume it takes the fuse settings etc from the code / inc / dev files.
    In theory ... yes

    Reading the code back into WinPIC, gives the following info in the log
    ''''
    '
    '
    '
    '
    I Then loaded the same HEX file that gets compiled from your code that I previously loaded with PICpgm into Winpic and it reported the following under device config

    Config word #1 = F0E7 (hex)
    Config word #2 = 1F3F (hex)
    One is good ... where the other 'I think' don't make sense at all

    Let's say i just compile the config fuses bellow
    Code:
    ASM
        __CONFIG  _CONFIG1L, _CPUDIV_OSC1_PLL2_1L  
        __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H
        __CONFIG  _CONFIG3H, _PBADEN_OFF_3H
        __CONFIG  _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    now, if i open the .LST file, i found
    Code:
                          00097 
                          00098     __CONFIG  _CONFIG1L, _CPUDIV_OSC1_PLL2_1L  
    300000 F0E7           00099     __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H
    300004 FDFF           00100     __CONFIG  _CONFIG3H, _PBADEN_OFF_3H
    300006 FFBB           00101     __CONFIG  _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    Where those numer comes from. Open the p18F2550.INC in the MPASM foler, scroll to the bottom and you'll discover
    Code:
    _CONFIG1L        EQU  H'300000'
    _CONFIG1H        EQU  H'300001'
    _CONFIG2L        EQU  H'300002'
    _CONFIG2H        EQU  H'300003'
    _CONFIG3H        EQU  H'300005'
    _CONFIG4L        EQU  H'300006'
    let's see CONFIG1L and CONFIG1H options
    Code:
    ;----- CONFIG1L Options --------------------------------------------------
    _PLLDIV_1_1L         EQU  H'F8'    ; No prescale (4 MHz oscillator input drives PLL directly)
    _PLLDIV_2_1L         EQU  H'F9'    ; Divide by 2 (8 MHz oscillator input)
    _PLLDIV_3_1L         EQU  H'FA'    ; Divide by 3 (12 MHz oscillator input)
    _PLLDIV_4_1L         EQU  H'FB'    ; Divide by 4 (16 MHz oscillator input)
    _PLLDIV_5_1L         EQU  H'FC'    ; Divide by 5 (20 MHz oscillator input)
    _PLLDIV_6_1L         EQU  H'FD'    ; Divide by 6 (24 MHz oscillator input)
    _PLLDIV_10_1L        EQU  H'FE'    ; Divide by 10 (40 MHz oscillator input)
    _PLLDIV_12_1L        EQU  H'FF'    ; Divide by 12 (48 MHz oscillator input)
    
    _CPUDIV_OSC1_PLL2_1L EQU  H'E7'    ; [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
    _CPUDIV_OSC2_PLL3_1L EQU  H'EF'    ; [OSC1/OSC2 Src: /2][96 MHz PLL Src: /3]
    _CPUDIV_OSC3_PLL4_1L EQU  H'F7'    ; [OSC1/OSC2 Src: /3][96 MHz PLL Src: /4]
    _CPUDIV_OSC4_PLL6_1L EQU  H'FF'    ; [OSC1/OSC2 Src: /4][96 MHz PLL Src: /6]
    
    _USBDIV_1_1L         EQU  H'DF'    ; USB clock source comes directly from the primary oscillator block with no postscale
    _USBDIV_2_1L         EQU  H'FF'    ; USB clock source comes from the 96 MHz PLL divided by 2
    
    ;----- CONFIG1H Options --------------------------------------------------
    _FOSC_XT_XT_1H       EQU  H'F0'    ; XT oscillator, XT used by USB
    _FOSC_XTPLL_XT_1H    EQU  H'F2'    ; XT oscillator, PLL enabled, XT used by USB
    _FOSC_ECIO_EC_1H     EQU  H'F4'    ; External clock, port function on RA6, EC used by USB
    _FOSC_EC_EC_1H       EQU  H'F5'    ; External clock, CLKOUT on RA6, EC used by USB
    _FOSC_ECPLLIO_EC_1H  EQU  H'F6'    ; External clock, PLL enabled, port function on RA6, EC used by USB
    _FOSC_ECPLL_EC_1H    EQU  H'F7'    ; External clock, PLL enabled, CLKOUT on RA6, EC used by USB
    _FOSC_INTOSCIO_EC_1H EQU  H'F8'    ; Internal oscillator, port function on RA6, EC used by USB
    _FOSC_INTOSC_EC_1H   EQU  H'F9'    ; Internal oscillator, CLKOUT on RA6, EC used by USB
    _FOSC_INTOSC_XT_1H   EQU  H'FA'    ; Internal oscillator, XT used by USB
    _FOSC_INTOSC_HS_1H   EQU  H'FB'    ; Internal oscillator, HS used by USB
    _FOSC_HS_1H          EQU  H'FC'    ; HS oscillator, HS used by USB
    _FOSC_HSPLL_HS_1H    EQU  H'FE'    ; HS oscillator, PLL enabled, HS used by USB
    
    _FCMEN_OFF_1H        EQU  H'BF'    ; Fail-Safe Clock Monitor disabled
    _FCMEN_ON_1H         EQU  H'FF'    ; Fail-Safe Clock Monitor enabled
    
    _IESO_OFF_1H         EQU  H'7F'    ; Oscillator Switchover mode disabled
    _IESO_ON_1H          EQU  H'FF'    ; Oscillator Switchover mode enabled
    using our settings, we keep
    Code:
    _CONFIG1L        EQU  H'300000'
    _CONFIG1H        EQU  H'300001'
    _CPUDIV_OSC1_PLL2_1L EQU  H'E7'  
    _FOSC_XT_XT_1H       EQU  H'F0'
    combining both L and H we have F0E7... same for all other Config stuff.

    It doesn't explain your config2 stuff... If it's a config fuse, it's not valid, well i don't see how we can have 1F... it could be a device programmer behaviour... i think

    let's try to set ALL available config fuses BUT NOT the code protect stuff. And while we're at it, let's try a simple program too.
    Code:
    ASM
        __CONFIG  _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L 
        __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H & _FCMEN_OFF_1H  &  _IESO_OFF_1H 
        __CONFIG  _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L &  _BORV_1_2L  & _VREGEN_OFF_2L 
        __CONFIG  _CONFIG2H, _WDT_OFF_2H 
        __CONFIG  _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H 
        __CONFIG  _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L 
    ENDASM
    ADCON1=$0F
    TRISB=%00000000                  'set PORTB as all output
    PORTB=0
    
    ByteA   var byte
     
    main:
        for bytea=0 to 7
            PORTB=DCD BYTEA
            PAUSE 250
            NEXT
        PORTB=255
        PAUSE 250
        goto main
    now it give us those config values
    Code:
                          00102     __CONFIG  _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L 
    300000 30C0           00103     __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H & _FCMEN_OFF_1H  &  _IESO_OFF_1H 
                          00104     __CONFIG  _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L &  _BORV_1_2L  & _VREGEN_OFF_2L 
    300002 FECE           00105     __CONFIG  _CONFIG2H, _WDT_OFF_2H 
    300004 F8FF           00106     __CONFIG  _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H 
    300006 FFBB           00107     __CONFIG  _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L 
                          00108
    and it's still working here. here's the .HEX dump
    Code:
    :020000040000FA
    :100000003EEF00F0010E09B0E84609B2E84609B239
    :10001000E84609B4E83A1200046A036EFF0E0326AC
    :10002000D8A00426D8A03BEF00F0030E026EDF0E2E
    :1000300002D8F4D7026AE80F016E021EFC0ED8A0A7
    :1000400003D00126D8B0FDD701260400023EF9D71F
    :1000500001B000D001A202D0000000D01200096E51
    :1000600002EC00F0016A026A09A6016E09B6026E8E
    :1000700001503BEF00F00001040012000F0EC16EB2
    :10008000936A816A1C6A0400080E1C5CD8B051EFA8
    :1000900000F01C50E4DF816EFA0EBEDF1C2AD8A4EB
    :0C00A000F2D7FF0E816EFA0EB7DFECD72E
    :020000040030CA
    :08000000C030CEFEFFF8BBFF8B
    :00000001FF
    compare with yours.

    In both cases nothing is else is listed listed (see images attached) If I try programming having loaded this file it errors
    Wich adapter you're using JDM?

    ICSP or not?

    When you program your PIC, pull the PGM pin to GND, erase the chip firstm then retry and post your results.

    I can't comment on JDM or else programmer like that, if you want a nice one and cheap, i buyed few months ago a Microchip PICKit 2 for some on-the road service job. For a <40$ and USB PIC programmer it's really nice.
    I'm really out of my depth here as I have no idea what all these numbers are - I opted for the PICpgm program because it auto detected the PIC and had less setting to change - it also seemed to work as it reported no errors
    Yeah it's kind of hard to know where the problem come from... The most strange thing... only one a single pin... and you tried on another board...

    Don't give up!
    Last edited by mister_e; - 11th December 2006 at 03:56.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  24. #24
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    In theory ... yes



    One is good ... where the other 'I think' don't make sense at all

    Let's say i just compile the config fuses bellow
    Code:
    ASM
        __CONFIG  _CONFIG1L, _CPUDIV_OSC1_PLL2_1L  
        __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H
        __CONFIG  _CONFIG3H, _PBADEN_OFF_3H
        __CONFIG  _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    now, if i open the .LST file, i found
    Code:
                          00097 
                          00098     __CONFIG  _CONFIG1L, _CPUDIV_OSC1_PLL2_1L  
    300000 F0E7           00099     __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H
    300004 FDFF           00100     __CONFIG  _CONFIG3H, _PBADEN_OFF_3H
    300006 FFBB           00101     __CONFIG  _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    OK, cutting and pasting just the config lines into a blank page in Microcode studio, remming out the config lines in the 18F2550.INC file in the PBP folder so as not to get the warnings about overwritting values I can confirm that the LST file produces the same results as yours

    Code:
                          00056     __CONFIG  _CONFIG1L, _CPUDIV_OSC1_PLL2_1L  
    300000 F0E7           00057     __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H
    300004 FDFF           00058     __CONFIG  _CONFIG3H, _PBADEN_OFF_3H
    300006 FFBB           00059     __CONFIG  _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L

    Where those numer comes from. Open the p18F2550.INC in the MPASM foler, scroll to the bottom and you'll discover
    Code:
    _CONFIG1L        EQU  H'300000'
    _CONFIG1H        EQU  H'300001'
    _CONFIG2L        EQU  H'300002'
    _CONFIG2H        EQU  H'300003'
    _CONFIG3H        EQU  H'300005'
    _CONFIG4L        EQU  H'300006'
    let's see CONFIG1L and CONFIG1H options
    Code:
    ;----- CONFIG1L Options --------------------------------------------------
    _PLLDIV_1_1L         EQU  H'F8'    ; No prescale (4 MHz oscillator input drives PLL directly)
    _PLLDIV_2_1L         EQU  H'F9'    ; Divide by 2 (8 MHz oscillator input)
    _PLLDIV_3_1L         EQU  H'FA'    ; Divide by 3 (12 MHz oscillator input)
    _PLLDIV_4_1L         EQU  H'FB'    ; Divide by 4 (16 MHz oscillator input)
    _PLLDIV_5_1L         EQU  H'FC'    ; Divide by 5 (20 MHz oscillator input)
    _PLLDIV_6_1L         EQU  H'FD'    ; Divide by 6 (24 MHz oscillator input)
    _PLLDIV_10_1L        EQU  H'FE'    ; Divide by 10 (40 MHz oscillator input)
    _PLLDIV_12_1L        EQU  H'FF'    ; Divide by 12 (48 MHz oscillator input)
    
    _CPUDIV_OSC1_PLL2_1L EQU  H'E7'    ; [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
    _CPUDIV_OSC2_PLL3_1L EQU  H'EF'    ; [OSC1/OSC2 Src: /2][96 MHz PLL Src: /3]
    _CPUDIV_OSC3_PLL4_1L EQU  H'F7'    ; [OSC1/OSC2 Src: /3][96 MHz PLL Src: /4]
    _CPUDIV_OSC4_PLL6_1L EQU  H'FF'    ; [OSC1/OSC2 Src: /4][96 MHz PLL Src: /6]
    
    _USBDIV_1_1L         EQU  H'DF'    ; USB clock source comes directly from the primary oscillator block with no postscale
    _USBDIV_2_1L         EQU  H'FF'    ; USB clock source comes from the 96 MHz PLL divided by 2
    
    ;----- CONFIG1H Options --------------------------------------------------
    _FOSC_XT_XT_1H       EQU  H'F0'    ; XT oscillator, XT used by USB
    _FOSC_XTPLL_XT_1H    EQU  H'F2'    ; XT oscillator, PLL enabled, XT used by USB
    _FOSC_ECIO_EC_1H     EQU  H'F4'    ; External clock, port function on RA6, EC used by USB
    _FOSC_EC_EC_1H       EQU  H'F5'    ; External clock, CLKOUT on RA6, EC used by USB
    _FOSC_ECPLLIO_EC_1H  EQU  H'F6'    ; External clock, PLL enabled, port function on RA6, EC used by USB
    _FOSC_ECPLL_EC_1H    EQU  H'F7'    ; External clock, PLL enabled, CLKOUT on RA6, EC used by USB
    _FOSC_INTOSCIO_EC_1H EQU  H'F8'    ; Internal oscillator, port function on RA6, EC used by USB
    _FOSC_INTOSC_EC_1H   EQU  H'F9'    ; Internal oscillator, CLKOUT on RA6, EC used by USB
    _FOSC_INTOSC_XT_1H   EQU  H'FA'    ; Internal oscillator, XT used by USB
    _FOSC_INTOSC_HS_1H   EQU  H'FB'    ; Internal oscillator, HS used by USB
    _FOSC_HS_1H          EQU  H'FC'    ; HS oscillator, HS used by USB
    _FOSC_HSPLL_HS_1H    EQU  H'FE'    ; HS oscillator, PLL enabled, HS used by USB
    
    _FCMEN_OFF_1H        EQU  H'BF'    ; Fail-Safe Clock Monitor disabled
    _FCMEN_ON_1H         EQU  H'FF'    ; Fail-Safe Clock Monitor enabled
    
    _IESO_OFF_1H         EQU  H'7F'    ; Oscillator Switchover mode disabled
    _IESO_ON_1H          EQU  H'FF'    ; Oscillator Switchover mode enabled
    using our settings, we keep
    Code:
    _CONFIG1L        EQU  H'300000'
    _CONFIG1H        EQU  H'300001'
    _CPUDIV_OSC1_PLL2_1L EQU  H'E7'  
    _FOSC_XT_XT_1H       EQU  H'F0'
    combining both L and H we have F0E7... same for all other Config stuff.

    It doesn't explain your config2 stuff... If it's a config fuse, it's not valid, well i don't see how we can have 1F... it could be a device programmer behaviour... i think
    The programmer I'm using is a commercial version of the JDM serial programmer, with (as you have seen) several freeware applications to squirt the code to the PIC. Like I said, I'm a little out of my depth, so can't shed any light why or what the settings / numbers mean, I can only report them back to you. The only other programmer I have is a PicKit1, which doesn't support these devices

    let's try to set ALL available config fuses BUT NOT the code protect stuff. And while we're at it, let's try a simple program too.
    Code:
    ASM
        __CONFIG  _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L 
        __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H & _FCMEN_OFF_1H  &  _IESO_OFF_1H 
        __CONFIG  _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L &  _BORV_1_2L  & _VREGEN_OFF_2L 
        __CONFIG  _CONFIG2H, _WDT_OFF_2H 
        __CONFIG  _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H 
        __CONFIG  _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L 
    ENDASM
    ADCON1=$0F
    TRISB=%00000000                  'set PORTB as all output
    PORTB=0
    
    ByteA   var byte
     
    main:
        for bytea=0 to 7
            PORTB=DCD BYTEA
            PAUSE 250
            NEXT
        PORTB=255
        PAUSE 250
        goto main
    OK copying and pasting that example into a blank page on Microcode studio and hitting F9 to compile produces an error. 113 (path and file name).asm59: symbol not previously defined (_FCMEN_OFF_1H)

    now it give us those config values
    Code:
                          00102     __CONFIG  _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L 
    300000 30C0           00103     __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H & _FCMEN_OFF_1H  &  _IESO_OFF_1H 
                          00104     __CONFIG  _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L &  _BORV_1_2L  & _VREGEN_OFF_2L 
    300002 FECE           00105     __CONFIG  _CONFIG2H, _WDT_OFF_2H 
    300004 F8FF           00106     __CONFIG  _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H 
    300006 FFBB           00107     __CONFIG  _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L 
                          00108
    and it's still working here. here's the .HEX dump
    Code:
    :020000040000FA
    :100000003EEF00F0010E09B0E84609B2E84609B239
    :10001000E84609B4E83A1200046A036EFF0E0326AC
    :10002000D8A00426D8A03BEF00F0030E026EDF0E2E
    :1000300002D8F4D7026AE80F016E021EFC0ED8A0A7
    :1000400003D00126D8B0FDD701260400023EF9D71F
    :1000500001B000D001A202D0000000D01200096E51
    :1000600002EC00F0016A026A09A6016E09B6026E8E
    :1000700001503BEF00F00001040012000F0EC16EB2
    :10008000936A816A1C6A0400080E1C5CD8B051EFA8
    :1000900000F01C50E4DF816EFA0EBEDF1C2AD8A4EB
    :0C00A000F2D7FF0E816EFA0EB7DFECD72E
    :020000040030CA
    :08000000C030CEFEFFF8BBFF8B
    :00000001FF
    compare with yours.
    Regret that I can't see where the error is coming from as there is nothing in the INC file (BPB folder) or am I looking in the wrong place?

    Wich adapter you're using JDM?

    ICSP or not?
    Yes - JDM as detailed above, with the chip pluged in to the programmer rathet than using ISCP

    When you program your PIC, pull the PGM pin to GND, erase the chip firstm then retry and post your results.
    I've tried grounding PGM with a wire whilst programming and leaving the jumper off, whilst programming the code in post# above the config settings in Winpic are displayed as FFFF and FFFF (config word 1 and 2), and with PGM grounded the programming failed. I erased and read back the PIC to make sure there was no code in the PIC. Disconnected the serial cable and re-connected, re-launched WinPIC and loaded the same code. Again it errored when programming. I then used PICpgm to program the code - it reported it programmed without errors (I did erase the PIC first). I then closed PICpgm and re-opened winpic and read the code back in to the application. Under Winpic the config words are reported as CF3F (word 1) and 1F3F (word 2)


    I can't comment on JDM or else programmer like that, if you want a nice one and cheap, i buyed few months ago a Microchip PICKit 2 for some on-the road service job. For a <40$ and USB PIC programmer it's really nice.
    I think I might invest in a decent programmer - I have a PICkit1 as mentioned above, and it works really well - maybe I'll treat myself to an early christmas pressy

    Yeah it's kind of hard to know where the problem come from... The most strange thing... only one a single pin... and you tried on another board...

    Don't give up!
    I don't mind trying stuff and it helps learing what and how things work, I just don't want to take up too much of your time in trying to resolve my problem.

    Many thanks as always

  25. #25
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    OK copying and pasting that example into a blank page on Microcode studio and hitting F9 to compile produces an error. 113 (path and file name).asm59: symbol not previously defined (_FCMEN_OFF_1H)
    I don't know wich version of MPASM you're using, but i use the latest 5.06 (well i think it's the latest... ) could it be the problem?

    Regret that I can't see where the error is coming from as there is nothing in the INC file (BPB folder) or am I looking in the wrong place?
    compare/post your fileName.HEX file with the one i posted, those last bytes (in color) are the config fuses. It may reveal some interesting stuff. if they're different, just edit the .HEX file 'till it's the same, retry to program your PIC.

    I've tried grounding PGM with a wire whilst programming and leaving the jumper off, whilst programming the code in post# above the config settings in Winpic are displayed as FFFF and FFFF (config word 1 and 2), and with PGM grounded the programming failed. I erased and read back the PIC to make sure there was no code in the PIC. Disconnected the serial cable and re-connected, re-launched WinPIC and loaded the same code. Again it errored when programming. I then used PICpgm to program the code - it reported it programmed without errors (I did erase the PIC first). I then closed PICpgm and re-opened winpic and read the code back in to the application. Under Winpic the config words are reported as CF3F (word 1) and 1F3F (word 2)
    Double check that both VSS are tied together, and place a 0.1uF between Vdd and Vss on your ZIFF socket. Keep PGM to gnd. If you still have some errors, try increasing the capacitor and use tantalum type if you reach over 1uF. So begin with 0.1uF, then 0.22, 0.47, 1uF, 2.2uF, 4.7uF maybe it will work. Also measure the voltage on MCLR pin while programming. it should be over 12 volts.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  26. #26
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve,

    Ok I've downloaded the latest version of MPLAB so now I'm running ver 5.06 of MPASM and that cured the previous error (FC_MEN_OFF) so the following code compiled fine

    Code:
    ASM
        __CONFIG  _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L 
        __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H & _FCMEN_OFF_1H  &  _IESO_OFF_1H 
        __CONFIG  _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L &  _BORV_1_2L  & _VREGEN_OFF_2L 
        __CONFIG  _CONFIG2H, _WDT_OFF_2H 
        __CONFIG  _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H 
        __CONFIG  _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L 
    ENDASM
    ADCON1=$0F
    TRISB=%00000000                  'set PORTB as all output
    PORTB=0
    
    ByteA   var byte
     
    main:
        for bytea=0 to 7
            PORTB=DCD BYTEA
            PAUSE 250
            NEXT
        PORTB=255
        PAUSE 250
        goto main
    The resulting LST file is attached (steve.txt as .lst won't upload) - However when programming it with winpic it errors - here's the log

    Code:
    Device has been erased.
    Programming...
    Erasing ("bulk" or "chip") ...
    Programming CODE, 0x000000..0x0000B4
    Verifying CODE, 0x000000..0x0000B4
    Verifying 0x000000..0x0000B4
    Programming CONFIG, 0x300000..0x300006
    Verifying CONFIG, 0x300000..0x300006
    Verifying 0x300000..0x300006
    Verify Error: 300000: read 000000, wanted 0030C0, mask 00FFFF  ==> diff=0030C0
    Verify Error: 300002: read 001E0E, wanted 00FECE, mask 00FFFF  ==> diff=00E0C0
    Verify Error: 300004: read 008000, wanted 00F8FF, mask 00FFFF  ==> diff=0078FF
    Verify Error: 300006: read 0000A1, wanted 00FFBB, mask 00FFFF  ==> diff=00FF1A
    ERROR: Programming FAILED !
    On checking the config setting winpic reports 30C0 and FECE as the device config word (#1 and #2 respectively) - see attached image (config.jpg).

    When programming MCLR is taken to around +13v by the programmer. Both Vss are connected and grounded.

    Lastly here is the resulting HEX file that is compiled

    Code:
    :020000040000FA
    :1000000043EF00F00850070B1A0FF66EF76A000E68
    :10001000F722F86A0800F5501200010204081020C7
    :100020004080036A026EFF0E0226D8A00326D8A0E5
    :1000300040EF00F0030E016EDF0E02D8F4D7016A24
    :10004000E80F006E011EFC0ED8A003D00026D8B029
    :10005000FDD700260400013EF9D700B000D000A271
    :1000600002D0000000D01200086E02EC00F0006A1E
    :10007000016A08A6006E08B6016E005040EF00F05D
    :100080000001040012000F0EC16E936A816A1C6A9F
    :100090000400080E1C5CD8B056EF00F01C50E4DFE2
    :1000A000816EFA0EBEDF1C2AD8A4F2D7FF0E816E35
    :0600B000FA0EB7DFECD7E9
    :020000040030CA
    :08000000C030CEFEFFF8BBFF8B
    :00000001FF
    Comparing the last but one line that was hilighted in your previous post there isn't any difference

    Code:
    Your code
    :08000000C030CEFEFFF8BBFF8B
    
    My code
    :08000000C030CEFEFFF8BBFF8B
    I therefore tried loading the HEX file via the PICpgm program and that loaded the code to the pic without errors. I then shutdown PICpgm and launched Winpic and read the code back. The log reported the following:
    Code:
    Info: Loading definitions for "PIC18F2550" from devices.ini .
    Info: Support for some newer PIC18F devices added by Martin v.d. Werff 2005
    Couldn't find "C:\Program Files\Microchip\MPLAB IDE\PIC18F2550.dev", please borrow/copy from MPLAB !
    PIC18F: family='21'=4550, WriteLatch=32 bytes, EraseLatch=64 bytes .
    Initialising PIC-Programmer: Success.
    Testing: delay(500ms) took 0.50 seconds, timer_freq=3.5795 MHz ... ok
    Reading 0x3FFFFE - 0x3FFFFF ...
    Reading 0x300000 - 0x30000D ...
    Reading 0xF00000 - 0xF000FF ...
    Reading 0x000000 - 0x007FFF ...
    Reading PIC ok.
    The device config words were reported as CF3F and 1F3F. However the resulting dump of the PIC isn't anything like the original file (see dumped.txt attached).

    Unless you can see anything glaringly obvious then the only other area must be hardware and until I get a different programmer I can't prove that one way or another. The only thing I can see in the logs is

    Couldn't find "C:\Program Files\Microchip\MPLAB IDE\PIC18F2550.dev", please borrow/copy from MPLAB !
    Could this be the problem, as the dev files are in C:\Program Files\Microchip\MPLAB IDE\Device folder ??

    As always mate, I appreciate your continued help and advice on this one !

    EDIT:

    Oh and this is the programmer I'm using
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by malc-c; - 11th December 2006 at 20:27.

  27. #27
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    It's clear now, it a device programmer OR device programmer software problem. Here's the dump of the PIC when i reload it
    Code:
    :020000040000FA
    :100000003EEF00F0010E09B0E84609B2E84609B239
    :10001000E84609B4E83A1200046A036EFF0E0326AC
    :10002000D8A00426D8A03BEF00F0030E026EDF0E2E
    :1000300002D8F4D7026AE80F016E021EFC0ED8A0A7
    :1000400003D00126D8B0FDD701260400023EF9D71F
    :1000500001B000D001A202D0000000D01200096E51
    :1000600002EC00F0016A026A09A6016E09B6026E8E
    :1000700001503BEF00F00001040012000F0EC16EB2
    :10008000936A816A1C6A0400080E1C5CD8B051EFA8
    :1000900000F01C50E4DF816EFA0EBEDF1C2AD8A4EB
    :1000A000F2D7FF0E816EFA0EB7DFECD7FFFFFFFF2E
    
           **** and later we get *****
    :0200000400F00A
    :08000000FFFFFFFFFFFFFFFF00
    :08000800FFFFFFFFFFFFFFFFF8
    :08001000FFFFFFFFFFFFFFFFF0
    :08001800FFFFFFFFFFFFFFFFE8
    :08002000FFFFFFFFFFFFFFFFE0
    :08002800FFFFFFFFFFFFFFFFD8
    :08003000FFFFFFFFFFFFFFFFD0
    :08003800FFFFFFFFFFFFFFFFC8
    :08004000FFFFFFFFFFFFFFFFC0
    :08004800FFFFFFFFFFFFFFFFB8
    :08005000FFFFFFFFFFFFFFFFB0
    :08005800FFFFFFFFFFFFFFFFA8
    :08006000FFFFFFFFFFFFFFFFA0
    :08006800FFFFFFFFFFFFFFFF98
    :08007000FFFFFFFFFFFFFFFF90
    :08007800FFFFFFFFFFFFFFFF88
    :08008000FFFFFFFFFFFFFFFF80
    :08008800FFFFFFFFFFFFFFFF78
    :08009000FFFFFFFFFFFFFFFF70
    :08009800FFFFFFFFFFFFFFFF68
    :0800A000FFFFFFFFFFFFFFFF60
    :0800A800FFFFFFFFFFFFFFFF58
    :0800B000FFFFFFFFFFFFFFFF50
    :0800B800FFFFFFFFFFFFFFFF48
    :0800C000FFFFFFFFFFFFFFFF40
    :0800C800FFFFFFFFFFFFFFFF38
    :0800D000FFFFFFFFFFFFFFFF30
    :0800D800FFFFFFFFFFFFFFFF28
    :0800E000FFFFFFFFFFFFFFFF20
    :0800E800FFFFFFFFFFFFFFFF18
    :0800F000FFFFFFFFFFFFFFFF10
    :0800F800FFFFFFFFFFFFFFFF08
    :020000040020DA
    :08000000FFFFFFFFFFFFFFFF00
    :020000040030CA
    :0E00000000000E1E0080A1000FC00FE00F4098
    :00000001FF
    as you see, it far different from yours...

    Yours can't work, let's see the first lines... wich are supposed to be the program stuff
    Code:
    :1000000000000000000000000000000000000000F0
    :1000100000000000000000000000000000000000E0
    :1000200000000000000000000000000000000000D0
    :1000300000000000000000000000000000000000C0
    :1000400000000000000000000000000000000000B0
    :1000500000000000000000000000000000000000A0
    :100060000000000000000000000000000000000090
    :100070000000000000000000000000000000000080
    :100080000000000000000000000000000000000070
    :100090000000000000000000000000000000000060
    :1000A0000000000000000000000000000000000050
    totally blank

    and the lasts lines...
    Code:
    :0800C800FFFFFFFFFFFFFFFF38
    :0800D000FFFFFFFFFFFFFFFF30
    :0800D800FFFFFFFFFFFFFFFF28
    :0800E000FFFFFFFFFFFFFFFF20
    :0800E800FFFFFFFFFFFFFFFF18
    :0800F000FFFFFFFFFFFFFFFF10
    :0800F800FFFFFFFFFFFFFFFF08
    :020000040020DA
    :08000000FFFFFFFFFFFFFFFF00
    :020000040030CA
    :0E00000000000E1E0080A1000FC00FE00F4098
    :00000001FF
    those are good so far. If i program my PIC here with the dump you sent... i have nothing working... same thing as you get on your side.

    So use another device programmer AND/or another software to fix the problem.

    Woohoo we got it

    Did your tried the capacitor stuff?
    Last edited by mister_e; - 11th December 2006 at 21:33.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  28. #28
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Sorry Steve, you lost me there !

    Are you saying that its a hardware issue (the Olimex PG-02 programmer) or software (winpic or picpgm) - or a incompatibility between either and the 18F2550. It has worked fine in the past with other PICs ??

    I've just tried an option on the WinPIC software, and programmed the CODE only. The code loaded with no issues as can be seen by the log below
    Programming...
    Erasing: CODE ..
    Programming CODE, 0x000000..0x001016
    Verifying CODE, 0x000000..0x001016
    Verifying 0x000000..0x001016
    Programming finished, no errors.
    I then unchecked the data and code boxes and just tried the config memory box - The first time I tried it it errored - the second time it worked

    Programming...
    Programming CONFIG, 0x300000..0x30000C
    Verifying CONFIG, 0x300000..0x30000C
    Verifying 0x300000..0x30000C
    Programming finished, no errors.
    Rechecking all the boxed I varified the PIC and it reported
    Cannot verify at different voltages with this hardware.
    Verifying...
    Verifying CODE, 0x000000..0x001016
    Verifying 0x000000..0x001016
    No DATA MEMORY in buffer to verify.
    Verifying CONFIG, 0x300000..0x30000C
    Verifying 0x300000..0x30000C
    Verify finished, no errors.
    I've attached the config memory settings displayed under that tab - I have no idea if they are right ?

    I also need to re-build the breadboard as I've used it for something else i was playing with, so I can't confirm yet if doing it this way has worked and your test code is actually working when hooked up as per the schematic I posted eariler.
    Attached Images Attached Images  

  29. #29
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Are you saying that its a hardware issue (the Olimex PG-02 programmer) or software (winpic or picpgm) - or a incompatibility between either and the 18F2550. It has worked fine in the past with other PICs ??
    Could be both, i just compared the dumped.txt file with the .HEX i got here when reading back the PIC. As you see, yours is blank on the firsts lines (0000) wich is the program area.

    Couldn't find "C:\Program Files\Microchip\MPLAB IDE\PIC18F2550.dev", please borrow/copy from MPLAB !
    i found it here in the same path... just make sure you have this file as well OR re-install MPLAB 7.50.

    it have something to do as it state the programming area range, config fuse mem addresses etc etc.

    mmm
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  30. #30
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    I've breadborded it and it still does not work...

  31. #31
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    how about the PIC18F2550.dev File?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  32. #32
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve,

    I've pointed the programmer to the correct path of the DEV files and it made no difference. ( as you can see no message saying it can't find the file)
    Programming...
    Erasing ("bulk" or "chip") ...
    Programming CODE, 0x000000..0x0000B4
    Verifying CODE, 0x000000..0x0000B4
    Verifying 0x000000..0x0000B4
    Programming CONFIG, 0x300000..0x300006
    Verifying CONFIG, 0x300000..0x300006
    Verifying 0x300000..0x300006
    Verify Error: 300000: read 000000, wanted 0030C0, mask 00FFFF ==> diff=0030C0
    Verify Error: 300002: read 000E3E, wanted 00CEFE, mask 00FFFF ==> diff=00C0C0
    Verify Error: 300004: read 008000, wanted 00F8FF, mask 00FFFF ==> diff=0078FF
    Verify Error: 300006: read 0000A1, wanted 00FFBB, mask 00FFFF ==> diff=00FF1A
    ERROR: Programming FAILED !
    I also typed in the "30C0 and CEFE" into the first two config memory locations and tryed programming that - it errored as before.

    I've had this programmer working as I've used it to program USB RC-Joystick file, but I've juts tried that code and it too errored. The only difference is I'm now using XP Home and SP2, but I'm sure that would have no bearing on this issue ?

    Malc

    EDIT - oh and this was the third and last 18F2550 PIC I had 0 fresh out of the tube !
    Last edited by malc-c; - 11th December 2006 at 22:40.

  33. #33
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Looking at their schematic...
    <img src="http://www.olimex.com/dev/images/pic-pg2c-sch.gif">

    PGM pin is left floating (sv3-3)... but you said you already tied it to gnd so it shouldn't be the problem... should

    You said MCLR/VPP was close to 13Volts... so couldn't be this

    So if the Software is not well done, this poor device programmer can't work properly. 18Fs are a little bit more tricky and noise sensitive..

    Can you just try to use ICSP?

    Something like ... (courtesy of Melabs)
    <img src="http://www.melabs.com/images/icsp1.gif">
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  34. #34
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Verify Error: 300000: read 000000, wanted 0030C0, mask 00FFFF ==> diff=0030C0
    Verify Error: 300002: read 000E3E, wanted 00CEFE, mask 00FFFF ==> diff=00C0C0
    Verify Error: 300004: read 008000, wanted 00F8FF, mask 00FFFF ==> diff=0078FF
    Verify Error: 300006: read 0000A1, wanted 00FFBB, mask 00FFFF ==> diff=00FF1A
    So now it doesn't program the config fuses.... not even better. Read back the PIC and post the first lines of the .HEX files.

    I don't know if it could be a XP issue or not, but if the timing is not good when programming, for sure it will never work as expected.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  35. #35
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve,

    Just tried using ICSP and that failed too

    Info: Loading definitions for "PIC18F2550" from devices.ini .
    Info: Support for some newer PIC18F devices added by Martin v.d. Werff 2005
    Parsed "C:\Program Files\Microchip\MPLAB IDE\Device\PIC18F2550.dev" : found 113 bit combinations in 39 configuration bit groups .
    PIC18F: family='21'=4550, WriteLatch=32 bytes, EraseLatch=64 bytes .
    Initialising PIC-Programmer: Success.
    Testing: delay(500ms) took 0.50 seconds, timer_freq=3.5795 MHz ... ok
    Programming...
    Erasing ("bulk" or "chip") ...
    Programming CODE, 0x000000..0x0000B4
    Verifying CODE, 0x000000..0x0000B4
    Verifying 0x000000..0x0000B4
    Verify Error: 000000: read 00FFE3, wanted 00EF43, mask 00FFFF ==> diff=0010A0
    Verify Error: 000002: read 00FFFF, wanted 00F000, mask 00FFFF ==> diff=000FFF
    Verify Error: 000004: read 00FFFF, wanted 005008, mask 00FFFF ==> diff=00AFF7
    Verify Error: 000006: read 00FFFF, wanted 000B07, mask 00FFFF ==> diff=00F4F8
    More Verify Errors, unable to list all (total=91)
    Programming CONFIG, 0x300000..0x300006
    Verifying CONFIG, 0x300000..0x300006
    Verifying 0x300000..0x300006
    Verify Error: 300000: read 00C080, wanted 0030C0, mask 00CF3F ==> diff=00C000
    Verify Error: 300002: read 00FFFF, wanted 00FECE, mask 001F3F ==> diff=000131
    Verify Error: 300004: read 00FFFF, wanted 00F8FF, mask 008700 ==> diff=000700
    Verify Error: 300006: read 00FFFF, wanted 00FFBB, mask 0000E5 ==> diff=000044
    ERROR: Programming FAILED !
    Tried the following:
    Disconnect the programmer, insert the PIC, connect the serial lead, launch winpic, load the code and programmed - it errored. Read back and all the code locations were FFFF.

  36. #36
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Ohhh - checked the config screen after doing that and see the attached - that was not there before - all those listings !!
    Attached Images Attached Images  

  37. #37
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    OK DUDE, time to get another device programmer. PICKIT2, BK844a, PICSTART PLUS, EasyPIC 4 worked ALL fine here between our posts.

    And guess what's inside the PICKIT 2??? a PIC8F2550

    Sorry i can't help more than this
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  38. #38
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yeah it's kind of interesting to see that there's no config fuse correctly passed... disable WDT, LVP, and set XT osc manually, then re-program your PIC..
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  39. #39
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Loading the following:

    Code:
    ASM
        __CONFIG  _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L 
        __CONFIG  _CONFIG1H, _FOSC_XT_XT_1H & _FCMEN_OFF_1H  &  _IESO_OFF_1H 
        __CONFIG  _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L &  _BORV_1_2L  & _VREGEN_OFF_2L 
        __CONFIG  _CONFIG2H, _WDT_OFF_2H 
        __CONFIG  _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H 
        __CONFIG  _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L 
    
    ENDASM
    ADCON1=$0F
    TRISB=%00000000                  'set PORTB as all output
    PORTB=0
    
    ByteA   var byte
     
    main:
        for bytea=0 to 7
            PORTB=DCD BYTEA
            PAUSE 250
            NEXT
        PORTB=255
        PAUSE 250
        goto main
    into winpic now displays the attached settings
    Attached Images Attached Images  

  40. #40
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    AAAAARRRRRRGHHH!!!!<img src="http://www.mister-e.org/Pics/not_happy_thumb.gif"><img src="http://www.mister-e.org/Pics/RollinEyes.gif"><img src="http://www.mister-e.org/Pics/Mecontent08.gif">

    OK the config are good, but the software/hardware don't program it the right way... do you have another machine but with WIN98 ?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. PIC16F690 PBP boundary crossing warning message
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th May 2008, 11:17
  2. Micro Code Studio - Warning message
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th November 2006, 21:17
  3. MicroCode Studio Boundary Warning Message
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th March 2006, 09:13
  4. Message String Table using Readcode
    By mytekcontrols in forum Code Examples
    Replies: 2
    Last Post: - 10th July 2005, 23:17
  5. warning message
    By pic beginner in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd July 2004, 02:53

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