AVR For PIC People, Part 1: The Basics

The Functional Test

If everything’s gone smoothly, you now have a chip that’s programmed with your test firmware.  If you’re using a circuit similar to the one at the beginning of this article, you’ve probably noticed that there’s no external power supply connection.  Instead, the circuit is designed to be powered by the Bus Pirate.

It’s a really handy tool.

Since that’s what I built, all I had to do is tell the Bus Pirate to power on — but to do that, I need a serial terminal program.  On the Mac, the first option is to use screen as a terminal program:

$ screen /dev/tty.usbserial-AH00MPIC 115200

This will open a screen session pointed at the serial port at 115200 bps, allowing you access to the terminal device.  To exit, type CTRL-A CTRL-K and say yes when it asks you to confirm.  The downside here is that screen intercepts CTRL-A, which can be annoying at times. It also prevents your terminal window’s scrollback buffer from working properly.

Fortunately, I recently discovered an alternative, which is part of the UUCP software stack:

$ sudo cu -s 115200 -l /dev/tty.usbserial-AH00MPIC

This will “call up” the host attached to the specified serial port, operating in much the same manner as screen – except that it doesn’t intercept control characters, and it doesn’t mess with your terminal window’s scrollback buffer.  I find this to be eminently more workable than screen.

To exit, type “<enter>~.”.  There will be a brief delay, and then the program will exit.

To activate the power regulators on the Bus Pirate, the sequence looks like this:

pegasus:tiny13demo steve$ sudo cu -s 115200 -l /dev/tty.usbserial-AH00MPIC
Connected.

HiZ>m9
Ready
DIO>W
Power supplies ON
DIO>~.

Disconnected.
pegasus:tiny13demo steve$

And sure enough, we have blinkenlights!

About Steve

When it comes to the desktop, Steve is a former Amiga, Windows, and Linux user, and as of six years ago, a die-hard Mac head (who, for once, isn't thinking of changing platforms again any time soon). When it comes to the server, Linux is pretty much the only game he plays. He also enjoys hardware hacking, and shouldn't be allowed near a keyboard after the sun sets (or for that matter, after it rises. Don't say I didn't warn you).
This entry was posted in AVR, Hardware Hacking. Bookmark the permalink.

2 Responses to AVR For PIC People, Part 1: The Basics

  1. Daniel says:

    Thanks for this! I’ve been using microchip’s PICs a fair amount, and wanted to start trying AVRs to see if they might be more simple. This will be a nice starting point.

  2. Steve says:

    Um. This is a serious cliffhanger – or did Part2 get blown with the wind^Wfuse? Is there still hope?
    Thanks anyway for the nice introduction, as a late adopter I appreciate it a lot. Everyone else is using RasPis now, but AVRs are fun for someone who decades ago had to learn and write (mainframe) assembly code!

Comments are closed.