ERROR mbed function : InterruptIn IN();

Home Forums mDot/xDot ERROR mbed function : InterruptIn IN();

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26430
    Marcelo Sforza
    Participant

    ERROR 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-mbed144

    Many thanks for the support/help.
    Marcelo.

    #26431
    Marcelo Sforza
    Participant

    Hi. 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 edge

    IO1.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 edge

    while(1){

    #26432
    Jason Reiss
    Keymaster

    https://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.

    #26433

    Please read the warning box titled ‘InterruptIn Limitations’
    https://os.mbed.com/platforms/MTS-xDot-L151CC/

    #26470
    Marcelo Sforza
    Participant

    Hi.
    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

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.