Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

real time programming. 1

Status
Not open for further replies.

zeotrex

Programmer
Jul 18, 2002
3
SG
I am going to upgrade a Dos-based software into a window-based. It is a Test Control system. The original program is a real time program, collecting data to be analysed. The question is what language is the best for upgrading my system to a windows-based program in order to maintain its real time property. Will Visual C++ better or Matlab 6?
Currently i am thinking of going for matlab 6(simple user interface will do).

Can Matlab 6 do the real-time programming. So far i know it does, but hope to have some advice from the expert. Can Matlab 6 fully talk to the outside world????

Thank you.

Frankie
 
What do you mean by real-time? And what hardware are you using to acquire the data? I used to write and maintain test software for Inertial Navigation Units at one point... Up to a bus rate of 1 MHz.

It can be done with either Visual C++ or MatLab. However, if you're interfacing with drivers for something like a MIL-STD-1553, RS-422 or ARINC429 (you aren't in DOS anymore LOL), you will be better off with Visual C++ (under Windows) or C/C++ (under Linux).

Another thing you may want to consider: What is the DOS based app written in, and can you reuse some of the code?

Also - what version of Windows? And on what hardware? The stuff I did worked on NT 4.0 (And I have since written a similar app for Win2kPro)...

You've asked a good question, and I hate to answer with more questions, but RT projects have specific needs...

At the least, I've given you dataglut :) Feel free to ask more... CoolNameDenied
 
Thank you for your reply CoolNameDenied. Well I am currently working on an Win2k system. I am assigned a project to be completed in max 8 weeks time. It's quite short actually. I know Visual C++ could do the job, but i was being recommended to use Matlab 6 to speed up the work,
as Matlab come with all the toolbox and real time control workshop. THe old software is written in C language, a Dos-based program, which in between an analog/digital device(RTI-800/850 board) is used to collect real-time data for a controller. The data will be sent to the program for further analysis. This real-time interface I/O board is quite old already and a new card to be used is yet to be defined. Therefore i have to carry out some analysis now to make sure Matlab could do all this job, especially if Matlab could talk to the card and how.

Thank you for your advice again and hope when the new card is defined, i will come back for some specific advice.

Regards.

Frankie
 
Quite simply, if you don't have a Win2K driver for your board... you're sunk - neither Matlab or VC++ will be able to use the board without a driver. This is a common problem... Trust me, I know.

If they want it done in 8 weeks... well, there's fast, cheap, and good...

Pick two :)

Good luck, let me know if I can help. CoolNameDenied
 
Hi CoolNameDenied,

I am back for some helps. Most of my supervisors have been on holidays for 3 weeks and so i have to work out something myself. The order board was told by the manufacturer that i does not come in win 2k driver. So a new board has been ordered 2 weeks ago but still no received. Now i found that Matlab do have the driver for the old board in win 2k and i am trying to work out how it works on "Real time windows target" in Matlab. Do you have any helpful reading material or anything in real time programming of matlab? Or any helpful material in real-time programming since you did experience in this before.

Hope to hear from you soon your advice will be very helpful.

cheers,

Frankie
 
Generally, for real time applications, you want to avoid recursion in function calls, and make the most of memory. Direct Memory Access is your best bet! Hopefully your card comes with that (it should).

Real Time programming is a bit different... The closest would be game programming (consider I/O from media and user in Quake!)

Under Windows using C++, you'll need to become familiar with multithreading (if you're not already), and user messages.

Basically, when you get data from the card, you want to 'do stuff' with it. Other threads may be around for the GUI, or even for processing of the data. This means that you need to pass data between threads, and so forth. You also will have to fiddle with thread priority - be careful here. Thread priority can burn you if the priority of your data interface thread is higher or the same as that of the device driver.

Things to avoid are a lot of disk access (utilizing DLLs, etc), as well as avoiding function recursion as much as possible.

If I lost you anywhere, let me know. CoolNameDenied
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top