Chapter 6. Hello AVR
In this chapter, we will design a project that will send the text “Hello World!” through the microcontroller on the Mojo to the USB port and onto your computer. Doing this in hardware is not a trivial project requiring only a few lines. However, it will demonstrate many useful techniques such as read-only memory (ROM) and finite-state machines (FSMs). ROMs provides a simple way to store a large number of constants, and FSMs allow you to control tasks that require sequential steps. We will also dive into using block random access memory (RAM) to save your name as you type it and send it back in a personalized greeting.
The AVR Interface
In this example, we are going to make a new project based on the AVR Interface example project because it has the interface to the AVR already set up for us.
Create a new project based on the AVR Interface example project and open mojo_top.luc. The starter code for this is similar to before except it already has the avr_interface
component instantiated and hooked up in the always
block.
The avr_interface
module deals with talking to the AVR (the microcontroller on the Mojo) and allows you to easily send and receive data through the USB port, as well as read analog values from the analog pins. In this tutorial, we are going to be using only the USB port.
Look in the always
block and find the following lines:
// unused serial port avr.tx_data = 8hxx; // don't care avr.new_tx_data = 0; // no data
Here avr.tx_data
is the byte ...
Get Learning FPGAs now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.