2012a simulink arduino, fast timer, DHT22

조회 수: 1 (최근 30일)
Jonathan
Jonathan 2012년 4월 12일
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