CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem with PIC16F630 and debug

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

Problem with PIC16F630 and debug
PostPosted: Fri Dec 30, 2005 3:36 am     Reply with quote

Hi Everybody,

I have a problem in debug of PIC16F630 and MPLAB.

This is the first part of listing:
Quote:

000 3000 MOVLW 0
001 008A MOVWF 0xa
002 2804 GOTO 0x4
003 0000 NOP
004 23FF CALL 0x3ff
005 1683 BSF 0x3, 0x5
006 0090 MOVWF 0x10
007 3000 MOVLW 0
008 008A MOVWF 0xa
009 280A GOTO 0xa


In Line 4 there is a call to 0x3ff and:
1) In simulation or normal program in 0x3ff there is an RETLW 0x00
2) In debug mode of MPLAB there is ADDLW 0xFF so the program restart and doesn't go on.

I wrote a little program in assembler and all work fine also in debug mode.

Is this a problem of compiler ?

My compiler version is PCWH 3,235.

Regards,
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Fri Dec 30, 2005 4:16 am     Reply with quote

I study about and I have a correction about,

In programming mode by ICD2 at 0x3ff there is a ADDLW 0xff only in simulation there is RETLW 0x00.

What is the meaning of line 4 call 0x3ff ?

Regards,
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Sun Jan 08, 2006 2:50 am     Reply with quote

Does anybody help me about?

I can't realize if the problem is in compiler, with call to 0x3FF, or MPLAB.

Have you got any ideas ?

Thanks for support
Ttelmah
Guest







PostPosted: Sun Jan 08, 2006 3:38 am     Reply with quote

The chips come from the factory, with a RETLW instrruction at address 0x3FF. This returns the calibration constant, that has to be put into 'OSCCAL', to calibrate the internal oscillator. The compiler, if you use the internal oscillator, will automatically insert the code to call this address, and then put the returned vaue into the calibration register.
The programmer should have an option to automatically preserve the contents of this location. Hence when you program the chip 'ADDLW 0x0', does not get put at this location, what happens is that the programmer reads the value at this location, and then writes the whole code, with this value included. In some programmers, there is a 'tick box' option to save the calibration constant.
For simulation, simply put a dummy RETLW at this point. In use, provided your programmer is set to save the calibration value, this will not cause a problem.

Best Wishes
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Tue Jan 10, 2006 1:39 am     Reply with quote

Hi,

I understand about but I can't realize how put in 0x3ff an RETLW 0.

Do you suggest me the way in C ?

Rergards,
Ttelmah
Guest







PostPosted: Tue Jan 10, 2006 5:12 am     Reply with quote

#ROM 0x3FF = { 0x3400 }

Beware though, to remove this before compiling to upload into the real chip, or you may overwrite the real calibration value.

Best Wishes
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Tue Jan 10, 2006 11:59 am     Reply with quote

Thanks for help, now the debug work right.

Bye..
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group