2012a simulink arduino, fast timer, DHT22

1 vue (au cours des 30 derniers jours)
Jonathan
Jonathan le 12 Avr 2012
I am using the Simulink R2012a interface with arduino. I am currently not using the embedded coder. I am trying to interface with a humidity temperature senser, DHT22. It has it's own interface, I found some arduino C libraries. It is a one wire interface, not the standard. Every 2 or so Seconds I plan to read from this sensor. To read the sensor I follow this pattern
1. Pull signal low for greater than 500us. -> 2. Pull signal high for 20-40us. -> 3. Sensor pulls data low for 80us. -> 4. Sensor pulls data high for 80us. -> 5. Then comes the transimission of data (If a high pulse is less than 30us it is a 0) (If a high pulse is 30 - 70 us than it is a 1)
So I have to read and write a pin in 10s of useconds. So I guess my question is how can I read and write an I/O pin that fast in simulink?

Réponses (1)

Walter Roberson
Walter Roberson le 12 Avr 2012
You cannot read an I/O pin that fast in Simulink itself. You might be able to do it with some mex code, but I believe that would be too slow as well.
It sounds to me as if what you should be doing is triggering an arduino sketch that does the work.
  3 commentaires
Walter Roberson
Walter Roberson le 12 Avr 2012
http://arduino.cc/en/Tutorial/Sketch
"A sketch is the name that Arduino uses for a program. It's the unit of code that is uploaded to and run on an Arduino board. "
Jonathan
Jonathan le 12 Avr 2012
Thanks. Is there a tutorial for triggering a sketch in simulink?

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by