Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Error when building program in hitech - c

Status
Not open for further replies.

slaamdunk@gmail.com

Junior Member level 1
Junior Member level 1
Joined
Aug 27, 2013
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
130
what does the following error mean. I am using pic - 12f615

Error [192] C:\Program Files (x86)\Microchip\tx_37pricing.c; 31.1 undefined identifier "IOSCFS"
 

just OR with Its value as 0x80..

HI,
I am still getting the error. This is my code


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include    <htc.h>
 
#ifndef _XTAL_FREQ
#define _XTAL_FREQ 8000000
#endif
 
__CONFIG(FOSC_INTOSC & WDTE_OFF & PWRTE_OFF & MCLRE_OFF & CP_OFF & BOREN_OFF & CLKOUTEN_OFF & IESO_OFF & FCMEN_OFF);
__CONFIG(WRT_OFF & STVREN_OFF & BORV_LO & LVP_OFF);
 
 
 
int wave(unsigned int x)
{
int y;
y=x;
while(x>0){
GPIObits.GP1=1;
__delay_ms(100);
GPIObits.GP1=0;
__delay_ms(100);
x--;
 
}
}
 
void main (){
 
IOSCFS=0x80;            // set clock to 16MHz
//CCP1CON = 0x00;        // disable CCP1
GPIObits.GP1 = 0x00;
GPIObits.GP1 = 0;
 
while(1){
wave(96);
__delay_ms(10000);
}
}

 
Last edited by a moderator:

You don't set configuration words like that (and it can only do 4MHz or 8MHz). It is set by the __CONFIG as you already have. I am not sure of the syntax - for the XC8 it would be #pragma config IOSCFS = 8MHZ. You should be able to find it from your compiler help.

Keith
 

I am sorry the comment is a typo, I am trying to set the internal oscillator at 8 MHz. So should I set my internal oscillator frequency in the __CONFIG statement ?
 

Correct. Unfortunately I don't know the syntax of the __CONFIG, just the #pragma form.

Keith
 

How do I configure the CONFIG register in 12F615 ?
Can I use __Config or do I have to define all the pins of CONFIG ?
 
Last edited:

you can't change clock frequency in runtime by putting IOSCFS=0x80; It will also one of the bits of config reg..
 

change the configuration settings to :-

__CONFIG(IOSCFS_8MHZ & FOSC_INTOSCIO & BOREN_OFF & CP_OFF & MCLRE_OFF & WDTE_OFF & PWRTE_OFF);

and disable this line :-
// IOSCFS=0x80;
 

change the configuration settings to :-

__CONFIG(IOSCFS_8MHZ & FOSC_INTOSCIO & BOREN_OFF & CP_OFF & MCLRE_OFF & WDTE_OFF & PWRTE_OFF);

and disable this line :-
// IOSCFS=0x80;


Hi,
Thanks for the reply. I tried the following code to see clock output waveform in a CRO, but I am not able to.
How do I enable CLKOUT high ? Is it by default set high also I am getting a MCLRE and INT OSC contention error.
Can you please guide me here, have been tryin to get this for a while
Thank you



Code:
#include    <htc.h>
//#include <PIC12F615.h>
#ifndef _XTAL_FREQ
#define _XTAL_FREQ 8000000
#endif


__CONFIG(IOSCFS_8MHZ & MCLRE_OFF & WDTE_OFF & PWRTE_OFF & CP_OFF & BOREN_OFF & FOSC_INTOSCIO);



void main (){
ANSEL=0x00;
PORTA=0;
//GPIO=0;
TRISIO4 = 0;
//CCP1CON = 0x00;        // disable CCP1
//GP2 = 0;
//GPIObits.GP1 = 0;
//while(1){
//GP2=1;
//__delay_ms(10);
//GP2=0;
//__delay_ms(10);
while(1);

}
 

Hi slaamdunk,

That is why because you have had entrusted the CLOCK OUT pin to act as digital IO through configuration setting FOSC_INTOSCIO

Alter the FOSC_INTOSCIO setting to FOSC_INTOSCCLK..

you will get FOSC/4 = 2 MHz on the clock out pin

check the output and get me back :)

good wishes..
 
Last edited:

Hi slaamdunk,

That is why because you have had entrusted the CLOCK OUT pin to act as digital IO through configuration setting FOSC_INTOSCIO

Alter the FOSC_INTOSCIO setting to FOSC_INTOSCCLK..

you will get FOSC/4 = 2 MHz on the clock out pin

check the output and get me back :)

good wishes..

FOSC_INTOSCCLK - did work and I was able to see the 2MHz clock output.
Thank you
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top