2012a simulink arduino, fast timer, DHT22

1 次查看(过去 30 天)
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?

回答(1 个)

Walter Roberson
Walter Roberson 2012-4-12
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 个评论
Walter Roberson
Walter Roberson 2012-4-12
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 2012-4-12
Thanks. Is there a tutorial for triggering a sketch in simulink?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Modeling 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by