ERROR mbed function : InterruptIn IN();
- This topic has 4 replies, 3 voices, and was last updated 6 years, 7 months ago by
Marcelo Sforza.
-
AuthorPosts
-
October 1, 2018 at 9:19 am #26430
Marcelo Sforza
ParticipantERROR mbed function : InterruptIn IN();
Hi.
I have a problem when I trait to use function: InterruptIn ();.
If I compile the program without the mDOT/xDOT library, works well. When I add the library of Multitech for mDOT/xDOT, dosen’t work any more !I use this function to count the number of impulse that arrive to one PIN to the xDOT, in asynchronous way. I need to make 3 differents inputs, to do the same, counts the nr. of impulse between the transmission.
My program use these library:
mbed-os-rev: 5.4.7 lib-rev: 144
DOT library:xDot version: 3.0.0-mbed144Many thanks for the support/help.
Marcelo.October 1, 2018 at 9:32 am #26431Marcelo Sforza
ParticipantHi. More detail info of code:
//Sensor PIR – Security system
InterruptIn IO1(PA_0); // xDot:pin 34 – PCB: i1 Conector P1-2
InterruptIn IO2(PB_12); // xDot:pin 9 – PCB: i2 Conector P1-3
InterruptIn IO3(PB_13); // xDot:pin 10 – PCB: i3 Conector P1-4
InterruptIn IO4(PB_15); // xDot:pin 11 – PCB: i4 Conector P1-5
InterruptIn IO5(PB_14); // xDot:pin 12 – PCB: i5 Conector P1-6/*
…..
*/void rise1() {
pc.printf(“IO1=Sensor PIR detect RISE !\r\n”); // Turn on led1 +led2
led1 = 1;
mon_cpu_pcb();
in_int=1; // Interrup arrived to PIN:P1-1
counter_1++;
wait (0.1);
led1=0;}
void fall1() {
pc.printf(“IO1=Sensor PIR detect FALL !\r\n”); // Turn on led1 +led2
pc.printf(“IO5 -> Nr Pulse read:%d\r\n”, counter_1);}
/*
….
*/int main()
{
.
.
.IO1.mode(PullUp); // (PullUp) – (PullDown)
IO2.mode(PullUp);
IO3.mode(PullUp);
IO4.mode(PullUp);
IO5.mode(PullUp);IO1.rise(&rise1); // attach the address of the rise function to the rising edge
IO2.rise(&rise2); // attach the address of the rise function to the rising edge
IO3.rise(&rise3); // attach the address of the rise function to the rising edge
IO4.rise(&rise4); // attach the address of the rise function to the rising edge
IO5.rise(&rise5); // attach the address of the rise function to the rising edgeIO1.fall(&fall1); // attach the address of the rise function to the rising edge
IO1.fall(&fall2); // attach the address of the rise function to the rising edge
IO1.fall(&fall3); // attach the address of the rise function to the rising edge
IO1.fall(&fall4); // attach the address of the rise function to the rising edge
IO1.fall(&fall5); // attach the address of the rise function to the rising edgewhile(1){
October 1, 2018 at 9:54 am #26432Jason Reiss
Keymasterhttps://os.mbed.com/platforms/mts-mdot-f411/
Printf should not be used in ISR context. I assume you added these after it stopped working.
PA_0 is the default wake pin. Perhaps another pin.
October 1, 2018 at 10:06 am #26433Leon Lindenfelser
ModeratorPlease read the warning box titled ‘InterruptIn Limitations’
https://os.mbed.com/platforms/MTS-xDot-L151CC/October 4, 2018 at 3:32 am #26470Marcelo Sforza
ParticipantHi.
many thanks for the support, i find the solution using the comments of these link : https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/io/InterruptIn/Thanks again !.
Marcelo -
AuthorPosts
- You must be logged in to reply to this topic.