Microcontrollers

Computers and stuff like that

Microcontrollers

Postby Doug Coulter » Mon Jul 19, 2010 2:11 pm

I have used most of the micro controllers and DSPs on the market, and I have to say that the experiences have led me to use Microchip's PIC series where they will fit the job at hand. I've got some reasons for this, of course. One is that they are cheap and easy to use -- they have some fairly fantastic on-chip I/O hardware that makes doing the things you do in an embedded control project easy -- the extra parts needed for a lot of things are pretty minimal in a lot of cases. They are fast as these things go. Microchip is also reliable -- when they bring out a new improved part, they continue to supply the old one for a long time, and further, make it easy to migrate. This might be why they have sold more processors than all other brands combined -- true. You probably have quite a few already, as they go into lamp dimmers, remotes, consumer electronics of all kinds and so on. There's one in my bread maker too. You can now get these with nifty things like built in USB and Ethernet interfaces, and even the eval boards are cheap enough to use in some projects. Ehternet versions give you a server that is platform independent out on your network that can be used for data acquisition and controls pretty cheaply.

The very basic software tools are free from Microchip, but if you want to work in C, you'll have to buy a compiler from somewhere. I'd advise against the Microchip one -- they are past their expertise level in the one I tried -- it was so bad I wanted my money back, actually, perhaps it has improved since. I'd say "avoid".

Here, we use CCS for the 18F series especially -- it's the best there is, no question for them. They provide a lot of nice drivers and example code you can reuse as well.
Some of the CCS stuff also runs in linux for programming the parts. Nice. Their IDE is fine, but hard to get running under Wine, however.

For the 16 series, and especially if you want to easily mix assembly and C with a real linker, HiTech is the (expensive) way to go. Their 18x compiler doesn't make as good code for the chips as the CCS one does, however, not even close. If I were stuck with just one tool setup, it'd probably be CCS.

Here is a link to a project we did here that uses a PIC and makes it easier for others to incorporate into things -- just add 5v and code! We are using these here in our science lab as data acquisition front ends, for counting counters, recording tank pressure, high voltage and so forth.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Microcontrollers

Postby Starfire » Thu Sep 02, 2010 1:55 pm

You can get free sample parts from Microchip - some very interesting devices now available. A complete development system such as the PIC-Kit 2 has a lot of power and runs of the USB with MLAB and is cheap.
Starfire
 
Posts: 143
Joined: Thu Aug 05, 2010 4:26 pm
Location: North Ireland

Re: Microcontrollers

Postby Doug Coulter » Thu Sep 02, 2010 2:35 pm

I like these chips and often the eval boards for a number of reasons. The price is right for one, they support chips "forever" so your designs don't get invalidated so quick, and of course, I have this rather large library of already written code for them that is easy to transport from one chip to another, as it's nearly all pure C (including the little opsys I wrote for realtime applications).
There's this other little fact -- there are more PICS in existence than any other processor line -- for that matter, more than all others combined. Gotta be a reason for that one. Could just be due to the long life, but it's telling to me that even Intel hasn't sold more chips (including the little cheap ones) than Microchip has.

They also have a dev board over at CCS that has ethernet, a filesystem for SD cards, a web/ftp server -- and the usual nice PIC hardware pins left over to do a/d, PWM, count and time, you name it. Last one I bought was ~$70 -- not so bad. This potentially is completely platform independent so it doesn't matter what you run on the rest of your network (I'm a linux guy now).

The only USB device I've had great luck with so far on linux is the LabJack -- they wrote a good driver you can link to with your code, it works, simple and easy. I'm going to have to take that apart and look inside, because the rest is so PIC-like I suspect that's what I will find in there.

