Searching \ for '[PIC]: OSCCAL, 12CE674 and HiTech C' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/microchip/languages.htm?key=c
Search entire site for: 'OSCCAL, 12CE674 and HiTech C'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: OSCCAL, 12CE674 and HiTech C'
2001\06\14@173830 by Howard23 Hughes

picon face
Hi all,

I've checked the PIC Faq on this subject and found some messages, but none
of them were of much help.

I try to get the preprogrammed calibration code in OSCCAL. To do this I
first put "OSCCAL=_READ_OSCCAL_DATA();", and then tried without it. In both
cases, the code generated by the compiler (PICC)is the same:

The startup code is:

0000  0183  poweru  clrf   0x3
0001  3000          movlw  0x0
0002  008A          movwf  0xA
0003  2804          goto   intlevel0

and the last program memory word gets like this:

07FF  2804          goto   intlevel0

This, of course, will not work at all. How must I do?

Thanks,

Howard.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\06\15@005037 by Olin Lathrop

face picon face
> I try to get the preprogrammed calibration code in OSCCAL. To do this I
> first put "OSCCAL=_READ_OSCCAL_DATA();", and then tried without it. In
both
> cases, the code generated by the compiler (PICC)is the same:
>
> The startup code is:
>
> 0000  0183  poweru  clrf   0x3
> 0001  3000          movlw  0x0
> 0002  008A          movwf  0xA
> 0003  2804          goto   intlevel0
>
> and the last program memory word gets like this:
>
> 07FF  2804          goto   intlevel0
>
> This, of course, will not work at all. How must I do?

Fresh from the factory, the last word in program memory is set to a MOVLW
with the recommended OSCCAL value.  At reset, execution start there, then
wraps to 0 on the next instruction.  To use the calibration value you must
somehow save or use the value in W before stomping on it.  You must also not
program over the last word in memory or bulk erase the device if it is
erasable.  The code above does a MOVLW 0, which looses the value.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, .....olinKILLspamspam@spam@embedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu


2001\06\15@030558 by Dwayne Reid

flavicon
face
At 06:28 PM 6/14/01 -0400, Olin Lathrop wrote:

>Fresh from the factory, the last word in program memory is set to a MOVLW
>with the recommended OSCCAL value.  At reset, execution start there, then
>wraps to 0 on the next instruction.

Actually, the above is accurate for the 12 bit core devices.  The 12CE674
is a 14 bit core, so the last word of memory is encoded as a RETLW 0xNN
instead of MOVLW 0xNN.  This is because the 14 bit core parts begin
execution at address 00, not at top of memory.  You can retrieve the
calibration constant at any time during program execution by CALLing the
last program memory location.

Do note: the emulator does not like you calling the calibration location
because it is unprogrammed.  I have a compile time flag that replaces that
call with a movlw 0xNN instead.

dwayne




Dwayne Reid   <.....dwaynerKILLspamspam.....planet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 17 years of Engineering Innovation (1984 - 2001)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


2001\06\15@051333 by Alvaro Deibe Diaz

flavicon
face
I have the same problem with a 12 PIC. The "goto   intlevel0" instruction in
the last program memory location, produced by the compiler, goes onto the
existing "retlw 0xxx" in the OTP parts. The retlw binary opcode is
"1101xxkkkkkk", and the goto "101kkkkkkkkkkk". So, once programmed the part
with the code produced by the compiler, the resulting opcode will be
"100xxxxxxxxxxx". This is a "call" instruction...

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...