S-AVR » Simple Console

I was never much good at getting up in the morning, until I became a Relentless junkie. Set your alarm for 6:30am, drag yourself out of bed, wrestle with the overwhelming desire to lie down on the kitchen floor. Drink half a can before breakfast, and then you can S-AVR your Serial before the sun comes up.

Now is where the fun starts. With just a few lines of C you can make a simple console program to upload to your S-AVR, allowing you to communicate with your MCU using HyperTerminal (or an equivalent).

Download the code:

simpleconsole.tar.gz

Unpack it and run make flash to compile it and upload the code to your S-AVR. Now open HyperTerminal (or an equivalent). Go File->Properties and select the COM port that your S-AVR is connected to. Then click Configure and enter these details:

Now switch to the Settings tab, click ASCII Setup and enter these details:

Now go Call->Call and press the reset button on the S-AVR. You should see the console:

You can now set the data direction registers DDRA, DDRB, DDRC and DDRD from the console:

> da=ff
DDRA=0xFF
> db=00
DDRB=0x00
> dc=00
DDRC=0x00
> dd=00
DDRD=0x00
>

The effect of this is to configure port A as all outputs, and the other ports as inputs. You can now set the state of the port A outputs:

> pa=72
PORTA=0x72
>

The S-AVR:LED board now displays 0x72:

You can also read the state of each port. Try putting a resistor between +5v and PC7:

...and then reading the state of port C:

> ?pc
PORTC=0x80
>

I hope the implications of this are not lost on you. You now have complete remote-control of all the ports on the MCU. You can add more commands at will, allowing you to control what the MCU does from a CLI.


Leave a comment

You can use TWiki syntax in your comment