Wanna Be
Newbie level 1
- Joined
- May 17, 2013
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,295
hi guys,
This is my first time here in edaboard, I hope this post finds you all well ..
I have worked on HCS12XEP100 kit with a very simple project, just capturing an interrupt on port p pin 0 and toggling the state of port A. But, it never worked for me and I really don't know why !!
Need help, If you please
Thanks
CODE:
*****
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt VectorNumber_Vportp void PortP_Ext_INT_ISR(void){
static unsigned char flag = 0;
PIFP_PIFP0=1; //Clear Interrupt Flag
if(flag == 0){
PORTA = 1;
flag = 1;
}
else{
PORTA = 0;
flag = 0;
}
}
#pragma CODE_SEG DEFAULT
void main(void) {
/* put your own code here */
//Ports Initialization =============
PORTA=0x00; //Initialization
DDRA=0xFF; //Output
PTP=0x00; //Initialization
DDRP=0x00; //Input (Interrupt)
//==================================
//Interrupts Initialization ========
SPI0CR1_SPE=0; // Disable SPI Channel One,
SPI1CR1_SPE=0; // Disable SPI Channel Two,
PWME=0X00; // Disable PWM Peripheral,
PERP_PERP0=0; // Pull Deivce is Deactivated.
PPSP_PPSP0=1; // Interrupt Polarity (Rising Edge).
PIEP_PIEP0=1; // Enable Interrupt
PIFP_PIFP0=1; // Clear Interrupt Flag.
//==================================
EnableInterrupts; //Global Interrupt Enable
for(; {
_FEED_COP(); /* feeds the dog */
} /* loop forever */
/* please make sure that you never leave main */
}
This is my first time here in edaboard, I hope this post finds you all well ..
I have worked on HCS12XEP100 kit with a very simple project, just capturing an interrupt on port p pin 0 and toggling the state of port A. But, it never worked for me and I really don't know why !!
Need help, If you please
Thanks
CODE:
*****
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt VectorNumber_Vportp void PortP_Ext_INT_ISR(void){
static unsigned char flag = 0;
PIFP_PIFP0=1; //Clear Interrupt Flag
if(flag == 0){
PORTA = 1;
flag = 1;
}
else{
PORTA = 0;
flag = 0;
}
}
#pragma CODE_SEG DEFAULT
void main(void) {
/* put your own code here */
//Ports Initialization =============
PORTA=0x00; //Initialization
DDRA=0xFF; //Output
PTP=0x00; //Initialization
DDRP=0x00; //Input (Interrupt)
//==================================
//Interrupts Initialization ========
SPI0CR1_SPE=0; // Disable SPI Channel One,
SPI1CR1_SPE=0; // Disable SPI Channel Two,
PWME=0X00; // Disable PWM Peripheral,
PERP_PERP0=0; // Pull Deivce is Deactivated.
PPSP_PPSP0=1; // Interrupt Polarity (Rising Edge).
PIEP_PIEP0=1; // Enable Interrupt
PIFP_PIFP0=1; // Clear Interrupt Flag.
//==================================
EnableInterrupts; //Global Interrupt Enable
for(; {
_FEED_COP(); /* feeds the dog */
} /* loop forever */
/* please make sure that you never leave main */
}