We have used various toolchains over the years, as we or customers dictated. HiTech has a C compiler, but for the 18x series, they fell off a cliff (but their prices went the other direction). They had the best one for the 16x series by far, and a nice linker and assembler as well, making pushing those to the limit easy. CCS used to stink -- but their new stuff is another world, and is now probably the best, but still no good linker for asm modules into a mostly C project (you can get that done other ways, though). CCS gives you a lot of hardware drivers for things commonly hooked up to PICs, some not as good as the one's we've written, but it saves a ton of time getting things going regardless. We also tried microchip's own compiler, but it was a total waste of time and money (then) -- so bad we wanted our money back, a joke. Interrupts? No. Multithreading? No - uses the same temps for all internal work. Beginner level errors.
Go figure how they make such good hardware and mess up software that badly.

Anyone who needs some help with these, let me know - we have a lot of nice code we can share, and have probably been there and done that with these. My last high paying job was redesigning an entire large product line to use PIC's instead of older 80x and 65x cpus and microcontrollers, all real time, even some DSP worked in.

What we never liked was the "too easy" eval boards from others. Rabbit locks you into their idea of an opsys, built right into the compiler -- and their FTP server when we used them didn't even support filenames! If you don't like it, that's tough, and they are kind of a one trick pony and may not survive the markets. Basic stamps? Not for anything real and darn high price for performance. And so on. Sometimes making it too easy means they simply locked you out from doing something sufficiently complex to be useful for you. PICS are more of a blank slate for you to write on. A little more learning to get going (Oh, I have to initialize a serial port before printf works?)-- but way worth it, to me anyway. We are using them here around the fusor a lot.
They make nice time-accurate buffering front ends for PC based data acquisition and are stone reliable. Cheap to replace if you fry one -- try that with some commercial "easy" product.

I should add that their idea of backward compatibility means that with the same board layout we used in the "log/moth" project, we can now substitute newer models with no other changes than some new software to take advantage of the new features. I really like that one.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Microcontrollers

Postby William A Washburn » Sun Dec 12, 2010 7:58 pm

