![]() ![]() |
HC08 Page - When I first created this page, there was very little information available even on Motorola's site about the HC08 microcontroller. For a good two years I had the astonishing and dubious honor of being number two on a google search for "HC08". I've since dropped way down in the ratings, though still on the first Google page last time I checked. See links at bottom for other (and better) sources of information. Below I have some example source code in assembly to do some real basic things, and one example in C to do something not so basic. All the sample code below was written for the HC908GP32, but it ports well to any flavor of the HC08 since they pretty much all have at least 1 16 bit timer, an A/D module, etc. I have used the QT family (8 and 16 pin parts) for smaller apps. The JB series has excellent USB support built into hardware. I recommend use of the JB8 for simple (low speed) USB apps. Imagecraft sells a USB Starter kit/dev board with all C language software needed and a Windows GUI app that is easily adapted to your needs. You'll need a compiler/assembler and programming tool. A company called P and E micro provides this software as a free download at their site: (update: no longer free, one of the reasons I went with Atmel micros for the DARC Board design. Check out Metrowerks C compiler/assembler reviewed at bottom of this page) Click on "Motorola MC68HC08 Software/Docs" then the link for "download ICS software packages", register at bottom of the next page, and then on the next page select the software tools needed for whatever package you will be using. This exe file will install the software tool suite from P and E micro including as assembler, simulator, and in circuit debugger. The programming software is downloaded from that same page at top "Interactive Programmer". See a doc I have linked to below for bringing up this programming software and how to build an programmer. I have done 2 layouts of botboards using the HC08.Shown here is Rev2 of my HC08 Botboard. I did the layout for this board using expresspcb's free download layout software, and then sent them the output file to etch the board for me. Their special order gives you 3 copies of the same layout 2 1/2 x 3 3/4 board, 2 sided, plated through holes for $62 and in 2 days turnaround. Click here to see more info on my HC08 botboard.
Software examples: Below are some files in assembly for simple programs to run on the HC08. You will of course need an assembler program to compile (assemble) them.
Programming interface: Click here to see a simple schematic (somewhat rough) for how to build an in circuit programming interface for the HC08. Note that the ferrite beads (L3-L7) are not necessary, just useful in cutting down on noise. You can use this to program your microcontroller on its target circuit. No need to buy an expensive programmer. You can build it yourself for about $15 and use freeware to program it. This is a simplified schematic of a weather station using the HC08 designed by Will Beals. His schematic showed the entire circuit. My .jpg file has all but what you need for in circuit programming removed for simplicity. Click here to go to a site showing his entire design, including the full .pdf schematic and Bill of Materials (BOM). Bringing up the programmer the first time: The assembler output will be a .s19 file that you must program into the HC08 to get it to execute. You can use the P and E Micro HC08 Programmer freeware to do this. Getting that programmer to come up for the first time is tricky. Here is a document explaining how to get it working the first time. Motorola has a good app note on using the MON08 interface which is what I use in my docs here. Click here to see the app note AN2317. Other HC08 links: http://www.hc08.cz/index.htm - The small world of HC08. No kidding. Pretty good site with links to free software tools, etc. P and E micro - A third party software developer for Motorola. They have an excellent free programmer for the HC08 available on their site. http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=01624684497663 - The horse's mouth for documentation on the HC08 parts. Metrowerks Codewarrior C compiler and IDE - Freeware, so the price is right. It has the limitation of a 4KB output file with the "special edition". If you want to build a bigger file than that, it'll cost you $400 US or so. In the past I have busted on Metrowerks a bit. I've since revisited their tool set and it does have many advantages. Their use of the "user monitor mode" at first was frustrating for me but when I took the time to read the documentation I realized 'hey, this is pretty cool'. For one it gets you around the necessity of having a 9.8 MHz crystal to do in circuit debugging. Setting up your own program is a bit more complicated, but if you follow the steps they give you in the documentation you'll be okay. So now I'll say this is worth a look. The price of FREE is definitely good and the toolset -like the debugger for instance- is very powerful. With the processor expert you can write some advanced drivers pretty quickly with a GUI tool. Like any toolset, you have to spend some time learning it. Imagecraft - I like these guys' C compiler, the ICC08, the best. It's reasonably priced at $200, but still pricey. But any C compiler tool generally is I find. If you are about to drop money on a C compiler for the HC08 or any other micro like the Atmel AVR or TI MSP430 give these guys a look first. I used this compiler on several projects. Click here to see source code for my walker robot. P and E micro free download programmer - .exe file for the programming software
|