Internal osilator


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

    Default Internal osilator

    I am trying to set my PIC16F913 to use a internal ossilator in code without changing any other files. acording to another post i just add "@__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF" to the code but i get a error on compiling "Overwriting previous address contents" can any one shed some light on this

    Code:
    INCLUDE "MODEDEFS.BAS"
    
    Asm
    	__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
        ERRORLEVEL -306
    Endasm
    
    'DEFINE OSC 4				' Define crystal as 4Mhz
    
    '*ADC setup*
    DEFINE ADC_BITS 10 			'SETS NUMBER OF BITS IN RESULTS 8,10,12
    DEFINE ADC_CLOCK 3 			'SETS CLOCK SOURCE (RC = 3)
    DEFINE ADC_SAMPLEUS 50 		'SETS SAMPLING TIME IN MICROSECONDS
     
    'This Part set PORTA 0-5 an analog inputs
    ADCON1 = %01110000			'FRC (clock derived from a dedicated internal oscillator = 500 kHz max)
    ANSEL  = %00000011			'PortA 0 & 1 Analog 2 - 5 Digital
    							'The ANSEL (91h) and CMCON0 (9Ch)registers must be initialized to configure an
    CMCON0 = %00000111			'analog channel as a digital input. Pins configured as analog inputs will read ‘0’.
    TRISA  = %00001111			'set PORTA 0-4 as inputs PORTA 5 output
    ADCON0.7 = 1				'Right justify output of ADC datasheet P145 of 16F913 
        
    LCDCON = 0					'Disable LCD function on PORTC 0 - 2
    TRISC = %00000000			'Set PORTC  as output   
    TRISB = %00000000			'Sert PORTB as output

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


    Did you find this post helpful? Yes | No

    Default Re: Internal osilator

    If you set the configs in code space you need to comment the *.inc file in the PBP directory. Or you can modify the *.inc file.

    Here is a thread about it.
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Dave
    Always wear safety glasses while programming.

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