I like the MSP430 series by TI. They are 16-bit and run off a watch crystal (32kHz) and draw almost no current until
one of their interrupt lines is activated. At this point they switch to an 8 Mhz crystal and start executing your program
until its function is completed then it goes back to sleep. Olimex [http://www.olimex.com/dev/] makes a lot of dev boards.
CrossWorks [http://www.rowley.co.uk/msp430/index.htm] makes an excelent software development environment.
The last time I used one was a few years back to build a controller-readout for my DDS board:
Attachments
VFO_chip.jpg
DDS Chip
DDS_Driver_Board_2.jpg
DDS Driver Board
SDRVFO.jpg
DDS Synth Board
Last edited by William A Washburn on Thu Dec 16, 2010 5:21 am, edited 2 times in total.
User avatar
William A Washburn
 
Posts: 93
Joined: Fri Oct 15, 2010 8:12 am

Re: Microcontrollers

Postby Doug Coulter » Mon Dec 13, 2010 10:32 am

That's got to be just about the only one of the Ti chips I've not played with. I had a close relation with Ti, and used most of their DSP chips when real horsepower was needed in a design, preferring them to ADI and other possibilities. Keith Larson and I helped promote the "DSK" series of inexpensive DSP starter kits -- normally to use a Ti part you'd have to pay in the region of $10k for the toolchain (which we both thought was very shortsighted and stupid), so this line came with at least a free assembler/linker.

I touted the PIC line to them all the time (Microchip was a second source for the tms320c10 already) -- Ti at the time didn't have anything close to a system on chip, and as far as I know, they never "got it". What they did do was pick up the msp-430 in a buy of the company that developed it, and have since promoted it heavily. The thing was designed for and got a lot of traction in, smart power meters, and was a success. Keith was really hung up on that printer port interface, which became harder and harder to make work as windows "security" advanced, he was a pure old school dos guy. At the time, his focus was mainly on using Ti's bigger stuff as coprocessors to the then-slow intel PC's, and that was the cheapest way to get some comm bandwidth with it -- particularly as most Ti chips lacked the ability to do serial at all...they were computers, not microcontrollers. Back in the day, there wasn't flash or even eeprom in most Ti chips, it was early days. So a minimal working system still had a ton of extra parts compared to a PIC that only needed an RC at most, and you had a machine. Now you don't even need that, just a power supply.

And nowadays, note my log board, that puts more functionality in every area into the footprint of a 40 pin dip for less money...The pics have nanowatt power standby modes also, it's a big deal with them. The one mistake I made on that design was not using a pic pin to power the 232 chip, else that board would go to microamp and below standby levels. What is interesting is that while that chip was fairly expensive ($10) at the time, it's now cheaper, but also newer PICS with more "stuff" will go right on that same PCB layout and fly, no redesign needed, just better capabilities. The smaller you are, the more that NRE hurts.

Once my business relationship with Ti was over (my customers left the company), I didn't get free tools anymore, and in my mind, there was no particular reason to pay extra to use this particular chip, since I was doing so well designing pics into products for other customers. Keith has left Ti, as has Brian Smith, to run a company Brian and I started, C&S audio that designs and sells audio test equipment and speaker drivers -- from the magnetics up.

One issue I've had with Ti (not just them), which is unlikely to manifest with this chip, is that they have no where near the backwards customer loyalty of other companies. In other words, if a line becomes unprofitable, or just not profitable enough, they'll quit making the part in a heartbeat, and strand anyone who designed it into product with no place to go except a full redesign -- they seem to assign packages and pinouts with a random number generator. Since this chip is popular, they probably wont' do that. Microchip still supplies parts back almost to their beginning, and/or parts that have the same pinouts and are compatible at the re-compile level...that's a big deal for some of my old customers, who got stuck in designs where you couldn't get the same CPU anymore and had to pay me to create designs that had longer lifetimes for parts availability.

That said, the msp 430 is probably a pretty good chip, I dimly recall looking at the architecture at their prompting and finding it decent, but for what I was doing, still not the right thing.
It's just that nothing I've yet seen is a close match for the very good built in peripherals in the PIC series, and requires a lot more parts to get to the same place functionally. I don't think the PICS are perfect or anything, just very good, and we've used them to replace scads of more expensive and complex designs at huge savings for medium-high volume manufacturers.
Microchip has also been a customer of my consulting outfit, we helped them with the DSPic in some small ways, though I myself have never used one. I tend to stick to the smaller stuff as logic replacement and controllers. For DSP kinds of things, Ti's tms320c30 line is my favorite, but is only still available because of a military contract -- it's used in smart missiles. We used it to do the only "other" credible voice over IP design other than the one TI-Telogy was pushing at the start of that. They wanted so much money (and ongoing contracts) to use their two CPU design that our telecom customer preferred to pay us to do it from scratch on one CPU. Then and now, no one believed that one could do that -- a TCP-IP stack and real digital signal processing in one chip. The 'C30 did it with plenty to spare, and some features that are still advanced over most of the existing designs, like handling out of order packets and lost packets very gracefully.
Our design never did that annoying ssst-zzt-sssst-zzzzzsssttt crap when data wasn't available (like you hear on the radio when a downlink fails), for example. As far as I know, the design is still in use for inhouse IP telephony and background music and paging distribution. It had the nice feature of using UDP for data but the more reliable TCP for call setup and teardown, which SIP and some other standards don't -- in other words, it never dropped calls. Compare that to a "modern" cell phone.

So I use Ti when I need the big stuff, it's a dream to program in any language, but just never quite got into the msp-430 (which strictly speaking, isn't a Ti thing).
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Microcontrollers

Postby William A Washburn » Mon Dec 13, 2010 11:10 am

I've almost always used PICs too. However, the calculations for this DDS chip I was working with
required 16-bits. At the time (5 years back or more) PIC had no 16-bit processors. That's when
I met the guy who was writing CrossWorks and found out about olimex. I got a free sovtware
dev environment for 430s and a cheap Olimex dev board along with a J-TAG connector to the
computer. The thing I liked about CrossWorks is that it took source as "C" and would emulate
internally or run the processor on the Olimex board (single step or real time) however you wished.
BTW, The project and photo is of a DDS project not DSP. The DDS formula for the tuning word
was huge and the 8-bit device wouldn't do it. Ive got to get anita to get a photo of the Olimex
board, rotary encoder and digital readout that drives the DDS board in the post. I'd still bet
on MSP plus CrossWorks because of its ease to work with. Give it a shot sometime. The
price differential is not that bad. Get a low-end Olimex board, J-TAG cable and buy the single
user of Cross works dev environment. I think you'll see what I mean.
User avatar
William A Washburn
 
Posts: 93
Joined: Fri Oct 15, 2010 8:12 am

Re: Microcontrollers

Postby Doug Coulter » Mon Dec 13, 2010 1:04 pm

Even 8 bit pics do floating point (emulated). Just a matter of speed -- 16 bit is very fast on them, and easy even in assembly language, much less in C. I probably won't branch out to the older 430 anytime soon, as I have so much time invested in PICs -- literally megs of code written that I'll never have to write again for things in that performance class. Of course, I'm watching all the time for new things that are great, but not seeing anything that I need that is super cool just now. Glad to hear Ti got JTAG working, finally - it was truly a dog back in the day.

Too bad C isn't all that portable in the uP world -- too many special things about each CPU and different approaches to that by vendors. But it's usually not the end of the world to have to port over to a new thing, just kind of laborious (how do I do that same thing over here?).


As virtually 100% of what I do is hard-real-time, interrupt driven and multithreaded, debuggers as shipped with any toolset are completely and laughably useless to me -- including on the PC itself where you'd think they'd have handled those issues perhaps. Single stepping a multi-threaded interrupt driven situation just doesn't work, and by the time you get to a break point and see what happened -- 10 more things have happened which are just as likely to take you off course as to help -- input buffers have overflowed due to the break point even if they were fine before, output buffers have emptied, motors are still spinning and location counters overflowing, stuff like that. So in general I've rolled my own tools for that which don't require halting the CPU, because anything the does that is useless past the most basic "getting the thing to boot and initialize" stage (which of course, IS the hardest part on a new family usually). Since I've always got some kind of comm link to the uP going, I just stream status out over that as the thing runs -- far more useful.

This could all be due to my sort of unique experience in having written a bunch of opsys for these kinds of things, and having hammered out the process to get them up in a new one step by step.

Yes, the debuggers are useful if you just can't seem to get the thing to come up and turn on a port bit connected to a led, but after that point, well, I know how to write code pretty well with experience since the '60's, since before chip CPUs (and the C language for that matter -- ). It's only in the last decade or so that C was even usable on uP's -- it was available, but they were so wimpy you couldn't afford the extra overhead a HLL involves. For my customers, having to use the next larger CPU meant millions of bucks a year falling on the floor -- so we had to squeeze out every bit of performance per dollar you could get, and they paid us highly to do it. Nowadays, they just waste it and don't care. My mass spectrometer has windows running inside it (you must be kidding, all the real work is done on a PC anyway) so they can use DCOM remote to communicate because their programmers can't handle doing it right and don't care about waste -- it's a low volume product anyway, and these high paid code monkeys can't work outside a development environment that is WYSIWIG and drag-drop, most can't code their way out of a paper bag. So they are unlikely to hire me to write them software that would save them over $100 a unit on hardware alone, or make their PC end code faster and more reliable -- they don't care, captive audience and all that. But for the customers I've worked with, yeah, a million bucks a year savings (and more) was easily enough to justify paying me similar money once to get there.

I wrote on this in my book at length. Code that makes people say "wow, I didn't know my computer could do this" is huge in gathering market share no matter the market. As is reliability, so you'd think MS would have learned by now, but they are still tied to the idea that if you can make it simple enough (waste be damned, they aren't paying for the hardware their junk requires) then more people will flock to their platform. Seems to be going the other way just now, however. I've personally helped a couple large companies migrate off windows in the last few years, and they are doing well, little further support required, and saving tons of money on both soft and hardware. It only amounts to a few thousands of computers, but MS has got to be running a little scared at this point (they are, too -- telling lies and shoveling money to people to sue all competitors just to hold them back, baseless suits for no other reason than to be anti-competitive).

