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 CCS Technical Support

Simple question

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







Simple question
PostPosted: Thu Apr 10, 2008 2:58 am     Reply with quote

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?
Matro
Guest







PostPosted: Thu Apr 10, 2008 3:09 am     Reply with quote

Do you know if this is a compiler bug or a debugger bug?
Did you already try this code programmed in a chip?

Matro.
Guest








PostPosted: Thu Apr 10, 2008 3:39 am     Reply with quote

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 ?
Matro
Guest







PostPosted: Thu Apr 10, 2008 3:53 am     Reply with quote

Which CCS version are you using?

Matro
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Thu Apr 10, 2008 4:42 am     Reply with quote

Could you post more of the code/lst file please.
Guest








PostPosted: Thu Apr 10, 2008 5:01 am     Reply with quote

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
.................... }
....................
Matro
Guest







PostPosted: Thu Apr 10, 2008 6:15 am     Reply with quote

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.
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Thu Apr 10, 2008 7:15 am     Reply with quote

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!
Guest








PostPosted: Sun Apr 13, 2008 6:08 am     Reply with quote

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 ?
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