Data Acquisition (DAQ) and Control from Microstar Laboratories

Knowledge Base: Control

  • See the list of other topics for category Control

Q10001 Using MATLAB as a real-time controller

Tags: Help, DAP, DAPL, device drivers, control, optimization, host applications, MATLAB

Applies to: All DAP models and all DAP software, DAPtools for MATLAB

I have an advanced control algorithm programmed in MATLAB. I want to use my DAP as a simple I/O device, sending measurements one at a time for MATLAB to process. Can I do this?

Sure you can — but no promises that it will be completely succesful.

You just need to configure your data processing with two tasks.

  • Input transfer task. Deliver each input value immediately to the PC host interface as soon as it arrives.
  • Output delivery task. Post each response value to output converter hardware as soon as it arrives.
   PDEFINE  processing
     $BinOut = ip0        // Input channel pipe (ip0) to host
     DACOUT($BinIn, 0)    // Host to d-to-a converter (DAC 0)
   END
   START
  

So what's wrong with this? Nothing, but control output signals could be delayed and erratic. PCs do a wonderful job of moving huge amounts of data, but it takes almost the same amount of time to move one value as 1000 – all of the same steps must be applied. The delays can be considerable. In practice you will be doing very well if you can get your processing cycle to operate reliably at 100 updates per second. This is without allowing your host system any time to perform calculations. In comparison, running this process embedded on the DAP processor, it can go about 100 times faster and never produce a late response.

L23942