Program compiles and writes but can't run


Closed Thread
Results 1 to 16 of 16

Hybrid View

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

    Default Program compiles and writes but can't run

    I am new to PICBasic Pro and the PICkit2 Starter Kit which I just purchased. I could get the PCBDemo to run via the PICkit2 with the PIC16F690 that came on the Demo board. However, when I tried run one of the sample programs that comes with PCIBASICPro Demo (SLEEP.bas), it compiles OK with MCS and I can import the resulting hex file into PICkit2 and target the device. It appears to write to the device OK, although the Verify finds an error mismatch in the Data memory, which I presume is not critical since the device has not executed the program yet or created any stored data.
    However, when I try to run the program that was written to the device by clicking the box for /MCLR the program doesn't run. Here is the code I am trying to run which is very simple. Can anyone advise me what I may be doing wrong :in trying to run this program in PICkit2??
    'SLEEP Command
    'Slowly blink LED using low power mode delay

    LED CON 16 'Identify LED pin

    Loop:
    TOGGLE LED
    SLEEP 10
    GOTO loop

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    There is a little check box called ON listed below the text, VDD PIC Kit 2, it must be checked to power your demo board from the usb.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    There is a little check box called ON listed below the text, VDD PIC Kit 2, it must be checked to power your demo board from the usb. Here is a sample that works on that board.
    Code:
    ;@MyConfig =  
    @MyConfig = _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON  
    @MyConfig = MyConfig & _MCLRE_ON & _BOR_OFF 
    @ __config  MyConfig 
    
    DEFINE OSC 4
    PortA = 0
    PortB = 0
    PortC = 0
    TRISA = 1
    TRISB = 0
    TRISC = 0
    i var byte
    ANSEL = 0
    ANSELH = 0
    CM1CON0 = 0
    CM2CON0 = 0
    main:
    
    portc = 0
    pause 500
    
    for i = 1 to 15; step -1
    
    
    portC = i
    i=i  << 1 
    pause 250
    next i
    sound portB.6, [120,2,124,2,123,2,121,2]
    sound portC.6, [120,2,124,2,123,2,121,2]
    goto main
    end
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default Can't run program

    I already had the VDD PICK2 On box checked to power up the Demo board.

    I tried to compile the code sample you provided that you say runs with this Demo board and I get a error 118...Overwriting previous address contents., and a large number of Errors #113..Symbol not previously defined.

    Any other suggestions as to how to get the program to run??

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jellis00 View Post
    I already had the VDD PICK2 On box checked to power up the Demo board.

    I tried to compile the code sample you provided that you say runs with this Demo board and I get a error 118...Overwriting previous address contents., and a large number of Errors #113..Symbol not previously defined.

    Any other suggestions as to how to get the program to run??
    Ok, that is easy. In the PBP root directory there are files named for the PIC you are using, ending with the suffix .inc and in these files are "DEFAULT" config statements, like the one at the beginning of the code I listed. Open the 16F690.inc file located there and find the config line, The MPASM config line will say this
    Code:
    __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
    Add an ; semicolon like so
    Code:
    ;__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
    and that will solve the overwrite issue, you will for evermore have to include a config line into the code you write for this chip unless you change it back. OR you might try commenting it out in my code. Let's face it, the DEFAULT configs are there so noobies can get some code to run without knowing anything about config fuses, personally I think they serve to confuse people more than help, better I say, put this information in the manual and all the books on PICs.<br>By putting the configs in your code, it becomes easy to change oscillator, and MCLRE statements etc . . .<br><br>Now as for Symbol not previously defined, 2 main causes are inaccurate choices of symbols like BOR or MCLRE and others too, and The other MAIN reason is not having selected the correct PIC in Microcode Studio, and since I KNOW this code is correct, I would say that is the problem there. I notice it gets changed sometimes (which PIC is selected ) from the last I ran it. So you need to always check that first on compile failure with symbol error.
    Last edited by Archangel; - 21st March 2009 at 05:59.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default Program won't run

    OK, I understand about editing the include file.
    However your instructions on selecting the right PIC in MicroCode Studio confuse me....I went thru all the menus in MSC and couldn't see where to do that. Please advise how I do that in MSC.

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


    Did you find this post helpful? Yes | No

    Default Program won't run

    Joe S., I commented out the line in the include file per your instructions and tried to compile again and still get all the 113 errors. ?????
    Did I mention that I am using the PICBASIC PRO Demo compiler that came with the PICkit2 Starter Kit and not a production version of PICBASIC PRO Demo.....would that make a difference?

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jellis00 View Post
    OK, I understand about editing the include file.
    However your instructions on selecting the right PIC in MicroCode Studio confuse me....I went thru all the menus in MSC and couldn't see where to do that. Please advise how I do that in MSC.
    Do you have the "compile and program" tool bar turned on?
    If not go to view and select it from the tool bar option.
    Then you should see a drop down list box with the supported chips.
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by jellis00 View Post
    LED CON 16 'Identify LED pin
    Which port should this be ???????
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  10. #10
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    49


    Did you find this post helpful? Yes | No

    Default

    jellis00,

    I do have the same problem before if I used MPASM to compile. Check your setting and don't use MPASM to compole.
    I dont know whats the problem cause I'm still new but my program run smoothly without using MPASM. You should give a try.

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