The thing about making it easy for idiots to code is you get idiots coding...oops. You still have to know how the libraries work internally to do a good job, you really can't skip that step as all the HLL guys would like to believe. Else you fall prey to changes in them, bugs, and using them very inefficiently. This is maybe OK kind of, in PC app land, where you don't have to pay for the hardware as the coder, but for the customer it's still a drag to have a simple app hog the entire machine. For example, the java app I use to trade stock markets will barely even run on a 1 ghz pentium with a gig of ram -- and will die if you want to add notepad or something to the mix). It saved *them* money as they didn't need as smart a programmer, but not me! So I'm doing this (and that) on what would have been a supercomputer just a couple years back. What a waste! Nearly all of what this computer is doing now could have been down on a Kaypro with a 6 mhz z-80 with good code! Wouldn't have looked as nice, but....really, I now have multiple GHZ cores in the main CPU and 100's of cores in the graphics, and this is it?

BTW, for DDS, I'm having fun with a cheap unit I got recently, a Hantek DDS-3x25 that for all the world looks like they used some parts from a VGA board and a pic...it's really nice, arbitrary waveforms, and speeds to 25 mhz for complex waves, 40 something for sines, at good distortion/jitter numbers. You can stack them and have them in sync in various ways. I plan to use it to generate some fancy signals for my fusor/ion traps. Not bad for about $150. I use a nice ten-tec rx320 synth rcvr by the way, and they do those calx either on the PC or as a side issue in the very small DSP they have on there that does the IF strip and detector functions. Nice little radio. I meant to get in there and program it to do a Costas loop and stereo sidebands, but the ADI cpu they used was close to running out of steam doing what it was tasked with already, and I didn't have time to roll a new one from scratch. In either case, the math for that is pretty doggone simple (lots of basic algebra, but still simple), even a 4004 could do it for most purposes that weren't frequency hopping and/or couldn't use table lookup for that.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Microcontrollers

