View previous topic :: View next topic |
Author |
Message |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
Problem with PIC16F630 and debug |
Posted: Fri Dec 30, 2005 3:36 am |
|
|
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
|
|
Posted: Fri Dec 30, 2005 4:16 am |
|
|
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
|
|
Posted: Sun Jan 08, 2006 2:50 am |
|
|
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
|
|
Posted: Sun Jan 08, 2006 3:38 am |
|
|
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
|
|
Posted: Tue Jan 10, 2006 1:39 am |
|
|
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
|
|
Posted: Tue Jan 10, 2006 5:12 am |
|
|
#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
|
|
Posted: Tue Jan 10, 2006 11:59 am |
|
|
Thanks for help, now the debug work right.
Bye.. |
|
|
|