I have this ultrasonic sensor(HY-SRF05 blue).
I have to manage 3 of this sensors simultaneously. I have the board SPC560P-DISP.
My code is this:
Code: Select all
palClearPad(PORT_A, TRIG_PIN);
osalThreadSleepMicroseconds(2);
palSetPad(PORT_A, TRIG_PIN);
osalThreadSleepMicroseconds(10);
palClearPad(PORT_A, TRIG_PIN);
The datasheet says use a pulse at 10us and then measure Rising Edge / Falling Edge. But how?
Maybe with some interrupt. But I don't know how works on my board.
I'm using this code for my handle interruption:
Code: Select all
#define INTERRUPT vector43
OSAL_IRQ_HANDLER(INTERRUPT) {
OSAL_IRQ_PROLOGUE();
OSAL_IRQ_EPILOGUE();
}
I don't know if it's correct.
Best regards,
Gianluca.