Postby William A Washburn » Mon Dec 13, 2010 6:23 pm

Doug,

Looks like you've been around the horn programming different hardware. You are correct, however, Easy to use dev environments can generate
tons of horrible code since it's so ease to write (been there). Best for me is to get a pencil and pad and just sit back for a couple of days and
the outcome is much better. Not much replaces thinking first/programming last.

BTW...just spent $5.00 & bought one of these]https://estore.ti.com/MSP-EXP430G2-MSP430-LaunchPad-Value-Line-Development-kit-P2031.aspx[.

Thought I'd see where the 430 is now

Bill
User avatar
William A Washburn
 
Posts: 93
Joined: Fri Oct 15, 2010 8:12 am

Re: Microcontrollers

Postby Jerry » Tue Dec 14, 2010 2:52 am

Here's a little board that was waiting on my doorstep when I got home. Its Renesas development kit for this contest:

http://www.renesasrulz.com/community/rx-contest

Its got all sorts of goodies on board!

Oh yeah, it was free.

Image
Renesas Development Board by macona, on Flickr
Jerry
 
Posts: 573
Joined: Sun Jul 18, 2010 12:07 am
Location: Beaverton, OR

Re: Microcontrollers

Postby William A Washburn » Tue Dec 14, 2010 9:59 am

Jerry,
It looks like you have your hands full here I/O, LCD, Input SPST and God know's what else (maybe A/D, D/A & DSP).

I used to get a lot of parts from these folks but never tried their uPs. I was more interested in the RF parts, PLLs,
amps and then the DDS chips when they came out.

Good luck and keep us all up to date, Bill Washburn
User avatar
William A Washburn
 
Posts: 93
Joined: Fri Oct 15, 2010 8:12 am

Next

Return to Digital

Who is online

Users browsing this forum: No registered users and 3 guests

cron