We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I use an XC164CM controller (on a Infineon Evalboard). My problem is, thats not possible to start an extern interrupt (EX4IN) on Portpin P9.2. The register values are correct for the simulation with µVision3. Probably I have a hardware problem. The positive trigger edge is from a 74LS00. But the controller can't detect the edge and no interrupt is started. Some ideas? Kindly regards Rainer
Could you confirm the values you wrote to registers EXISEL1 and EXICON?
These are protected registers and if wrote to them after reaching the main routine (EINIT instruction has been executed) then the write was ignored.
This could also explain why it works with the simulator and not on real hardware.
Anyway that would be my best guess...
Best regards -Chris
Hi Chris,
here are the values but I think its not the reason because the interrupts (EX4INT and CAPCOM2_Timer7) work at the hardware with my small terminalprogram. Only the trigger edge on P9.2 doesnt start the EX4INT interrupt.
#define CC1_CC12INT 0x1c
void EX4INT_init (void) { EXISEL0 = 0x0000; EXISEL1 = 0x0001; EXICON = 0x0100; CC1_CC12IC = 0x0000; // now disabled; // 0x0048 enable }
void EX4INT (void) interrupt CC1_CC12INT using _FAST_BANK2_ // EX4IN { // input from P9.2 printf("trigger..\n"); }
// Set Port 9 Direction Control P9.2 Input DP9 &= 0xFFFB; // Alternate I/O Source Port 9 Selection ALTSEL0P9 |= 0x0000; ALTSEL1P9 |= 0x0000;
yes - this was the solution, much thanks! Rainer
Here is the code snippet from Infineon(DAvE): void UnlockProtecReg(void) { uword uwPASSWORD;
if((SCUSLS & 0x1800) == 0x0800) // if low protected mode {
uwPASSWORD = SCUSLS & 0x00FF; uwPASSWORD = (~uwPASSWORD) & 0x00FF; SCUSLC = 0x8E00 | uwPASSWORD; // command 4
} // end if low protected mode
if((SCUSLS & 0x1800) == 0x1800) // if write protected mode { SCUSLC = 0xAAAA; // command 0 SCUSLC = 0x5554; // command 1
uwPASSWORD = SCUSLS & 0x00FF; uwPASSWORD = (~uwPASSWORD) & 0x00FF;
SCUSLC = 0x9600 | uwPASSWORD; // command 2 SCUSLC = 0x0800; // command 3; new PASSWOR is 0x00
} // end if write protected mode }
Please read the instructions for how to post code on this forum. They are not hard to find. Just two lines above the text box where you enter your message.
The code you have posted is unreadable!
Sorry,
void UnlockProtecReg(void) { uword uwPASSWORD; if((SCUSLS & 0x1800) == 0x0800) // if low protected mode { uwPASSWORD = SCUSLS & 0x00FF; uwPASSWORD = (~uwPASSWORD) & 0x00FF; SCUSLC = 0x8E00 | uwPASSWORD; // command 4 } // end if low protected mode if((SCUSLS & 0x1800) == 0x1800) // if write protected mode { SCUSLC = 0xAAAA; // command 0 SCUSLC = 0x5554; // command 1 uwPASSWORD = SCUSLS & 0x00FF; uwPASSWORD = (~uwPASSWORD) & 0x00FF; SCUSLC = 0x9600 | uwPASSWORD; // command 2 SCUSLC = 0x0800; // command 3; new PASSWOR is 0x00 uwPASSWORD = SCUSLS & 0x00FF; uwPASSWORD = (~uwPASSWORD) & 0x00FF; SCUSLC = 0x8E00 | uwPASSWORD; // command 4 } // end if write protected mode }
Thanks all for help! Rainer
Thanks! Much better!