Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

External Interrupts of HCS12XEP100(FREESCALE) doesn't work properly ?

Status
Not open for further replies.

Wanna Be

Newbie level 1
Newbie level 1
Joined
May 17, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
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 */
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top