Hi,
It's not in meConfig because setting the oscillator frequency is not done via the CONFIG words, you need to write the appropriate value to the OSCCON register.
/Henrik.
Hi,
It's not in meConfig because setting the oscillator frequency is not done via the CONFIG words, you need to write the appropriate value to the OSCCON register.
/Henrik.
Yes I understand but why not?
They have done such nice utility, why not finish it properly?![]()
here's sample code, it flashes and verifies ok, but does not works (led does not blink)
Code:;----[16F887 Hardware Configuration]-------------------------------------------- #IF __PROCESSOR__ = "16F887" #DEFINE MCU_FOUND 1 #CONFIG cfg1 = _INTRC_OSC_NOCLKOUT ; INTOSCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN cfg1&= _WDT_ON ; WDT enabled cfg1&= _PWRTE_OFF ; PWRT disabled cfg1&= _MCLRE_OFF ; RE3/MCLR pin function is digital input, MCLR internally tied to VDD cfg1&= _CP_OFF ; Program memory code protection is disabled cfg1&= _CPD_OFF ; Data memory code protection is disabled cfg1&= _BOR_ON ; BOR enabled cfg1&= _IESO_ON ; Internal/External Switchover mode is enabled cfg1&= _FCMEN_ON ; Fail-Safe Clock Monitor is enabled cfg1&= _LVP_OFF ; RB3 pin has digital I/O, HV on MCLR must be used for programming cfg1&= _DEBUG_ON ; In_Circuit Debugger enabled, RB6/ICSPCLK and RB7/ICSPDAT are dedicated to the debugger __CONFIG _CONFIG1, cfg1 cfg2 = _BOR40V ; Brown-out Reset set to 4.0V cfg2&= _WRT_OFF ; Write protection off __CONFIG _CONFIG2, cfg2 #ENDCONFIG #ENDIF ;----[Verify Configs have been specified for Selected Processor]---------------- ; Note: Only include this routine once, after all #CONFIG blocks #IFNDEF MCU_FOUND #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]" #ENDIF define osc 4 OSCCON=%01100111 kikli: high portc.5 pause 500 low portc.5 pause 500 goto kikli
Hi,
Because (and this is of course my opinion, I can't speak for Darrel or meLabs), it's a utility designed for producing code (not actual code but rather directives to the compiler/assembler) that sets the CONFIG fuses correctly - and that's what it does. CONFIG is part of flash memory, it is being set when the device is programmed. OSCCON is SFR (RAM) and is set at runtime.
If OSCCON, why not ADCON, ANSEL, TRIS, CMCON, TMR, BAUDCTL, SSPCON, INTCON, EECON, PIR, PCON, CCPR, WRCON, WPUB, OPTION_REG, SR_CON.....?
/Henrik.
Hi,
What's your powersupply voltage? You have BOR enabled @4V so anything below that will hold the chip in reset.
Try leaving OSCCON.0 = 0.
Finally, and this doesn't matter in THIS particular case, all define statements are case sensitive and all PBP defines are defined UPPER CASE so it must be define OSC xx or it'll behave as it wasn't even there.
/Henrik.
You could try ANSEL=0 to set your ports digital which could prevent the LED from turning on.
Bookmarks