필터 지우기
필터 지우기

atmega to serial communication

조회 수: 1 (최근 30일)
Nachiket Joshi
Nachiket Joshi 2011년 1월 24일
i want to know how u overcame the problem!!!! please ma frnd i m ri8 now under pressure of completing ma project!!!
i have a stepper motor connected to atmega 16
  1. it will take 1 step
  2. will send "1" to matlab
  3. as my matlab gets 1 it takes picture detects red and sends "2" to atmega
  4. asa atmega recieves 2 shooting mechanism is triggered
  5. if matlab dont detect red it will send "3" to atmega
  6. as atmega gets "3" stepper motor triggers to next step.
this is algorithm
here is ma matlab code
s = serial('COM1')
fopen(s)
fwrite(s,'2(if red) 3(if not red)')
now tel me the atmega code!!!
how should i accept the value passed by matlab in atmega!!! how should that variable be declared and al rest!!!
pls help... i have switch case controlled programme in atmega pls help
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 1월 24일
I find multiple possible matches for what an "atmega" might be. Most of the matches suggest it is an embedded device with multiple functions. Unless you are using it as the target for the Real Time Workshop, the methods by which you program the device would be outside of the scope of this resource.

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

채택된 답변

Radhika
Radhika 2011년 1월 24일
ATMel should be able to help you program the MCU.
On MATLAB side, first read response from Atmega using,
fread(s)
To write to MCU use
fwrite(s,2) % For e.g.
Remember you will have to use appropriate logic in MATLAB to write correct values when red is detected.

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by