ICD & PBP && how to get it to work


Closed Thread
Results 1 to 27 of 27

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    It's tough to offer help on source code I haven't seen. Can you post the code you're having problems with?
    Regards,

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

  2. #2
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Need help on these two ICD problems

    Quote Originally Posted by Bruce View Post
    It's tough to offer help on source code I haven't seen. Can you post the code you're having problems with?
    Bruce, to simplify things so I can figure out what is going on, I am running the MCS+ ICD for a rather simple program, for which I have attached the code at the end of this posting.

    My main problem is that when I get the ICD to run, there is no Tab in the ICD Explorer window for Variables (to the right in the attached image), when all the documentation, including your tutorial at your web site, says there should be. I looked everywhere for a menu item or switch to make the Variables tab visible and couldn't find any info on how to do so.

    Another problem I am having intermittently is that sometimes the ICD Run shows what is titled as an "ICD Message" as shown in the second attached image. It doesn't happen all the time, but when it does, I don't understand what is causing it or how to fix it. Since the ICD is apparenty very sensitive to having the clock specified correctly for it to run, I thought it might be that my OSC speed wasn't properly specified in the configs and the DEFINE OSC 16 statement, but I double checked this and it appears correct.

    If you can help me figure out these two problems, it would be greatly appreciated.
    Code:
    '****************************************************************
    '*  Name    : Blinky_test.pbp                                   *
    '*  Author  : John R. Ellis                                     *
    '*  Notice  : Copyright (c) 2010 LodeStar Assoc., Inc.          *
    '*          : All Rights Reserved                               *
    '*  Date    : 3/4/2010                                          *
    '*  Version : 1.0                                               *
    '*  Notes   : 1) Iterations of this program will test all ports *
    '             of the MCU by blinking the EasyPic6 LED connected *
    '             to each port.                                     *
    '*          : 2) This version of the code is written to test    *
    '                the EasyPic6 when 18F2550 or 18F4550 is        *
    '                installed.                                     *
    '****************************************************************
    Pause 10     ' This statement is placed at beginning of code for ICD breakpoint
    ASM ; 18F2550/4550, 8mhz crystal
       __CONFIG   _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
       __CONFIG   _CONFIG1H, _FOSC_HSPLL_HS_1H
       __CONFIG   _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
       __CONFIG   _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
       __CONFIG   _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
       __CONFIG   _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    
    Include "Modedefs.Bas"
    
    DEFINE OSC 16
    TRISA = 0                   ' Set all ports to outputs as test LEDs
    TRISB = 0
    TRISC = 0
    TRISD = 0
    TRISE = 0
    	
    INCLUDE "ALLDIGITAL.pbp"    ' Sets all registers for digital ops.
    
    PORTA = 0                   ' Turn all test LED's off before test mainloop
    PORTB = 0
    PORTC = 0
    PORTD = 0
    PORTE = 0                            
    
    mainloop:
             ' After running this program for PORTA, use EDIT/REPLACE menu to 
             ' then change PORTA to PORTB, PORTC, PORTD and PORTE and run each
             ' case again to complete testing of all ports/LED's.
              
                HIGH PORTA.1    ' Turn on LED connected to PORTA.0
                PAUSE 500       ' Delay for .5 seconds
                LOW PORTA.1     ' Turn off LED connected to PORTA.0
                PAUSE 500       ' Delay for .5 seconds
    
                HIGH PORTA.2
                PAUSE 500
                LOW PORTA.2
                PAUSE 500
    
                HIGH PORTA.3
                PAUSE 500  
                LOW PORTA.3
                PAUSE 500
    
                HIGH PORTA.4
                PAUSE 500 
                LOW PORTA.4
                PAUSE 500
    
                HIGH PORTA.5
                PAUSE 500            
                LOW PORTA.5
                PAUSE 500
            
                HIGH PORTA.6
                PAUSE 500
                LOW PORTA.6
                PAUSE 500
                
                HIGH PORTA.7
                PAUSE 500
                LOW PORTA.7
                PAUSE 500
            
            Goto mainloop   ' Go back to loop and blink LED sequence forever
    End
    Attached Images Attached Images
    Last edited by jellis00; - 22nd March 2010 at 00:30. Reason: Add images:

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


    Did you find this post helpful? Yes | No

    Default

    I think you might need to actually declare a few variables if you expect MCS ICD to show them...;o)

    I don't think MCS+ ICD is smart enough to yank variables from include files. That + ZERO support is
    why I no longer use, nor recommend, MCS+ ICD.
    Last edited by Bruce; - 22nd March 2010 at 00:40.
    Regards,

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

  4. #4
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    I don't think MCS+ ICD is smart enough to yank variables from include files. That + ZERO support is
    why I no longer use, nor recommend, MCS+ ICD.
    pssst... so... just between you, me, and that lamp post over there... What do you use and recommend?
    I'm not looking to jump ship any time soon, but it's nice to know what other folks are using and why they like it.


    steve

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


    Did you find this post helpful? Yes | No

    Default

    If I need to know specific timing for time critical routines, I'll use MPLAB/MPSIM software simulation. Testing on hardware, I just build it & test the code on the hardware it's going to run on. Haven't seen any software yet that acts 100% the same as hardware..;o)

    MCS+ ICD used to be a pretty cool option, but support for it seems to have dropped off the planet.
    Regards,

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

  6. #6
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    If I need to know specific timing for time critical routines, I'll use MPLAB/MPSIM software simulation. Testing on hardware, I just build it & test the code on the hardware it's going to run on. Haven't seen any software yet that acts 100% the same as hardware..;o)
    Thanks Bruce,

    Actually, I've never used ICD. (been to lazy to figure it out I guess )
    I just "build the hardware and run it" and if I've got a extra few pins I'll connect a LCD display so that I can show the values of select variables.

    Just curious what the "experienced users" use. Thanks!


    steve

  7. #7
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default This one has declared variables but no ICD Variables Tab??

    Quote Originally Posted by Bruce View Post
    I think you might need to actually declare a few variables if you expect MCS ICD to show them...;o)
    OK, I could understand that no Variables Tab would show if no variables had been declared. However, here is another program in which many variables were declared. I have also attached an image of the MCS+ screen while the ICD was running that shows it stopped at a breakpoint....but notice that even though the variables are declared in the program no Variables Tab appears in the ICD Explorer window. So the problem is still there.
    Can anyone tell me how to make the Variables Tab appear in MCS+???
    Code:
    Pause 10     ' This statement is placed at beginning of code for ICD use
    ;--- if you un-comment these, you must comment the ones in the .inc file--
    ASM ; 18F2550/4550, 8mhz crystal
       __CONFIG   _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
       __CONFIG   _CONFIG1H, _FOSC_HSPLL_HS_1H
       __CONFIG   _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
       __CONFIG   _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
       __CONFIG   _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
       __CONFIG   _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    
    ' Set Registers
    TRISA = 0                 ' PortA output connections are used for LCD interface
    TRISB = %00000100         ' PORTB.2 is an input from switch grounding
    TRISC.0 = 0               ' PortC.0 is used for a Heartbeat LED output
    TRISC.2 = 0               ' PortC.2 is used for the LCD R/W connection
    
    DEFINE OSC 16
    DEFINE I2C_SLOW 1   ' Set i2c to the standard speed
    DEFINE I2C_HOLD 1   ' Enable recieving i2c device to pause communication
    Include "Modedefs.Bas"
    INCLUDE "ALLDIGITAL.pbp"  ' Sets all registers for digital ops.
    
    ' * NOTES for use with EasyPic6 development board:
        ' Make sure that SW6.8 on the EasyPic6 is set to ON position before powerup
        ' for LCD's requiring backlight.                                                 
        'For use with COG 2x16 LCD:
    '     - Turn on Port Expander switches SW6.1, SW6.2, SW6.3, SW6.4 and SW6.5.
    '     - Turn on COG LCD 2x16 switches SW10.1, SW10.2, SW10.3, SW10.4, SW10.5 and SW10.6.
    
    '---------------------- 18F4550 Port/PIN Connections ]--------------------
    'I/O pin connections to the 18F4550 MCU are as follows:
    'PORTA.0 (02) RA0 connected to LCD D4.
    'PORTA.1 (03) RA1 connected to LCD D5.
    'PORTA.2 (04) RA2 connected to LCD D6.
    'PORTA.3 (05) RA3 connected to LCD D7.
    'PORTA.4 (06) RA4 not connected
    'PORTA.5 (07) RA5 not connected
    'PORTB.0 (21) Connected as I2C SDA output to DS1337 
    'PORTB.1 (22) Connected as I2C SCL output to DS1337 
    'PORTB.2 (23) Connected as INT2 interrupt from pin-7 (_INTA) of DS1337 RTC. 
    'PORTB.3 (24) RB3 not connected 
    'PORTB.4 (25) RB4 not connected 
    'PORTB.5 (26) RB5 not connected 
    'PORTB.6 (27) Connected as PGC for ICSP connection
    'PORTB.7 (28) Connected as PGD for ICSP connection 
    'PORTC.0 (11) RC0 not connected. 
    'PORTC.1 (12) RC1 connected as an output to a Red LED for battery low.
    'PORTC.2 (13) RC2 connected to LCD R/W. 
    'PORTC.3 (14) RC3 not provided on 18F4550.
    'PORTC.4 (15) not connected.
    'PORTC.5 (16) not connected. 
    'PORTC.6 (17) RC6 normally connected to poll grounding of external switch.
    'PORTC.7 (18) normally not connected.
    
    '--------------[ Declare Variables, Aliases & Constants ]---------------  
    ' Variables & Aliases for Pins other than RTC use
    ' ===============================================
    Digit1   var byte      ' Used to parse 3-digit integer into LCD characters                                                          
    Digit2   var byte      ' NOTICE ALL OF THESE DECLARED VARIABLES!!   
    Digit3   var byte
    ext_pwr  VAR PORTC.6   ' Alias to control power to Ultrasonic sensor
    rng0     VAR w0.Byte0  ' LSB of range measurement when right justified
    rng1     VAR w0.byte1  ' MSB of range measurement when right justified 
    rngNum1  Var Byte      ' 1st numeral of rng0 for display on LCD as character
    rngNum2  VAR Byte      ' 2nd numeral of rng0 for display on LCD as character
    rngNum3  VAR BYTE      ' 34d numeral of rng0 for display on LCD as character
    SCL      VAR PORTB.1   ' I2C clock pin 
    SDA      VAR PORTB.0   ' I2C data pin
    Spare_1  VAR PORTB.7   ' PGD for ICSP & Spare I/O for normal ops
    Spare_2  VAR PORTB.6   ' PGC for ICSP & Spare I/O for normal ops
    w0       var word      ' W0 is the word value to store the range data 
                   
    ' Constants
    '==========
     srfdevice CON $E0  ' Device address for SRF02 ultrasonic range finder
     Vthr      CON 46   ' Threshold (3.3v) to trigger battery low voltage warning
                        ' ...this is dictated by the drop-out and output voltage    
                        ' of the voltage regulator used in the power circuit.                    
    
    ' Initialize the display
        Pause 500       ' Wait for LCD to startup after power on
        GOSUB InitializeDisplay
    
    mainloop: 
        Lcdout $fe, 1   ' Clear LCD screen
        PORTC.0 = 1     ' Blink Heartbeat LED during mainloop
        Pause 500       ' Wait 0.5 second
        PORTC.0 = 0
        If PORTB.2 = 0 Then
           Gosub Range
        Endif
        Goto mainloop   ' Do it forever
            
    ' ----------------------[ START LIST OF SUBROUTINES ]-------------------
    '*********************************************************************** 
    
    InitializeDisplay:      ' Commented out till LCD installed
    '=================
    '--SETUP FOR USING 2x16 LCD THAT IS INSTALLED IN EASYPIC6-----  
      ' LCD DEFINES FOR USING 2x16 LCD with PortA in EASYPIC6
      '======================================================
       DEFINE LCD_DREG PORTA      ' Use PORTA for LCD Data
       DEFINE LCD_DBIT 0          ' Use lower(4) 4 bits of PORTA
                                      ' PORTA.0 thru PORTA.3 connects to
                                      ' LCD DB4 thru LCD DB-7 respectively
       DEFINE LCD_RSREG PORTA     ' PORTA for RegisterSelect (RS) bit
       DEFINE LCD_RSBIT 4         ' PORTA.4 pin for LCD's RS line
       DEFINE LCD_RWREG PORTC     ' LCD read/write port
       DEFINE LCD_RWBIT 2         ' LCD read/write bit
       DEFINE LCD_EREG PORTA      ' PORTA for Enable (E) bit
       DEFINE LCD_EBIT 5          ' PORTA.5 pin for LCD's E line
       DEFINE LCD_BITS 4          ' Using 4-bit bus
       DEFINE LCD_LINES 2         ' Using 2 line Display
       DEFINE LCD_COMMANDUS 1500  ' Command Delay (uS)
       DEFINE LCD_DATAUS 44      ' Data Delay (uS)
           
        ' DEFINE LCD Control Constants  
            Line1   CON 128           ' Point to beginning of line 1 ($80) 
            Line2   CON 192           ' Point to beginning of line 2 ($C0)
        
        ' Test the LCD during initialization
            LCDOut $FE,1:FLAGS=0:Pause 250       ' Clear Display
            LCDOut $FE,Line1+3," LCD TEST "      ' Display "Power On" on 1st line
            Pause 500
            LCDOut $FE,Line2+2,"..Power On..!!" ' Display "LCD Test" on 2nd line
            PAUSE 1000
    Return
    
    Move_Delay:     ' Subroutine used during text moving on an LCD
    '==========
    ' Function used for text moving
      Pause 500                     ' You can change the moving speed here
    Return
    
    Range:
    '=====
    ENABLE DEBUG
        High PORTC.0     ' Turn on Test LED to indicate Ranging routine entered
        HIGH ext_pwr     ' Turn on power to the SRF02 in order to use the I2C bus
                         ' without distortion.
        PAUSE 3000       ' Delay to let I2C bus stabilize after SRF02 turn on
        'DEFINE WRITE_USED 1 'Required if only writing WORD variables in v2.6
            ' Make SRF02 Range Measurement           
                I2CWRITE SDA,SCL,$E0,0,[80]' Request start of ranging in inches
                pause 100                  ' Wait for ranging to finish
                I2CREAD SDA,SCL,$E0,2,[rng1,rng0] ' Get ranging results
                pause 10                         
                WRITE 253,rng1             ' Write range to EEPROM
                PAUSE 10
                Write 254,rng0
                PAUSE 10       
            'Convert measurement to LCD numerals in inches
                 Digit1 = rng0 DIG 0
                 Digit2 = rng0 DIG 1
                 Digit3 = rng0 DIG 2
            ' Display range measurement on LCD display in inches 
                LCDOut $FE,1               ' Clear display
                Pause 50
                LCDOut $FE,$80,"Range:"  ' Display  on 1st line
                PAUSE 10
                LCDOut $FE,$C0,Digit1,Digit2,Digit3," in."  ' Display on 2nd line
                PAUSE 1000                    ' Allow Time for user to view          
        LOW ext_pwr  ' Turn off power to the SRF02 at end of display
                     ' This statement will distort the I2C bus and ext_pwr
                     ' must be HIGH before any attempts are made to use the
                     ' I2C bus.
        PAUSE 1000    ' Delay to permit I2C bus to stabilize after SRF02 off
    DISABLE DEBUG     
        ' Resume Main Program 
    Return
    End     ' Safety measure to insure program stops if reaches here
    Attached Images Attached Images

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


    Did you find this post helpful? Yes | No

    Default

    I don't have a 4550 to test, but it works fine with an 18F4431. See attached.

    Does it work if you try something simple like this?
    Code:
    Pause 10     ' This statement is placed at beginning of code for ICD use
    ;--- if you un-comment these, you must comment the ones in the .inc file--
    ASM ; 18F2550/4550, 8mhz crystal
       __CONFIG   _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
       __CONFIG   _CONFIG1H, _FOSC_HSPLL_HS_1H
       __CONFIG   _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
       __CONFIG   _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
       __CONFIG   _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
       __CONFIG   _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
     
     DEFINE OSC 16
     
     MyVar VAR BYTE
      
    Main:  
      FOR MyVar = 0 TO 50
       HIGH 0
       PAUSE 5
       LOW 0
       PAUSE 5
      NEXT
      GOTO Main
      
      END
    If the above works, then it may be something in your code causing the problem
    or maybe a bad ICD model file?

    Sorry I can't offer more help, but I haven't used MCS+ ICD in years.

    Have you tried contacting Mecanique for tech support?
    Attached Images Attached Images  
    Regards,

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

  9. #9
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Samed code doesn't show Variables Tab in my MCS+??

    Quote Originally Posted by Bruce View Post
    I don't have a 4550 to test, but it works fine with an 18F4431. See attached.

    Does it work if you try something simple like this?
    Code:
    Pause 10     ' This statement is placed at beginning of code for ICD use
    ;--- if you un-comment these, you must comment the ones in the .inc file--
    ASM ; 18F2550/4550, 8mhz crystal
       __CONFIG   _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
       __CONFIG   _CONFIG1H, _FOSC_HSPLL_HS_1H
       __CONFIG   _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
       __CONFIG   _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
       __CONFIG   _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
       __CONFIG   _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
     
     DEFINE OSC 16
     
     MyVar VAR BYTE
      
    Main:  
      FOR MyVar = 0 TO 50
       HIGH 0
       PAUSE 5
       LOW 0
       PAUSE 5
      NEXT
      GOTO Main
      
      END
    If the above works, then it may be something in your code causing the problem
    or maybe a bad ICD model file?

    Sorry I can't offer more help, but I haven't used MCS+ ICD in years.

    Have you tried contacting Mecanique for tech support?
    I pasted your code into my MCS+ and ran the ICD and it still doesn't show the Variables Tab (see attached image).
    I notice that the image of your ICD run shows a couple of additional items in the Tool Bar that mine doesn't show. It makes me wonder if there is a version difference between us that may be causing my problem. My version of MCS+ is 3.0.0.5. What is yours??

    I am also going to send your image and my image to Mechanique and ask them what is going on. I really appreciate your help on this
    Attached Images Attached Images

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


    Did you find this post helpful? Yes | No

    Default

    MCS+ 3.0.0.5 on Windows XP.
    Regards,

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

Similar Threads

  1. Pbp - icd
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 16th March 2010, 04:26
  2. MCSP ICD does not work
    By ardhuru in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th May 2008, 21:15
  3. ICD Woes
    By spad13m in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 14th February 2008, 05:56
  4. How to set ICD-2 clone to work with PBP?
    By G-R-C in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th October 2006, 02:50
  5. PBP "USART.BAS" Doesn't Work
    By Corey in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 21st October 2003, 12:29

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