필터 지우기
필터 지우기

How to produce a pulse for 10Microseconds?

조회 수: 11 (최근 30일)
kintali narendra
kintali narendra 2017년 2월 12일
댓글: Walter Roberson 2017년 2월 22일
I am programming my Arduino from matlab(I installed supporting package), in order to use Ultrasonic sensor I need to produce a trigger pulse for 10microseconds(from matlab) and I also need to read the time in microseconds. please tell me how to produce a delay of 10us or produce a constant value for 10us. I am using matlab2014b.
I need to produce the pulse in Yellow from matlab and read the pulse in Red in Matlab. Both are in microseconds thank you

답변 (1개)

Walter Roberson
Walter Roberson 2017년 2월 21일
Technical notes:
Looking at:
Arduino code would look something like
digitalWrite(13, HIGH);
delayMicroseconds(10);
digitalWrite(13, LOW);
where the 13 would have to be adjusted to the appropriate pin number.
The MATLAB interface to digitalWrite is writeDigitalPin: https://www.mathworks.com/help/supportpkg/arduinoio/ref/writedigitalpin.html
The difficulty with using this is the timing: there is no way in MATLAB to pause for less than 1/1000 of a second (and you cannot even do that well on MS Windows.) If you could pause for that short of a period, the time required to send the new data to arduino would add a lot of uncertainty.
It would therefore be better to program the 10 microsecond pulse on the arduino side.
With regards to the TTL signal: is the idea that you get a response by reading the voltage? If so then it becomes important to know the minimum and maximum voltages. Or does "range in proportion" refer to time?
  댓글 수: 2
kintali narendra
kintali narendra 2017년 2월 22일
Sir, I wont be reading voltage, I need to read, for HOW much time the pulse is HIGH ?, In arduino we have a inbuilt command called PULSEIN. Can you please suggest any equivalent command to that in MATLAB.
Walter Roberson
Walter Roberson 2017년 2월 22일
I would not attempt to trigger a PULSEIN from the MATLAB level: your timing is too strict.
Always keep in mind: your MATLAB session might get suspended for an unknown number of hours while your PC does virus checking, or fetches email, or updates a "Push" page in the web browser you left open, and so on. MS Windows is not a real-time operating system and MATLAB itself does not try to be a real-time program.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by