How to connect Matlab with PIC?

4 ビュー (過去 30 日間)
QY Goh
QY Goh 2011 年 9 月 25 日
Hello all my friend,
i am now in progress of my Project about the robotic hand.The idea is like that,the Matlab is use for detect the movement and position of human hand.After that it will send the data to PIC for adjust the position of robotic hand as same as human and. So,I wish to know how to communicate between Matlab and PIC16f877a? Please give me some idea.
Best Regards QY Goh
  5 件のコメント
Walter Roberson
Walter Roberson 2011 年 11 月 30 日
You can use USB serial ports, provided that you connect the device before you start MATLAB, and provided that you are okay with the latency being 40 milliseconds per USB packet (unless the packet is full, somewhere around 1022 bytes.)
QY Goh
QY Goh 2012 年 5 月 19 日
Hello walter, i use video cam to take the input of the user's finger color.

サインインしてコメントする。

採用された回答

Gergely Öllös
Gergely Öllös 2011 年 11 月 29 日
Hi,
There are so many possibilities. One of them –that I would prefer – is to use the PIC’s USART/SCI. Just buy a serial/usb converter cable (it’s almost for free) and hook up with the PICs USART (there is no need for any additional HW). Then plug the USB side of the cable to the PC and it will show up as a virtual serial port. Then just use MATLAB’s Serial Port Interface to connect to it, as in this example:
s = serial('COM1');
set(s,'BaudRate',4800);
fopen(s);
fprintf(s,'something to send')
out = fscanf(s);
fclose(s); delete(s);
On the PIC’s side The Universal Synchronous Asynchronous Receiver Transmitter (USART) module is a serial I/O module. It can be configured as a full duplex asynchronous system that can communicate with peripheral devices such as personal computers. Configure the USART in full duplex mode, and with the same signaling speed as in matlab (4800 in our example). To configure the USART set these two registers:
TXSTA: TRANSMIT STATUS AND CONTROL REGISTER (ADDRESS 98h)
RCSTA: RECEIVE STATUS AND CONTROL REGISTER (ADDRESS 18h)
For details consult the PIC’s user manual.
I hope this helps, Gergo
  3 件のコメント
Walter Roberson
Walter Roberson 2011 年 11 月 30 日
QY Goh, you did not happen to mention any information about what kind of instrument you are using to detect the movement and position of a human hand. Are you using a video camera?
Gergely Öllös
Gergely Öllös 2011 年 11 月 30 日
QY Goh, It depends on the application. What is the model of the hand?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by