Page 1 of 1

Rx Input Multiplexed?

Posted: Wed May 28, 2008 11:35 pm
by NigmaTech
Hi!

I;m thinking about controling duty cycle of PWM's in my dsPIC using a joystick connected to computer. I'm trying to use yaw, pitch, roll axis and throttle from "joystick" block in "Virtual Reality Toolbox", data should be transfered via RS-232. Is that possible to make it using your blockset Lubin?

Re: Rx Input Multiplexed?

Posted: Thu May 29, 2008 12:21 am
by LubinKerhuel
Hi NigmaTech,

All required dsPIC peripheral for this application are suported by the blockset. The blockset will help to build in no time the software for the dsPIC.

You will have two Simulink model :
- model onboard the dsPIC
- model for the user interface running on your PC

You have to create your own "high level protocol" to send data from the PC to the PIC throw UART.

On the model onboard the dsPIC, use the UART Rx block to receive data. Once information from UART is decoded, the PWM will be sent throw either one of the peripheral able to generate a PWM signal (PWM Motor, Output Compare)

For the user interface, The hard part is to send data to the UART port from Simulink. I saw once a block able to do it (not a Mathworks block !)

Btw, For this kind of application, I would recommend to use Labview to build the Graphical User Interface. (I built such a system few years ago, see http://lubink.free.fr/projelectro/Autop ... 05_fr.html (french) )
Matlab can do it, but it is more difficult and the result is not as user friencly as with labview.

Re: Rx Input Multiplexed?

Posted: Thu Jun 19, 2008 1:06 pm
by NigmaTech
Could I request You for an example of Simulink model for transmitting data from PC to dsPIC? I need something simple to transmit data via at least one channel, i.e. thrust from joystick via Simulink to dsPIC using RS-232. Probably I should to use xPC blockset but I don't know how :cry:

Re: Rx Input Multiplexed?

Posted: Thu Jun 19, 2008 9:31 pm
by LubinKerhuel
I am not sure xPC is the solution: As far as I know, Virtual reality blockset will not work on xPC Target.
The solution may be to find (on the web) the Simulink block that is able to send data throw Serial port. It is the hard part!
Otherwise, you can write your own block function for simulink and use the command line instructions to send data (from simulink) through UART.

From the PIC, Serial port Rx block is very easy to use and should not be a problem.

Re: Rx Input Multiplexed?

Posted: Sat Jul 19, 2008 10:40 am
by NigmaTech
Could You make an example of Interface in LabView available? Something to sending data, receiving and presenting on grapf diagram. I've got evaluate version of LabView 8.5. I have never used it before :(

Re: Rx Input Multiplexed?

Posted: Sun Jul 27, 2008 11:35 pm
by LubinKerhuel
Hi,

I will not have time to do it soon.
I have to clean up the existing labview files I have.

I attach an old project where labview was used to watch the variables (like the matlab interface rs232gui) and to send new configuration parameters.
This was for a plane. Few screenshoot are available on my french website : http://lubink.free.fr/projelectro/Autop ... 05_fr.html
Data transmission from the PIC use the protocole implemented in the dsPIC block "Tx for Matlab Labview"

All labview files of this project are in the .rar file attached. It is provided as is !
It may be quite messy in its present form.

Lubin