Port P problem for external interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Port P problem for external interrupt

Jump to solution
2,205 Views
Dora
Contributor I

I would like to ask you something about MC9S12C32MFU25.I have problem  
by using "PortP" for external interrupt with sensor. It become '1'  
when sensor detect thing, then It don't become '0' when sensor doesn't  
detect anything. So, which part do I need to change setting of  
processor or software?

0 Kudos
1 Solution
1,767 Views
ProcessorExpert
Senior Contributor III

Hello,

 

sorry for confusion, however the issue with rising/falling edges needs to be divided into two areas:

 

External Interrupt device (ExtInt Component):

This device supports only rasing/falling detecion modes (on port P) and it´s encapsulated by ExtInt component.

 

TIM device (Capture component):

This device supports "both" mode of  edge detection and it´s encapsulated by Capture component.

 

best regards
Vojtech Filip
Processor Expert Support Team

View solution in original post

0 Kudos
10 Replies
1,767 Views
ProcessorExpert
Senior Contributor III

Hello,

 

are you sure that this issue is related to the Processor Expert tool? Are you using Processor Expert? Could you please post here your project?

 

best regards
Vojtech Filip
Processor Expert Support Team

0 Kudos
1,767 Views
Dora
Contributor I

Hello,

 

Can MC9S12C32MFU25  use both falling and rising edge? I change setting both edge for port p, but I get error. And also I try to change PPSP '1' to '0' in IO_Map.h, but it give me error.

 

What should I need to change if I want both edge?

 

Thanks

0 Kudos
1,767 Views
ProcessorExpert
Senior Contributor III

Hello,

 

in case you want to change the edge or level as a condition for generation interrupt at run-time you can do it using SetEdge method from ExtInt component but the PE1_IRQ pin does not support rising edge as you can see on the attached screen-shot (or see the appropriate RM).

 

In case you are not limited to use this pin, I would recommend you to change it to another one (e.g some P port pin). In case you are using Processor Expert, you have to just change the pin in the ExtInt component and start code generation. The user C code will be the same :smileywink:

 

best regards
Vojtech Filip
Processor Expert Support Team

 

0 Kudos
1,767 Views
Dora
Contributor I

Hello,

 

I want to set both edge on  "General interrupt on", but I can't select it. If I select both edge, it give me error. How should I do to get both edge(falling and rising)? Do you have any idea for that?

 

I attach file as belows:

0 Kudos
1,767 Views
ProcessorExpert
Senior Contributor III

Hello,

 

this MCU does not support both edge mode. I have checked the values provided by "General interrupt on" porperty and they are correct and correspond to RM as you can see in the attached table.

 

best regards
Vojtech Filip
Processor Expert Support Team

0 Kudos
1,767 Views
Dora
Contributor I

Hello,

 

What is RM? So, I can't select both edge, so what can I do for sensor? Sensor need to read when sensor detect or doesn't detect the object. Can you give me some idea for that? 

 

Thank you so much

0 Kudos
1,767 Views
ProcessorExpert
Senior Contributor III

Hello Dora,

 

sorry for confusing with RM, RM means reference manual. In case you want to capture both edges I think it would be better to use Capture component together with InputPin component.

 

Caputre - provides both edge detection functionality using OnCapture event or you can also use polling mode (without interrupts)

InputPin - level cheking using GetVal method

 

Note: For more details please see enclosed project which was created in CW V5.1.

 

best regards
Vojtech Filip
Processor Expert Support Team

0 Kudos
1,767 Views
Dora
Contributor I

Hello,

 

You said previous reply that this MCU doesn't support both falling and rising edge.If I use interrupt with both edges, which type of MCU should I use?

 

Another question:

I use Port T for keypad, so I can't use Port T to capture edges. I try to write program by using PPSP as below:

 

 

Interrupt is falling edge(it read) when Sensor detect  without PPSP

void OP6_OnInterrupt(void){ 

 dword  zcommandID |= OP6FIRE;   

CAN1_SendFrameExt((zcommandID|CAN_EXTENDED_FRAME_ID),DATA_FRAME,8,buff1);

}

 

 

 Interrupt is rising edge(it read) when sensor doesn't detect 

void OP6_OnInterrupt(void){ 

 dword  zcommandID |= OP6FIRE;   

CAN1_SendFrameExt((zcommandID|CAN_EXTENDED_FRAME_ID),DATA_FRAME,8,buff1);

 

if (PPSP_PPSP1 = 1)

{

dword  zcommandID |= OP6FIRE;   

CAN1_SendFrameExt((zcommandID|CAN_EXTENDED_FRAME_ID),DATA_FRAME,8,buff1);

}

}

Is it something wrong in my program ?

Please give some advice.

Thanks

0 Kudos
1,768 Views
ProcessorExpert
Senior Contributor III

Hello,

 

sorry for confusion, however the issue with rising/falling edges needs to be divided into two areas:

 

External Interrupt device (ExtInt Component):

This device supports only rasing/falling detecion modes (on port P) and it´s encapsulated by ExtInt component.

 

TIM device (Capture component):

This device supports "both" mode of  edge detection and it´s encapsulated by Capture component.

 

best regards
Vojtech Filip
Processor Expert Support Team

0 Kudos
1,767 Views
Dora
Contributor I

 

Hello,

 

I have two question to ask you.

 

Question No1,

 

Now I am using two sensor with 2 pin(Port P1 and Port P2) by using one is falling and another is rising edge. It read when sensor detect and then it doesn't read when sensor detect.

 

Is it possible to use one sensor with 2 pin( one is falling and another is rising edge)?

 

Question No2,

 

I am thinking of using Port E instead of Port P for sensor. Is it possible to use Port E for sensor to read either '1' or '0' when sensor detect (1) or doesn't detect ('0')?(I mean port E can use both falling and rising edge together)

 

 

Thanks you so much 

 

0 Kudos