RTOS and microcontroller combination for simple application

RTOS and microcontroller combination for simple application

Post by J. Franchi » Sun, 06 Nov 2005 08:38:57

Hi all-
I'm a research scientist and I have some experiments which require
tight timing control. I want to build a device that will take timing
parameters from a USB connection and generate TTL pulses. I want a
resolution of better than 10 microseconds and would like to be able to
drive about 8 channels. I'd also like to have a couple channels of
input for triggering timing events. I'd also like the box to output
time-stamped event data back out the USB connection.

My intuition is that a microcontroller running a RTOS is the way to go.
But I haven't any experience in this area. I'm a decent C++ programmer
and can get the job done in digital hardware (not so great with
analog). I've been reading up what I can, but I'd really appreciate any
guidance any of you can offer. Thanks!

RTOS and microcontroller combination for simple application

Post by Ian Bel » Sun, 06 Nov 2005 19:07:13

I would say your intuition is wrong as far as the RTOS is concerned. With
timing constraints as tight as yours and a relatively simple application I
would suggest a simple foreground/background approach would be more



RTOS and microcontroller combination for simple application

Post by AntiSPAM_g » Mon, 07 Nov 2005 04:29:39

"J. Franchino" < XXXX@XXXXX.COM > wrote

- - - - -

- - - - -

I agree with Ian. 10 microsecond resolution with 8 channels is no
sweat for an 8-bit microcontroller (ex. Microchip PIC, Atmel AVR),
but a RTOS for such a system is overkill. A foreground/background
approach is sufficient.

DLPDesign.com makes an evaluation board for FTDIchip.com's USB chip,
which I've played with in the past. I've used the FTDIchip software
interface before to communicate through the FTDI USB. Both their DLL
and Virtual Comm ports work well. The Virtual Comm Port is kind of
nice in that the interface looks like a serial port to the software,
but you aren't limited to typical PC serial speeds 115.3Kbaud.
I've used the Visual Basic MSComm control to do this serial I/O from
MS Excel using VBA macros for a nice little datalogger.

DLPDesign makes a development board that you could probably use as a
low cost system without having to have your own PCB developed. It
uses a 18LF8720 microcontroller, ( 50 I/O pins (including A/D inputs)
plus 8-bit data bus ).

DLP-245PL USB-Microcontroller Development Board

The board is $95, but you'd also have to purchase a hardware
programmer to change the functionality and a "C" compiler if you don't
want to program in assembler.

There are similar boards for the Atmel, but I've not used these.

Drop me an email if you have questions or want a recommendation for a
company to design your own custom board, or need to find a consultant
to help with the programming task.

Indianapolis, IN USA

RTOS and microcontroller combination for simple application

Post by Hans Odebe » Mon, 07 Nov 2005 23:21:06

If this is a one-off device, to support your experiments, then my
advice is to buy, not build. While it is great fun developing low-level
microcontroller code, it is also rather time consuming. If you want to
spend time on running and analyzing your experiments, rather than
writing software, then I strongly urge you to buy this off the shelf.
Googling for "digital I/O boards" should provide a few million hits to
start with. Pair the I/O boards up with a high-level SW environment
such as Matlab or LabView, and the experiment setup effort will be

If you still want to make your own device: some years ago I worked with
Cypress' EZ-USB series. It has an 8051 core (sorry, you will have some
trouble finding a C++ compiler), coupled with a USB block that provides
fairly much of the lower level protocols in HW - not much added SW is
required. There also is a block that can update a group of digital
outputs (I do not remember how many) from a pre-stored vector in memory
- that way you can get very accurate timing of your TTL pulses.
I have also worked with, and enjoyed, the Renesas H8 series. A
C/C++-friendly CPU, good SW tools (gcc with support, see
www.kpitgnutools.com), similar means of outputting TTL pulses. There
are a few versions that have a USB port; since I have not used them, I
cannot say anything about how easy they are to use.


RTOS and microcontroller combination for simple application

Post by J. Franchi » Wed, 09 Nov 2005 03:23:53

Thanks for all the replies, Hans, Ian and g9u5d,

I think I'll go with the digital I/O board approach. And so I'm afraid
this is getting a bit off topic.

As Hans noted, I am concerned about development time, so it would be
quickest for me to have a device that plugs into a USB port and can be
programmed from the USB port in visual C++ (to make an easy, MFC-based
GUI). What companies make devices like this and/or what search terms
should I use. I don't know the terminology for these types of products.

Thanks in advance. -james

RTOS and microcontroller combination for simple application

Post by Hans Odebe » Wed, 09 Nov 2005 18:24:54

I tried the search string "USB digital I/O board", and got quite a
number of replies.

Back when I worked with I/O boards (about 10 years ago...), Data
Translation provided fairly good boards (www.datx.com).

National Instruments (www.ni.com) is also a good bet.

Drivers for C/C++ are usually bundled with the board, or available for
free download.


RTOS and microcontroller combination for simple application

Post by J. Franchi » Thu, 10 Nov 2005 09:00:16

actually, after some back and forth email with Data Translation, maybe
a USB digital I/O board isn't enough. Here's a better description of
what I need:

at least 8 channels of digital I/O
timing resolution of 10 microseconds or better
on-the-fly digital output changes based on digital input (easily
re-programmable via computer)

For example,
when channel 2 goes high, less than 10 microseconds later, five 100
microsecond long pulses at 100 Hz are generated on channel 4.

As a bonus, it'd be nice to have the device send back messages to the
host computer with time-stamped event data when the digital inputs

Since my timing requirements are so tight, I can't run it off of
windows to change the outputs based on the inputs. So the straight
digital I/O board option is out (most of them just read and write data
to the computer, I have yet to find one that can change the digital
output based on the input with no computer interaction).

I've been reading more about Hans and g9u5d suggested.
It appears the DLP-245PL USB-Microcontroller Development Board cannot
be reprogrammed via USB. If not reprogrammed, then is it possible to
burn in a program that will read messages with timing parameters from
the USB and use that to change the device's behavior?

Thanks again for helping, Everyone...

RTOS and microcontroller combination for simple application

Post by AntiSPAM_g » Fri, 11 Nov 2005 09:57:48

On 8 Nov 2005 16:00:16 -0800, "J. Franchino"

Most of the micro devices have EEProms built in, so you could even
store the parameters and reuse them after power cycling.

I worked on a dsPIC project that had a Visual Basic front end. The
communication was RS232, but its the same thing with FTDIchip' device.
The front-end allowed the program to be configured, For this
particular example it was a 3-phase simulator and I could change the
amplitude and frequency programmatically from the VB front-end.

You could reprogram the device via USB, but you'd have to include a
boot-loader and that probably more complicated that you want to get
into at this point.