2015-04-22 02:01 AM
Hello,
I have this ultrasonic sensor(HY-SRF05 blue): cf in attachment.I have to manage 3 of this sensors simultaneously. How? I have the board SPC560P-DISP. In datasheet there's written of to use the I2C interface or UART or SPI. But I don't know how do. There's a documentation? Thanks. Best regards, Gianluca.Solved! Go to Solution.
2016-10-14 02:03 AM
Hello Auhagen ,
See you an example of the components for I2C Emulation Software using to match with LCD Arduino. you can take some functions to reintegrate the code in your project Anyway, i will push on github the code (I2C SW Components). You will be able to contribute. Best regards Erwan ________________ Attachments : i2c_components.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0S7&d=%2Fa%2F0X0000000bZ6%2FJB1fbAUJm2HNNVAaEj2yl6TRKX51srXhbR3tjTxIUYw&asPdf=false2015-04-22 04:29 AM
Hello Gianluca ,
There is no I2C HW onSPC560P-DISP. we have a project to create some I2C drivers (SW) UART and SPI are existing onSPC560P-DISP For SPI , i do not see MISO and MOSI and CLK on the reference manual of your capter i would use some Threads and some External Interrupts with your board. an External IRQ on the ECHO PIN you need 10us TTL impulse for INPUT. with ARDUINO :// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
duration = pulseIn(ECHO_PIN,HIGH);
withSPC560P-DISP (SPC5Studio) :
palClearPad(PORT_A, TRIG_PIN);
delayTwoMicroSec();
palSetPad(PORT_A, TRIG_PIN);
delayTenMicroSec();
palClearPad(PORT_A, TRIG_PIN);
// Pulse In To created in your Handler Interruption (Rising Edge / Falling Edge)
Best regards
Erwan
2015-04-23 06:53 AM
Hello Erwan,
I'm using this code for my handle interruption:#define INTERRUPT vector43
OSAL_IRQ_HANDLER(INTERRUPT) {
OSAL_IRQ_PROLOGUE();
OSAL_IRQ_EPILOGUE();
}
But I don't understand what to put in this function.I know what a interrupt and I know created threads in C. But I don't understand why you should use a interrupt. It'scorrect to use the vector 43? Then, the TRIG_PIN is set in Input mode? And ECHO_PIN? Thanks.
Best regards,
Gianluca.
2015-04-23 09:48 AM
// convert the time (ms) into a distance
distanceCm = duration / 1 / 2 ;
Best regards
Erwan
2016-10-10 06:10 AM
is there an i2c software driver available for this microcontroller?
Thank you in advance!
2016-10-11 02:43 AM
Hello Auhagen ,
Yes , there is SPC560P-DISP I2C SW code.we have planned to create a I2C component. (HW & SW)i will send you some beta source code asap used for students projects compliant for LCD components. Best regards Erwan2016-10-11 07:38 AM
That would be great. Thank you.
Best regards
Torben
2016-10-14 02:03 AM
Hello Auhagen ,
See you an example of the components for I2C Emulation Software using to match with LCD Arduino. you can take some functions to reintegrate the code in your project Anyway, i will push on github the code (I2C SW Components). You will be able to contribute. Best regards Erwan ________________ Attachments : i2c_components.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0S7&d=%2Fa%2F0X0000000bZ6%2FJB1fbAUJm2HNNVAaEj2yl6TRKX51srXhbR3tjTxIUYw&asPdf=false2016-11-08 10:39 AM
Hello Erwan,
sorry for taking so long to reply. Unfortunately there are lots of errors when i try write a reply in the forum with the pc at work. Every bit of code that you can provide me would be helpful. Anyways, i must finish other components of the firmware first. So it isn't that urgent. Best Regards, Torben