8051 >> HI-TECH C PRO for the Silicon Labs 8051 MCU Family

Pages: 1
pavan01
Tester
***

Reged: Apr 11 2008
Posts: 16
Loc: India
"intrpt.h"
      #58332 - Mon May 26 2008 09:45 AM

where is this file?
I m not able to find it in include file folder.
without this heder file can i use interrupts?


Post Extras: Print Post   Remind Me!   Notify Moderator  
mlacina
Tester


Reged: Apr 11 2008
Posts: 2
Loc: Poland
Re: "intrpt.h" [Re: pavan01]
      #58582 - Tue May 27 2008 04:11 AM

http://www.htsoft.com/forum/all/showflat.php/Cat/0/Number/52312/an/0/page/0#Post52312

Post Extras: Print Post   Remind Me!   Notify Moderator  
pavan01
Tester
***

Reged: Apr 11 2008
Posts: 16
Loc: India
Re: "intrpt.h" [Re: mlacina]
      #58592 - Tue May 27 2008 04:24 AM

Thanx
But how can i use interrupts?Can you help?

Some sample code showing usage of ISR would clarify the same. I had tried the Kiel way but it does not work.

Edited by pavan01 (Tue May 27 2008 06:42 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
mlacina
Tester


Reged: Apr 11 2008
Posts: 2
Loc: Poland
Re: "intrpt.h" [Re: pavan01]
      #58732 - Tue May 27 2008 05:58 PM

Hi,

I don't have any manual for PRO version, but after some test, the following interrupt is working on my demo board:

interrupt
void Timer2_ISR (void)
{
TF2H = 0; // Clear Timer2 inrrupt flag
if(LED1 == 1)
{LED1 = 0;}
else
{LED1 = 1;}
// Change state of LED
}

asm("org 02BH"); //set ROM vector of Timer2
asm("ljmp _Timer2_ISR"); //int service

Best Regards,
Mariusz Lacina


Post Extras: Print Post   Remind Me!   Notify Moderator  
clydeAdministrator
HI-TECH team member
*****

Reged: Oct 16 2003
Posts: 633
Re: "intrpt.h" [Re: mlacina]
      #58762 - Wed May 28 2008 01:16 AM

In fact you don't need to use assembler to set up the vector, it can be done like this:

Code:


#define LED1 P10 // port 1 bit 0

interrupt void
Timer2_ISR(void) @ 0x2B // using @ syntax to specify the vector address
{
TF2H = 0; // Clear Timer2 interrupt flag
LED1 = !LED1;
}



Clyde


Post Extras: Print Post   Remind Me!   Notify Moderator  
harrymc



Reged: Oct 04 2004
Posts: 4
Loc: Perth, Western Australia
Re: "intrpt.h" [Re: clyde]
      #59882 - Fri Jun 06 2008 02:36 AM

I was just making these changes myself and each of the processor include files, in my case 8051f0xx.h, has the vectors defined. The line in the previous post can be:

Code:

Timer2_ISR(void) @ TIMER2 // using @ syntax to specify the vector address



Harry


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
3 registered and 0 anonymous users are browsing this forum.

Moderator:  Andrew L, clyde, Brent W, jeff, dave g, meisty, josh stevo 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 1141

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5