Trouble getting started


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68

    Default Trouble getting started

    Trying to compile a simple program for a PIC12F683 using PBP 3 in MPLAB. I am getting the following error:
    Error[118] C:\USERS\MIKE\DESKTOP\STUFF\PROJECTS\GOLDWING TRUNK OPENER\GOLDWING TRUNK OPENER.ASM 139 : Overwriting previous address contents (2007)

    The offending line is the first, __config...
    If I comment the line out, it compiles okay, but not wirh the config settings that I want.

    How do I set the config items the way I want?

    Code:
    '@ __config _HS_OSC & _WDT_OFF & _MCLRE_OFF
    DEFINE osc 8			' setup the clock for 8 MHz resonator
    
    ' configure some defines for the A/D reads
    DEFINE ADC_BITS 10		
    DEFINE ADC_CLOCK 3
    DEFINE ADC SAMPLES 20
    
    ; variables
    pulse_width var word	' this determines the width of the output pulse, 1.2 ms - 1.8 ms
    
    ' initialize the program
    
    TRISIO = 	%00000000  		' set all GPIO pins to output
    ANSEL =  	%00000000		' set all GPIO pins to digital
    CMCON0 = 	%00000111		' Turn of the comparators
    
    ' Set TMR0 to interrupt every 20 milliseconds
    OPTION_REG = %00000111		' Set TMR0 configuration 1:256 prescaler
    INTCON = 	%10100000		' Enable TMR0 interrupts
    TMR0 = 		101				' set the timer0 offset for 50.0801 Hz
    
    GPIO = 		%00000000		' set GPIO to all 0's  
    pulse_width = 127			' center value, 1.5 ms pulse
    
    On Interrupt Goto pulse_out	; this is where we go when the 20ms timer interrupts
    
    main_program:
      	pulse_width = 255		' move to end (unlock the trunk)			
        
        pause 500               ' give it time to reach the end
        
     	pulse_width = 0         ' Move to beginning
    
        pause 500               ' give it time to reach the beginning
    end
    
    disable
    
    pulse_out:
    	TMR0 = 101				' reset the offset
    	INTCON.2 = 0    		' Reset timer interrupt flag
    	pulsout GPIO.0,  + 10 pulse_width 	' normalize the setting for 1.2 ms to 1.8 ms pulses
    resume
    
    end
    PickyBiker says, "Riding a motorcycle eases programming frustration".

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default Re: Trouble getting started

    Have you tried searching for "beginner config"?
    http://www.picbasic.co.uk/forum/showthread.php?t=543

    Sounds like you are defining the same thing twice.

    Robert

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


    Did you find this post helpful? Yes | No

    Default Re: Trouble getting started

    Hi,

    If you have PBP3 then use #CONFIG - check the manual for details.

    If you're on an older version you need to do one of two things:
    A) Comment out the default config in the .inc file for the target processor (located in your PBP folder). Put the desired config in your PBP source file (like you're trying to do now)
    or
    B) Edit the .inc file so it contains the desired config. Make sure you back up the original file firts.

    Countless of posts has been made on the subject over the years, search the forum and you should find more details if needed.

    /Henrik.

  4. #4
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default Re: Trouble getting started

    "If you have PBP3 then use #CONFIG - check the manual for details."

    That was the solution. Thanks!

    I think PBP 3 made a nice improvement here allowing a #config block without needing to edit an inc file.
    PickyBiker says, "Riding a motorcycle eases programming frustration".

Similar Threads

  1. Help Getting Started
    By doggitz in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 25th August 2009, 21:30
  2. getting started
    By cunninghamjohn in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th November 2008, 18:42
  3. Getting started... again...
    By Neosec in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 31st May 2008, 02:09
  4. How did you get started .....
    By keithdoxey in forum General
    Replies: 25
    Last Post: - 13th April 2007, 19:29
  5. Help getting started...
    By Julle Jansson in forum General
    Replies: 1
    Last Post: - 26th November 2005, 07:59

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