Prev: Adaptive Neural Network
Next: help: stran cell array
From: Hamid Reza Mohseni Nejad on 10 Jul 2010 07:36 Hi I'm trying to read serial data from a PIC microcontroller to MATLAB. In m file environment everything is ok. But when it comes to Simulink everything is out of control!!! I tried Instrument Control toolbox.It reads the data but in External mode it doesn't show anything. So I checked the "Input Packet Block" in Real-Time Windows Target.But it doesn't work in NORMAL mode!!! I'll be thanksful if anybody can help me. Regards
From: Jan Houska on 10 Jul 2010 08:52 Hi Hamid, Hamid Reza Mohseni Nejad wrote: > I'm trying to read serial data from a PIC microcontroller to MATLAB. > In m file environment everything is ok. > But when it comes to Simulink everything is out of control!!! > I tried Instrument Control toolbox.It reads the data but in External > mode it doesn't show anything. > So I checked the "Input Packet Block" in Real-Time Windows Target.But it > doesn't work in NORMAL mode!!! Real-Time Windows Target blocks do not access their hardware in normal mode indeed. They must be compiled and run in the real-time kernel to work. So you have two solutions - for non-realtime work you can use Instrument Control Toolbox blocks, for real-time work you must compile your model and use Real-Time Windows Target blocks. It depends on your problem which of these two solutions is more appropriate. Good Luck, Jan -- Jan Houska HUMUSOFT s.r.o. houska(a)humusoft.com Pobrezni 20 http://www.humusoft.com 186 00 Praha 8 tel: ++ 420 284 011 730 Czech Republic fax: ++ 420 284 011 740
From: Hamid Reza Mohseni Nejad on 10 Jul 2010 11:12 Hi Jan thanks so much of your great help. Now the problem is that I want to have a handshaking between the PIC and Simulink. At the Simulink side,Simulink should send a byte such as 0x55 to the PIC. At The PIC side,PIC waits till it receives 0x55 so it sends 10bytes. I can do it in m file programming.But how can i implement this in Simulink? I don't have any Enable for Packet Input or Packet Output.How can I control this blocks?
From: Jan Houska on 12 Jul 2010 04:18 Hi Hamid, Hamid Reza Mohseni Nejad wrote: > Now the problem is that I want to have a handshaking between the PIC and > Simulink. > > At the Simulink side,Simulink should send a byte such as 0x55 to the PIC. > > At The PIC side,PIC waits till it receives 0x55 so it sends 10bytes. > > I can do it in m file programming.But how can i implement this in Simulink? > > I don't have any Enable for Packet Input or Packet Output.How can I > control this blocks? You can enable the "Data Ready" port of the Packet Input block. This will tell you when the response packet has arrived and you can use this information to e.g. sent a new byte to the PIC. Enabled and Triggered subsystems may be of use here as well. Good Luck, Jan -- Jan Houska HUMUSOFT s.r.o. houska(a)humusoft.com Pobrezni 20 http://www.humusoft.com 186 00 Praha 8 tel: ++ 420 284 011 730 Czech Republic fax: ++ 420 284 011 740
|
Pages: 1 Prev: Adaptive Neural Network Next: help: stran cell array |