View previous topic :: View next topic |
Author |
Message |
deepakomanna
Joined: 06 Mar 2007 Posts: 92 Location: Pune,India
|
Calibration message.... |
Posted: Mon Apr 23, 2007 12:30 am |
|
|
Dear sir,
here i am using 12f629, MPLAB 7.5 Ver. & CCS PCM C Compiler, Version 3.249, 34534.
My query is, while i am programming one message box is appering
"Calibration Memory is Already Programmed"
but in my coding i declared,
[/code]
#use delay(clock = 4000000)
#byte OSCCAL = 0x90
void main()
{
...
...
#asm
CALL 0X03FF
MOVWF OSCCAL
#endasm
...
....
}
So plz tell me why it is showing this msg & this will affect in prog. _________________ Thank You,
With Best Regards,
Deepak. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 23, 2007 12:45 am |
|
|
You probably have a #Rom statement in your program (not shown in your
post) that sets the OSCCAL value (at address 0x3FF) to some value.
MPLAB is informing you that it's not going to let you change the OSCCAL
value. |
|
|
deepakomanna
Joined: 06 Mar 2007 Posts: 92 Location: Pune,India
|
calibration msg.... |
Posted: Mon Apr 23, 2007 1:53 am |
|
|
Thanks for replying,
But in my code i didn't not used #ROM like statement,
plz refer following code..
Code: |
#include<12f629.h>
#fuses INTRC_IO,NOWDT,PUT,NOMCLR,PROTECT,NOCPD,BROWNOUT
#use delay(clock = 4000000)
#byte OSCCAL = 0x90
void init_CPU();
void DLY_CNT_FUNCTION();
void ON();
unsigned int16 RPM_COUNT;
int1 flag;
void main()
{
flag = 0;
RPM_COUNT = 0;
init_CPU();
while(1)
{
while(INPUT(PIN_A1)); // Wait for Zero Pulse
SETUP_TIMER_1(T1_DISABLED); // TIMER_1 count OFF
RPM_COUNT = GET_TIMER1();
SET_TIMER1(0x00);
SETUP_TIMER_1(T1_INTERNAL | T1_DIV_BY_8); //TIMER 1 ON.
if(flag == 1)
{
ON();
}
while(INPUT(PIN_A0));
if(flag == 0)
{
ON();
}
DLY_CNT_FUNCTION();
}
}
void DLY_CNT_FUNCTION()
{
flag = 1;
if((RPM_COUNT >= 4167)||(RPM_COUNT == 0) ) /*rpm < 1800*/
{
flag = 0;
}
}
void ON()
{
/*=========== Turn ON FOR 60 usec ================= */
OUTPUT_HIGH(PIN_A2);
DELAY_US(60);
OUTPUT_LOW(PIN_A2);
/*=======================================================*/
}
void init_CPU()
{
PORT_A_PULLUPS(0x13); // Enable pullups GPIO0,GPIO1,GPIO4 I/P &ALL O/P
SET_TRIS_A(0x13); //GPIO0,GPIO1 I/P & ALL O/P.
SETUP_COMPARATOR(NC_NC_NC_NC); // Make comparator off
#asm
CALL 0X03FF
MOVWF OSCCAL
#endasm
}
|
_________________ Thank You,
With Best Regards,
Deepak. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 23, 2007 2:11 am |
|
|
You don't need the #asm code to set the OSCCAL register. CCS does
it for you. Here is the code created by vs. 3.249 for your program:
Code: |
0000 3000 00001 MOVLW 00
0001 008A 00002 MOVWF 0A
0002 2804 00003 GOTO 004
0003 0000 00004 NOP
0004 23FF 00005 CALL 3FF // Get OSCCAL value in W
0005 1683 00006 BSF 03.5 // Bank 1
0006 0090 00007 MOVWF 10 // Register 0x90 = W
0007 3000 00008 MOVLW 00
0008 008A 00009 MOVWF 0A
0009 2843 00010 GOTO 043
|
This is put in by the compiler. It's not your #asm code. |
|
|
deepakomanna
Joined: 06 Mar 2007 Posts: 92 Location: Pune,India
|
calibration msg... |
Posted: Wed Apr 25, 2007 5:29 am |
|
|
Dear Sir,
Still it has problem.
I commented these lines which are used for OCCILLATOR CALIBRATION. in my code.
but still it is showing the message.
//#use delay(clock = 4000000)
//#byte OSCCAL = 0x90
// #asm
// CALL 0X03FF
// MOVWF OSCCAL
// #endasm
_________________
Thank You,
With Best Regards,
Deepak. _________________ Thank You,
With Best Regards,
Deepak. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|