View previous topic :: View next topic |
Author |
Message |
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
PIC18F6720 if ( value ) .... debugger or chip ? |
Posted: Fri Aug 06, 2004 8:58 pm |
|
|
When this kind of crap happens I don't know if it's the chip, or the debugger...
Source....
if ( ExitVal )
{
From .LST file
.................... if ( ExitVal )
937C: MOVLB 5
937E: MOVF xFF,F
9380: BZ 938A
.................... {
Looks like the debugger thinks ExitVal is not zero !
http://hans-w.com/if_problem.gif
PIC18F6720 Rev. A4 silicon...
If it's not the debugger, then chip is useless.
I've been battling stuff like this for the past few weeks. I know the debugger has problems displaying data at the mouse cursor.
The expect value is ZERO the debugger shows 0X00 yet it thinks the value is NOT zero...
My question: Will the CCS debugger follow the chip ? or is the debugger lying to me ?
Last night the CCP5 would not output... This morning it did. I just put it down to lack of sleep... !
Now I'm beginning to think it's time to call Microchip and talk about this. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sat Aug 07, 2004 7:05 am |
|
|
Rev A3 of that chip was crap! I had all sorts of problems. I haven't noticed any problems with the newer chips. I do remember instructions being skipped. If I were to look back at some old code, I find places where I added NOP's just before the instructions that were skipped. From the errata, it states that certain code sequences cause problems. It was very frustrating indeed. One minute it would work, I could change the order of 2 instructions and cause it to fail. I was about to the point to ship my product to them to demonstrate the problem. Then out comes the errata. I don't really remember the date codes but if the chip begins with 03 I would get Microchip to swap it out. |
|
|
Guest
|
|
Posted: Sat Aug 07, 2004 9:57 am |
|
|
Mark wrote: | Rev A3 of that chip was crap! I had all sorts of problems. I haven't noticed any problems with the newer chips. I do remember instructions being skipped. If I were to look back at some old code, I find places where I added NOP's just before the instructions that were skipped. From the errata, it states that certain code sequences cause problems. It was very frustrating indeed. One minute it would work, I could change the order of 2 instructions and cause it to fail. I was about to the point to ship my product to them to demonstrate the problem. Then out comes the errata. I don't really remember the date codes but if the chip begins with 03 I would get Microchip to swap it out. |
Thanks for the feedback.
I checked the chip codes with Microchip before buying them. They are Rev. A4
I read about the instructions problem and adding nops, however the Errata sheet says it's only when doing table reads, and my code avoids that. BTW the table read problem is still there in Rev. A4 !
I'll call Microchip on Monday, see if anything new has happend and if another Errata sheet is pending.. |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
|
Posted: Sat Aug 07, 2004 10:27 am |
|
|
Mark wrote: | Rev A3 of that chip was crap! I had all sorts of problems. I haven't noticed any problems with the newer chips. I do remember instructions being skipped. If I were to look back at some old code, I find places where I added NOP's just before the instructions that were skipped. From the errata, it states that certain code sequences cause problems. It was very frustrating indeed. One minute it would work, I could change the order of 2 instructions and cause it to fail. I was about to the point to ship my product to them to demonstrate the problem. Then out comes the errata. I don't really remember the date codes but if the chip begins with 03 I would get Microchip to swap it out. |
I added a nop before the if statement, the value is in fact 1 but the debugger is showing it as 0X00 !
At least the chip is OK.....
On Monday morning I'll call CCS... |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sat Aug 07, 2004 12:21 pm |
|
|
I use the ICD2 and have experienced those sorts of problems also. I sometimes add the var to a watch window just to make sure. It always seems to be correct in the watch window. |
|
|
drolleman Guest
|
|
Posted: Sun Aug 08, 2004 10:53 am |
|
|
I have run into this problem and this is what i had to do
if(!value) sometimes does not work so i do this if(!(value)) even this seems the same this fixes the problem. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sun Aug 08, 2004 7:19 pm |
|
|
Those 2 statements would have the same effect. The only fault would be a compiler issue. Here is the asm. Note they are the same:
Code: |
.................... int value1;
.................... int1 value2;
....................
.................... if (!value1)
*
010F: MOVF 40,F
0110: BTFSS 03.2
0111: GOTO 112
.................... {
.................... }
.................... if (!(value1))
0112: MOVF 40,F
0113: BTFSS 03.2
0114: GOTO 115
.................... {
.................... }
.................... if (!value2)
0115: BTFSC 41.0
0116: GOTO 117
.................... {
.................... }
.................... if (!(value2))
0117: BTFSC 41.0
0118: GOTO 119
.................... {
.................... } |
|
|
|
|