cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupt for st72f651..please!!!

sangjina
Associate II
Posted on October 15, 2004 at 19:00

Interrupt for st72f651..please!!!

3 REPLIES 3
sangjina
Associate II
Posted on October 14, 2004 at 01:29

HI!!!

Please Help me~~

I use the hiware and want the External interrupt(PortD.7).

My source is....

void InitST7(void)

{

asm SIM;

// PortD Initialize

// 0 ~ 7 : Input/Interrupt

// 0 ~ 2 : Output, 3 ~ 7 : Input/Interrupt

// 5 : Output

PDDR = 0x20;

PDDDR = 0x27;

PDOR = 0xff;

// Power Control

PCR = 0x00;

// Interrupt Priority

ITSPR0 = 0xff;

ITSPR1 = 0xef; // PortD int enable

ITSPR2 = 0xff;

ITSPR3 = 0xff;

MISCR1 = 0x51; // IS11: 0, IS10: 1 => EINT_PA Sensitivity : Falling edge only

// IS21: 1, IS20: 0 => EINT_PD Sensitivity : Falling edge only

MISCR2 = 0x1e; // 0 : on, 1 : off , PWM ON

MISCR3 = 0x09; // PWM0 Enable

// IS31: 1, I

asm RIM // Enable Interrupt

}

ISR is....

pragma TRAP_PROC //SAVE_REGS

extern void ISR6_EINTPortD(void)

{

PDOR &= 0x3f;

if(PADR & 0x01)

{

PADR = 0xff;

PADR = 0x00;

}

PDOR |= 0xc0;

}

but...

Not used the interrupt.

show the Init_st7()....

asm RIM // Enable Interrupt

if the RIM command running, die the machine.

why!!!

please!!!

[ This message was edited by: sangjina on 14-10-2004 05:00 ]

alok2
Associate II
Posted on October 15, 2004 at 03:56

YOu have not specified if the micro goes into the interrupt.

What I read from the Interrupt chapter is that

– Level 0 can not be written (I1_x=1, I0_x=0). In

this case, the previously stored value is kept. (ex-ample:

previous=CFh, write=64h, result=44h)

Can you pls comment writing into the ISPRx registers and let us know the behaviour ?
sangjina
Associate II
Posted on October 15, 2004 at 19:00

thank you!!

my mistake!!!

I'm sorry~~;

I modified....

ITSPR0 = 0xff;

ITSPR1 = 0xcf; // PortD int enable

ITSPR2 = 0xfc; // Timer Interrupt Enable

ITSPR3 = 0xff;

but, the Machine cann't go into the Interrupt Service Routine.

please!!! show the source.

---> ST7 Initialize

void InitST7(void)

{

asm SIM;

// PortA

// 0 ~ 3 : Input/floating/Interrupt, 4 ~ 5 : Input, 6 ~ 7 : Output/PushPull

PADR = 0x00;

PADDR = 0xc0;

PAOR = 0xcf;

// PortB

// 0 ~ 7 : Output/PushPull

PBDR = 0xff;

PBDDR = 0xff;

// PortC

// 0, 2, 3 : Output/Pushpull, 1, 4 ~ 7 : Input/floating

PCDR = 0x0d;

PCDDR = 0x0d;

PCOR = 0xf2;

// PortD

// 0 ~ 2, 5 : Output/Opendrain, 3, 4, 6, 7 : Input/Interrupt/floating

PDDR = 0x00;

PDDDR = 0x27;

PDOR = 0xd8;

// PortE

// 0 ~ 2 : Input, 3 : PWM, 4 ~ 7 : Output/Pushpull(only 4)

PEDR = 0x00;

PEDR &= 0x0f;

PEDDR = 0xf8;

PEOR = 0x10;

// PortF

// 0 ~ 1 : Output/Opendrain, 3 : ADC, 4 : Not Used, 5,6 : ICC

PFDR = 0x03;

PFDDR = 0x03;

MISCR1 = 0x90; // IS11: 1, IS10: 1 => EINT_PA Sensitivity : Falling edge only

// IS21: 1, IS20: 0 => EINT_PD Sensitivity : Falling edge only

MISCR2 = 0x1c; // PWM, TIMER ON

MISCR3 = 0x09; // WDGHALT : 0

// PWM0 : 1

// PWM1 : 0

// IS31: 1, IS30: 0 => EINT_PC Sensitivity : Falling edge only

// ADC

//ADCDR = ; // AD Value

ADCCSR = 0x00; // AIN0

// Watchdog

WDGCR = 0x00; // Disabled

// Power Control

PCR = 0x02; // PLGIE: 0 Single supply mode, PLG int disable

// DETEN: 1 The USB voltage detector disable

// SPI

SPICSR = 0x01;

// 7. SPIF

// 6. WCOL

// 5. OVR

// 4. MODF

// 2. SOD : 0, SPI Output Enable

// 1. SSM : 0,

// 0. SSI : 1,

//SPICR = 0x34;

SPICR = 0x1c;

// 7. SPIE : 0, Interrupt disable

// 6. SPE : 1, SPI I/O?enable

// 5. SPR2 : 0,

// 4. MSTR : 1, Master

// 3. CPOL : 1,

// 2. CPHA : 1,

// 1. SPR1 : 0

// 0. SPR0 : 0, Fcpu/4

SPIDR = 0x00; //

// DTC

//DTCCR = ;

//DTCSR = ;

//DTCPR = ;

// Timer

TCR1 = 0x20; // TOIE : Timer OverFlag Interrupt Enable

TCR2 = 0x00; // Clock Control : Fcpu/4

//ReadOnly

//TSR = ;

//CHR = ;

//CLR = ;

//ACHR = ;

//ACLR = ;

OC1HR = 0x00;

OC1LR = 0x00;

OC2HR = 0x00;

OC2LR = 0x00;

// Interrupt Priority

//ITSPR0 = 0xcf; // EINT_PA

ITSPR0 = 0xff;

ITSPR1 = 0xcf; // PortD int enable

ITSPR2 = 0xfc; // Timer Interrupt Enable

ITSPR3 = 0xff;

// USB

//USBISTR = ;

//USBIMR = ;

//USBCTLR = ;

//DADDR = ;

//USBSR = ;

//EP0R = ;

//CNT0RXR = ;

//CNT0TXR = ;

//EP1RXR = ;

//CNT1RXR = ;

//EP1TXR = ;

//CNT1TXR = ;

//EP2RXR = ;

//CNT2RXR = ;

//EP2TXR = ;

//CNT2TXR = ;

//BUFCSR = ;

// I2C

//I2CCR = ;

//I2CSR1 = ;

//I2CSR2 = ;

//I2CCCR = ;

//I2CDR = ;

// PWM

PWM0 = 0x88;

BRM10 = 0x08;

PWM1 = 0x00;

//PBDR = 0x00;

//PEDR = 0x00;

asm RIM; ----> OK!!!!

}

---> isr.h

#pragma TRAP_PROC SAVE_REGS

extern void ISR6_EINTPortD(void);

---> isr.c

/*********************************************************

ROUTINE NAME : External Interrupt Port D

DESCRIPTION :

COMMENTS :

*********************************************************/

#pragma TRAP_PROC SAVE_REGS

void ISR6_EINTPortD(void)

{

// asm PUSH CC;

PBDR = ~PBDR;

// asm POP CC;

}

Please!!! know you the point at issue to me!!!

thankyou.

[ This message was edited by: sangjina on 18-10-2004 02:33 ]