Tag Archives: AVR

DottyMatrix: a simple solution?

The DottyMatrix project began when I thought, ‘It would be nice to make use of my old Epson MX-80 F/T III dot matrix printer’. The problem was talking to it. But then I thought, ‘It’s just parallel printer interface. I’ll make a microcontroller-based device to act as an interface. How hard can that be?’. The answer, it turns out, is… Read more »

DottyMatrix and Virtual Printer – together at last

It’s great when a plan comes together. Having independently played around with my DottyMatrix serial-to-parallel printer interface and the Virtual Printer (designed to simulate my still-dead Epson MX-80 F/T III dot matrix printer), it was time to hook them together. And it worked! On the left is the DottyMatrix using my prototyping board for the ATMEGA328PB microcontroller. Its serial port… Read more »

Virtual printer & more fun with AVR interrupts

In building my AVR ATMEGA328P-based ‘virtual parallel printer‘, there were two signals that required special treatment. So it was time to revisit interrupts. On a Centronics-style parallel port, the host machine sends an ‘init’ or reset signal to the printer to tell it to flush its buffers and set itself to the default state. It also sends a ‘strobe’ signal… Read more »

Building a virtual parallel printer

Here’s a tip for anyone building a device designed to interface with a parallel printer – you kind of need a parallel printer to test it on. That shouldn’t have been a problem. My DottyMatrix project – which will allow me to send data over a serial connection and have it printed on my Epson MX-80 F/T III dot matrix… Read more »

Making tools #2

      No Comments on Making tools #2

Some time ago, I wrote about how I’d hacked together a board to program and experiment with AVR ATMEGA328P microcontrollers. Well, now I’ve stepped things up a bit. Mk.II The key features of the old board were a ‘zero insertion force’ (ZIF) socket for the microcontroller chip and a 2×3 HE10 socket to take the ISP cable from my programmer… Read more »

AVR basics: using the I2C bus #5 – final thoughts

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts The I2C bus isn’t that hard to use and for most applications it’s pretty simple. However, there is a lot more depth to it than we’ve covered here. The purpose of this final post in the… Read more »

AVR basics: using the I2C bus #4 – receiving data

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts This builds on the previous two posts that dealt with the fundamentals of sending data over the I2C bus on AVR microcontrollers and then how you actually do it. Receiving is a similar process, except for… Read more »

AVR basics: using the I2C bus #3 – sending data

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts In part 2 we looked at the fundamentals of how data is transmitted over the I2C bus. Now let’s actually do it. And, as usual with AVR microcontroller stuff, it’s all about registers. As before, our… Read more »

AVR basics: using the I2C bus #2 – transmitting

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts So in the first post in this series, we looked at how to configure the bus speed for I2C. Now we’ve got that out of the way, let’s start sending stuff over the bus. The I2C… Read more »

AVR basics: SPI on the ATMEGA – Part 2

In Part 1 we got the SPI bus set up on an AVR ATMEGA328P microcontroller. Now let’s start using it. Settings pins Before we get going, we need to set up the pins for the SPI bus on the AVR (which we’re using in master mode). I’m using the ATMEGA328P here, so I’m going to define some macros to make… Read more »

AVR basics: SPI on the ATMEGA – Part 1

When it comes to getting devices to talk to each other you’re spoiled for choice. There’s good, old-fashioned serial via UARTs, I2C (which I like a lot) and what is rapidly becoming my new favourite, the Serial Peripheral Interface (SPI). So let’s take a look at that. [Quick side note: please remember I don’t claim to be an expert. I’m… Read more »

Do you know what your code’s doing?

It seems like an obvious point, but it’s sometimes handy to know what your code is up to. If you normally write code for desktop systems – and especially if you’re hacking out something that works on the command line – then it’s easy. Just pepper your program with print statements to show the state of play. (Then try to… Read more »

AVR: Battling bizarre bugs

      1 Comment on AVR: Battling bizarre bugs

Do you ever get the feeling that a compiler is acting weird just to mess with your head? That’s how it felt yesterday. I was tinkering with the code for my HexMonitor. This uses an ATMEGA328P microcontroller to read values in from an eight-bit data bus or a 16-bit address bus (selectable via a switch) and display them on a… Read more »

Debugging AVR ATMEGA code with Atmel Studio and ICE

One of the more challenging aspects of writing code for microcontrollers is not being able to liberally sprinkle your code with PRINT statements to show the state of variables and whatnot at particular moments. If you’re working with Arduino-type devices you can always fire up the Serial library and print stuff that way – back down the wire to a… Read more »

AVR basics: reading and writing GPIO pins

Once you’ve set up a pin, or a whole port’s worth of pins, as inputs or outputs, it’s time to start writing and reading values. This series is part of my learning process and I hope it will help others who, like me, are embarking on projects such as programming AVR chips. The way I learn things is to write… Read more »