Triggering multiple output pins of Arduino simultaneously from Simulink
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Using DigitalWrite command in Arduino for multiple pins creates a delay, which can be solved as follows.
PORTB = 0b00110000; (Pin 12 and 13 becomes high simultameously)
However, when I use simulink for the same purpose, there is a 30 us delay (from oscilloscope) between the pin 12 and pin 13 high time.
I know that internal codes of simulink uses DigitalWrite command for a digital output pin and it works for only a single pin at a time.
In Arduino code, it is possible to write on a Port say, PORTB = 0b00110000; (Pin 12 and 13 becomes high simultameously)
Is there any way by which we can write on a Port of Arduino similarly from simulink?
I think, there is no building option.
However, is there any alternative way say by modifying any code to write on a port of Arduino from simulink?
How the delay time can be reduced to zero?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/888115/image.jpeg)
0 commentaires
Réponses (1)
Highphi
le 8 Fév 2022
Unfortunately, the way Arduino evaluates code is step by step, therefore parallel evaluation does not exist on that hardware.
30 us is probably the closest to 'simultaneous' you will be able to get.
1 commentaire
Voir également
Catégories
En savoir plus sur Arduino Hardware dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!