I'm newish to embedded work, and my last embedded project involved Javelin process and Java, which is a tame introduction. Now I need to move up to something faster and more flexible, but I've having as heck of a time getting information from vendors, who can smell a hobbyist, and have better things to do than answer their emails. I'm hoping someone here will be more tolerant of a newbie. I need advice; if I'm going to spend money, I have to get a successful result. I have a lot of questions.
I want to use PC104, because I'm trying to minimize the component count and hookup labor, and I need ethernet and 4 serial ports, with the possibility of someday adding more serial ports or USB. I also need at least 16 I/O pins: 4 of them analog out at 0-10v (to talk to a commercial dimmer), 2 of them analog at 0-~20v but accuracy is not a concern, the rest can be digital at TTL levels. I can always use more TTL I/O.
I priced PC104 periphials boards with DACs, and started seeing $200 and up. Since the analog outputs drive dimmers, I don't need very high accuracy, so I hit on the idea of using a fast interrupt rate and doing
1 bit PWM in software. I think I can go as low as 4k/sec with 8 bit overflow counters and still get a useful output for a dimmer.But then I was told that taking 4k interrupts/sec on a PC104 running at
133Mhz (AMD elan processor), AND trying to do ethernet connectivity and serial work, might be pushing it. And 4k/sec is about the slowest I can go if I want to avoid visible flicker from the dimmers at the dimmest rates. So now I'm worried about this approach. So my first question is whether I need to splash out on a DAC board and how that can be done cheaply. Cheap is the watchword for this projectThe next is about the OS and toolchain. After pricing a few options and coming away in shock at what people charge for development environments, I'm leaning towards DOS and the free Digital Mars C++ compiler. I figure DOS on a PC104 has to be about as tried and true as it gets. Unfortunately, my first day out the the Digital Mars compiler, I hit a compiler bug, and I'm wondering if I should use something else. Open Watcom proved to be pretty unstable (the tools kept hanging, and I wasn't completely happy with the code generation - it was using obscene and unwarranted amounts of stack space.) Am I better off with something other than DOS? I priced some commercial products and they are out of the question. I looked at linux, but I'd have to write device drivers to get to the I/O ports and interrupts, and I'd rather not.
I need a simple audio output, and I would have liked it to be polyphonic, so I was considering doing more PWM during my 4k interrupts. (The tones I want to play can all be between 220Hz and
880Hz and I can pick them as I please). But if 4k/sec is unreasonable, I'm willing to settle (unhappily) with monophonic tones and reprogramming timer 2 (the PC104 has an output pin tied to timer 2, so it has the advantage of being simple.)That leads to the question about timer 0. I remember from my DOS days that reprogramming timer 0 is everyone's favorite trick, except it can mess up the floppy drive, which uses the 55ms ticks to time things. The PC104 I'm looking at reads a flash card, not a floppy, so I assume I can take over int08 and lose nothing but DOS's daytime clock (which I don't need). Is this safe? Most of the interrupts will just do a few instructions of calculations for the PWM, but every 64th would branch off into a few hundred instructions. I don't really worry about how slowly my main loop runs - even if the processer was 75% dedicated to the interrupt code, that's enough, but I worry alot about delaying other interrupts and missing ethernet traffic. Is that a concern?
DOS doesn't come with a TCP stack, and I need both TCP and UDP, nonblocking. What's good? I'm willing to spend some money on a small, stable stack, because I remember from decades ago what unstable stacks were like.
Finally - memory. My app is mostly written, and it looks like it's about 330k or so. But it will grow over time. I need 32 bit integers. I assume I want DOS32 and extenders for this because the code could grow; but I've never mixed interrupts and extenders before. Are there any special caveats?
I apologise for the ignorance. My strength is in coding, and I can write very tight, fast C++ and assembler code, but I'm used to professional tool chains and detailed documentation, and this is a project that has neither. Plus I can't afford to buy hardware and then find out my approach is simply not going to work. I'm looking for simple, tried and true. My preference is always for doing things in software - I have high levels of confidence in my software ability, but low levels when it comes to hardware.
If someone has been down this path, I would deeply appreciate guidance. Thanks.