PDA

View Full Version : Problem DEFINE OSCCAL and PBP 2.46



David
- 22nd April 2005, 12:53
Hi,

Initially, sorry for my poor English, I am French and I do not practise.

I have a problem which is as follows.

I use PBP 2.46 with Microcode studio. (with and without, i have the same problem)

when I wants to define the OSCCAL with DEFINE OSCCAL_1K 1, the compiler does not add the good ASM code in the source.
So, my pic12f675 does not turn has a correct frequency and i have problem for my program with serout2.

Is what somebody has an idea?

P.S: my program is:

DEFINE OSCCAL_1K 1 'just for test

and in the ASM code i found this

#define OSCCAL_1K 1

and not

CALL 03ffh
MOVE?AB OSCCAL

When i add this in my basic source, The compiler says to me that it did not know OSCCAL and 03ffh. I have also reinstall the software, but ihave the same trouble.

Help me please...

Bruce
- 22nd April 2005, 15:17
Assembler defines are always preceeded by the # symbol.

DEFINE OSCCAL_1K 1 is the BASIC version. PBP will change it to
#DEFINE OSCCAL_1K 1.

Create a new file, and compile it with only this;

@ DEVICE PIC12F675, INTRC_OSC, WDT_OFF, MCLR_OFF
DEFINE OSCCAL_1K 1 ' Calibrate internal oscillator

Open the .lst file. You'll see something like this;

#define OSCCAL_1K

goto INIT

INIT
call 03ffh
MOVE?AB OSCCAL
bsf STATUS, RP0
movwf OSCCAL
bcf STATUS, RP0

Which is exactly what it should be.

As for your timing problems with serout2, you can not rely on the "internal osc" for timing sensitive applications. If you need an accurate clock for serial communications, use an external crystal or resonator.

Dwayne
- 22nd April 2005, 15:37
hello David,

The 12F675 is not supported with the SERIN2 command.

http://www.microengineeringlabs.com/resources/pbpmanual/

Dwayne

Bruce
- 22nd April 2005, 16:10
Why would you think serin2 or serout2 is not supported on a 14-bit part..?

Dwayne
- 22nd April 2005, 17:13
Hello Bruce,

Bruce>>Why would you think serin2 or serout2 is not supported on a 14-bit part..?<<

Because the manual said it was not supported the 12bit series chips and below. The 675 is a 14 bit machine??? I thought it was a 12 bit....

All this time I thought it was a 12 bit...
Dwayne

Bruce
- 22nd April 2005, 17:19
Yep the 12F675 is a 14-bit core.