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

disassembly listing is blank when I do this...

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
[email protected]



Joined: 05 Nov 2003
Posts: 23

View user's profile Send private message

disassembly listing is blank when I do this...
PostPosted: Wed Feb 22, 2006 11:48 am     Reply with quote

While correcting some FUBARs in my ISR code noted by our astute crowd here, I found something interesting. My disassembly window goes blank when I add a couple of assembler instructions. The following code works as expected:
Code:

#int_global
void isr(void)
{
   #asm
      //store current state of processor
      MOVWF save_w
      SWAPF status,W
      MOVWF save_status
      BCF   status,5                              //Set to page 0 for SFR's
      BCF   status,6
   #endasm


However, if I add the save_FSR code below, the disassembly listing goes away, which leaves me feeling uncomfortable:
Code:

#int_global
void isr(void)
{
   #asm
      //store current state of processor
      MOVWF save_w
      SWAPF status,W
      MOVWF save_status
      SWAPF FSR,W
      MOVWF save_FSR
      BCF   status,5                              //Set to page 0 for SFR's
      BCF   status,6
   #endasm


Does any CCS guru out there know what rule I just violated by doing this?

many thanks,
DLC
_________________
--
------------------------------------
Dennis Clark [email protected]
http://www.techtoystoday.com
------------------------------------
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 22, 2006 1:17 pm     Reply with quote

I can't compile your code as posted. It gets errors.
Can you add the missing items, so it can be compiled ?
Guest








PostPosted: Wed Feb 22, 2006 7:01 pm     Reply with quote

PCM programmer wrote:
I can't compile your code as posted. It gets errors.
Can you add the missing items, so it can be compiled ?


Sure, you will recognize it I'll bet...

thanks,
DLC

Code:

#include <16F628.h>
#fuses INTRC_IO,NOWDT,NOPROTECT,NOLVP,NOCPD,NOBROWNOUT,MCLR
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1)
#use fast_io(A)
#use fast_io(B)

#define MAXBIT 13         //5 address, 7 control and one junk timing
int rise[MAXBIT];
int rW=0;
int gotOne = 0;

//save_w and save_status are at 7f and 7e which are available in ALL banks
int save_w;
#locate save_w=0x7f
int save_status;
#locate save_status=0x7e
int save_FSR;
#locate save_FSR=0x7d

#byte FSR = 4
#byte status = 3
#byte TMR1L = 0x0E
#byte TMR1H = 0x0F
#byte PIR1 = 0x0C
#byte CCPR1H = 0x16

#int_global
void isr(void)
{
   #asm
      //store current state of processor
      MOVWF save_w
      SWAPF status,W
      MOVWF save_status
      SWAPF FSR,W
      MOVWF save_FSR
      BCF   status,5                              //Set to page 0 for SFR's
      BCF   status,6
   #endasm
   
      rise[rW++] = CCPR1H;                        //save the pulse time
      if (rW == MAXBIT)
      {
         rW = 0;
   }
   gotOne = 1;
      TMR1L = 0;
      TMR1H = 0;
   
      #asm
      // restore processor and return from interrupt
      SWAPF save_FSR,W
      MOVWF FSR
      SWAPF save_status,W
      MOVWF status
      SWAPF save_w,F
      SWAPF save_w,W
      BCF PIR1,2
      #endasm 
}                               

void main()
{
   int x;
   int n=0;
   
   set_tris_B(0x03);
   set_tris_A(0x00);

   //Turn off comparator
   setup_comparator(NC_NC_NC_NC);

      setup_ccp1(CCP_CAPTURE_FE);    // Configure CCP1 to capture falling edge detection
      setup_timer_1(T1_INTERNAL);    // Start timer 1

   for (x=0;x<MAXBIT;x++)
      rise[x]=0;
      
      enable_interrupts(INT_CCP1);   // Setup interrupt on falling edge
      enable_interrupts(GLOBAL);

   printf("SONY IR decoder\n\r");
   
      while(TRUE)
   {
         delay_ms(500);
         if (n)
         {
            output_low(PIN_A1);
            n=0;
       }
       else
       {
          output_high(PIN_A1);
          n=1;
      }
         if (gotOne)
         {
         gotOne = 0;
            for (x=0;x<MAXBIT;x++)
               printf("\n\r%u %u counts ",x, rise[x]);
      }
      }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 22, 2006 7:16 pm     Reply with quote

Quote:
My disassembly window goes blank when I add a couple of assembler instructions.

I'm not sure what you mean by 'blank'. Do you mean that you see
nothing at all, or that just the #int_global routine is missing ?

I compiled your program with PCM vs. 3.242 and MPLAB vs. 7.20.
Here is the code viewed from "View / Disassembly Listing" in MPLAB:
Code:
28:                #int_global
29:                void isr(void)
30:                {
31:                   #asm
32:    //store current state of processor
33:                      MOVWF save_w
  0004    00FF     MOVWF 0x7f
34:                      SWAPF status,W
  0005    0E03     SWAPF 0x3, W
35:                      MOVWF save_status
  0006    00FE     MOVWF 0x7e
36:                      SWAPF FSR,W
  0007    0E04     SWAPF 0x4, W
37:                      MOVWF save_FSR
  0008    00FD     MOVWF 0x7d
38:                      BCF   status,5       //Set to page 0 for SFR's
  0009    1283     BCF 0x3, 0x5
39:                      BCF   status,6
  000A    1303     BCF 0x3, 0x6
40:                   #endasm



The .LST file also looks OK:
Code:

0000            00372 .................... #int_global 
0000            00373 .................... void isr(void) 
0000            00374 .................... { 
0000            00375 ....................    #asm 
0000            00376 .....  //store current state of processor 
0000            00377 ....................       MOVWF save_w 
0004 00FF       00378 MOVWF  7F
0000            00379 ....................       SWAPF status,W 
0005 0E03       00380 SWAPF  03,W
0000            00381 ....................       MOVWF save_status 
0006 00FE       00382 MOVWF  7E
0000            00383 ....................       SWAPF FSR,W 
0007 0E04       00384 SWAPF  04,W
0000            00385 ....................       MOVWF save_FSR 
0008 00FD       00386 MOVWF  7D
0000            00387 ....................       BCF   status,5  //Set to page 0 for SFR's 
0009 1283       00388 BCF    03.5
0000            00389 ....................       BCF   status,6 
000A 1303       00390 BCF    03.6
0000            00391 ....................    #endasm 
Guest








PostPosted: Thu Feb 23, 2006 10:25 am     Reply with quote

PCM programmer wrote:
Quote:
My disassembly window goes blank when I add a couple of assembler instructions.

I'm not sure what you mean by 'blank'. Do you mean that you see
nothing at all, or that just the #int_global routine is missing ?

I compiled your program with PCM vs. 3.242 and MPLAB vs. 7.20.
Here is the code viewed from "View / Disassembly Listing" in MPLAB:


I'm using 3.242 and MPLAB 7.01. When I pull up the view->disassembly listing I have a blank window. If I leave those offending lines out I have the usual disassembly listing. I note that the .lst file is there also.

DLC
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 23, 2006 10:55 am     Reply with quote

I recommend that you upgrade to the latest version of MPLAB.
Guest








PostPosted: Thu Feb 23, 2006 1:16 pm     Reply with quote

PCM programmer wrote:
I recommend that you upgrade to the latest version of MPLAB.


I just upgraded to MPLAB 7.20 (I already have PCM 3.242) and I get the same results as before.

There must be something else that is causing this problem.

DLC
dlc
Guest







PostPosted: Mon Feb 27, 2006 1:18 pm     Reply with quote

Anonymous wrote:
PCM programmer wrote:
I recommend that you upgrade to the latest version of MPLAB.


I just upgraded to MPLAB 7.20 (I already have PCM 3.242) and I get the same results as before.

There must be something else that is causing this problem.

DLC


When I added other code in the ISR my dissassembly view magically re-appeared. It appears that there is some kind of bug in MPLAB. ;) Regardless, the code compiles and runs properly regardless of the MPLAB oddity.

thanks all,
DLC
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