View previous topic :: View next topic |
Author |
Message |
newbe Guest
|
Simple question |
Posted: Thu Apr 10, 2008 2:58 am |
|
|
Hi All,
I need some assistence..
The lst file looks like this:
.................... if (Check_Levels == 1)
081E: DECFSZ xF5,W
0820: BRA 08C0
.................... {
The debuger shows Check_Levels=1, but the next step is to line 0820, so it dosent enter the function.
The ram location 1F5 is 1 (Location 0F5 is 0).
Maybe it checks the wrong location ???, or there is another problem ??
How can I correct this thing? |
|
![](templates/subSilver/images/spacer.gif) |
Matro Guest
|
|
Posted: Thu Apr 10, 2008 3:09 am |
|
|
Do you know if this is a compiler bug or a debugger bug?
Did you already try this code programmed in a chip?
Matro. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Thu Apr 10, 2008 3:39 am |
|
|
Hi,
I dont know if its a bug, maybe Im doing somthing wrong in the setup.
It looks like a banking problem, directed else wrer insted of 1F5.
The code is running wrong on a target chip using ICD.
Anyone ? |
|
![](templates/subSilver/images/spacer.gif) |
Matro Guest
|
|
Posted: Thu Apr 10, 2008 3:53 am |
|
|
Which CCS version are you using?
Matro |
|
![](templates/subSilver/images/spacer.gif) |
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Thu Apr 10, 2008 4:42 am |
|
|
Could you post more of the code/lst file please. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Thu Apr 10, 2008 5:01 am |
|
|
Hi,
The compiler is 4.013
Code segment:
.................... while (1)
.................... {
.................... if (Check_Levels == 1)
081E: DECFSZ xF5,W
0820: BRA 08C0
.................... {
.................... Check_Levels = 0;
0822: CLRF xF5
function code ..
.................... UList1 = 1;
08BA: MOVLW 01
08BC: MOVLB 1
08BE: MOVWF xF6
08C0: MOVLB 2
.................... }
.................... }
.................... }
.................... } /* end of forever loop */
08C2: MOVLB 1
08C4: BRA 081E
.................... }
.................... |
|
![](templates/subSilver/images/spacer.gif) |
Matro Guest
|
|
Posted: Thu Apr 10, 2008 6:15 am |
|
|
Did you look in CCS release notes if such a bug was known for this version of the compiler?
The interesting part of the lst file is more the one before the whil() than after.
Matro. |
|
![](templates/subSilver/images/spacer.gif) |
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Thu Apr 10, 2008 7:15 am |
|
|
This is correct:-
................... if (Check_Levels == 1)
081E: DECFSZ xF5,W
0820: BRA 08C0
.................... {
.................... Check_Levels = 0;
0822: CLRF xF5
If Check_Levels does = 1 then
DECFSZ subtracts 1 from Check_Levels and stores the resutl (0) in W and skips the BRA and continues into the if statement.
This should NOT alter the location for Check_Levels at all as it stores the result in the W reg.
If Check_Levels does != 1 then
DECFSZ subtracts 1 from Check_Levels and stores the resutl (!0) in W and executes the BRA.
OK, BUT it states that it substitutes a NOP instruction for the BRA when doing the skip so the debugger MAY look like it is executing the BRA when it is not. What happens when you continue debugging ?
Also when are you checking the value of Check_Levels ? before the DECFSZ! |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Sun Apr 13, 2008 6:08 am |
|
|
Hi,
Sorry for the late respond,
The program just assume that the value is 0 and dosent enter the if case.
Here is more lst:
.................... Use_List1 = 1;
07E4: MOVLW 01
07E6: MOVLB 1
07E8: MOVWF xF6
....................
.................... CCPR1 = M_PERIOD;
07EA: MOVLW 60
07EC: MOVWF FBF
07EE: MOVLW 9E
07F0: MOVWF FBE
....................
.................... /*CCP2 */
.................... setup_ccp1(CCP_COMPARE_RESET_TIMER);
07F2: MOVLW B7
07F4: ANDWF FB1,F
07F6: BSF F94.2
07F8: MOVLW 0B
07FA: MOVWF FBD
.................... setup_ccp2(CCP_COMPARE_INT);
07FC: MOVLW B7
07FE: ANDWF FB1,F
0800: BSF F94.1
0802: MOVLW 0A
0804: MOVWF FBA
....................
.................... enable_interrupts(INT_CCP1);
0806: BSF F9D.2
....................
.................... /* Setup timer1 */
.................... set_timer1(0);
0808: CLRF FCF
080A: CLRF FCE
.................... setup_timer_1(T1_INTERNAL | T1_DIV_BY_1);
080C: MOVLW 85
080E: MOVWF FCD
....................
.................... enable_interrupts(INT_RDA);
0810: BSF F9D.5
.................... enable_interrupts(GLOBAL);
0812: MOVLW C0
0814: IORWF FF2,F
....................
.................... output_high(LED0);
0816: BCF F94.0
0818: BSF F8B.0
.................... output_high(LED1);
081A: BCF F94.2
081C: BSF F8B.2
....................
.................... while (1)
.................... {
.................... if (Check_Levels == 1)
081E: DECFSZ xF5,W
0820: BRA 08C0
.................... {
.................... Check_Levels = 0;
0822: CLRF xF5
well ? Is there a way to solve this problem ? |
|
![](templates/subSilver/images/spacer.gif) |
|