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

16F913 SSP_INTERRUPT

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



Joined: 17 Aug 2007
Posts: 38

View user's profile Send private message Send e-mail

16F913 SSP_INTERRUPT
PostPosted: Sat Feb 09, 2008 8:32 am     Reply with quote

Hi All!

I've a problem with PCM CCS Compiler v. 4.057:

Instruction ENABLE_INTERRUPTS(INT_SSP) doesn't set PIE1<SSPIE>. Neither inserting #asm ASIS clause:

Program
Code:

void ENABLE_SSP_INT()
{
   
      #asm ASIS
      bcf   0x03,0x05
      bsf   0x03,0x06            //seleziona pagina1
      bsf PIE1,3
      #endasm
}


Disassembly listing:
Code:

1493:              void ENABLE_SSP_INT()
1494:              {
1495:                 
1496:                    #asm ASIS
1497:                    bcf   0x03,0x05
   193    1283     BCF 0x3, 0x5
1498:                    bsf   0x03,0x06            //seleziona pagina1
   194    1703     BSF 0x3, 0x6
1499:                    bsf PIE1,3
   195    158C     BSF 0xC, 0x3
1500:                    #endasm
1501:              }


So CCS Compiler insert 0xC instead of 0x8C (address of PIE1).

Executing simulation or Debug with MPLAB IDE (V. 8.00), PIE1<SSPIE> is clear.

Did someone experienced with this problem. Is there a solution?

Thank you in advance for replies.

Marco
Ttelmah
Guest







PostPosted: Sat Feb 09, 2008 10:14 am     Reply with quote

0C, is _correct_.....
Read up on how the PIC instructions work.
On the 16 chips, you cannot directly address location '8C', for the standard instructions (these have a _7bit_ address range). Instead, you have to set the bit in the bank select register, to say that you want '80' added to the address to be used, and then access 0C.
If you just got rid of the 'asis' instruction, and did:
Code:

      #asm
      bsf PIE1,3
      #endasm

This will correctly be translated by the compiler, to:
Code:

       bsf PIE1,3
       BSF 0xC, 0x3

The compile will already be correctly accessing the right bit in the PIE. It _knows_ that you can only use a 7bit address, and does the required bank switching.
You cannot use an address above 7F, in these instructions. Hence '8C', will never appear as the target in the instruction.
Your problem is with something else.

Best Wishes
Mvedovetto



Joined: 17 Aug 2007
Posts: 38

View user's profile Send private message Send e-mail

PostPosted: Sat Feb 09, 2008 11:13 am     Reply with quote

Ttelmah wrote:
0C, is _correct_.....

Your problem is with something else.

Best Wishes


Thank you for reply Ttelmah: I understand about register access. So the problem could be MPLAB that does not generate a proper machine code to manage correctly PIE1 register: in fact the problem is that no SSP interrupt is generated because of PIE1 <SSPIE> is clear. If I set PIE1 <SSPIE> directly by register (MPLAB Watch Window) the program runs correctly.
I think I'll ask Microchip...

Have a good we

Marco
Mvedovetto



Joined: 17 Aug 2007
Posts: 38

View user's profile Send private message Send e-mail

PostPosted: Sun Feb 10, 2008 5:19 am     Reply with quote

I found out the problem: I selected bank #2 instead of bank #1 in #asm ASIS code. The correct code is:
Code:

   #asm ASIS
      bsf   0x03,0x05
      bcf   0x03,0x06            //select bank1
      bsf PIE1,3
      #endasm

But with this version of compiler (PCM V. 4.057) the instruction ENABLE_INTERRUPTS(SSP_INT) seems not to work with PIC16F913. Hope this bug will be fixed in further releases.

Bye

Marco
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