very new to embedded programming - can you look at my code for an AVR?

From: Michael Noone (mnoone.uiuc.edu_at_127.0.0.1)
Date: 11/29/04


Date: Mon, 29 Nov 2004 07:14:05 GMT

Hi - I'm attempting to program an AVR so that through a computer
(through the serial port) one can easily control how fast it turns on
and turns off a single pin. This actually has a use (it will be used by
a grad student doing some research in nano EDM [electro discharge
machining]). I haven't been able to test it, so I don't have the
slightest clue if it works or not.

Essentially the entire design of it is that when you first turn on the
AVR, it initializes a couple basic things (enables timers, sets portc as
an output, initializes the stack, etc.) and then it waits for a command
from the serial port, analyzes it, and uses it to set the parameters of
the timer and to enable/disable all interrupts (thus enabling/disabling
the timer ISRs). The computer attached can also request certain
parameters if needs be.

It's written in lovely AVR assembler by yours truly. The only thing I
was able to test was the timer part of the code, as I could simulate
that with AVR Studio. (though strangely enough I think I found a couple
bugs with AVR Studio 4, as sometimes it would behave differently than
other times - even though I hadn't changed anything...)

The code between the computer and the AVR is fairly simple. Each message
is one byte long. If it's a command, the first set of 4 bits is the
command, the second set of 4 bits is the parameter (or 0x0 if it doesn't
need a parameter). Before a second byte can be sent (say when sending
the high and then low byte of one of the timer compares) the receiver
(AVR/computer) must give the transmitter (computer/AVR) permission. This
was done as the UART on the AT90S8515 can only hold one byte at a time.
I may move this code to a different avr eventually - but the AT90S8515
is the only AVR I've ever worked with, so I decided to go with it, even
though it's discontinued.

Anyways - the serial communication part of the code is 100% untested so
I'm not even sure if any of it works. All I know is that it compiles ok
:)

Most of the code is commented. The stuff that isn't is mostly redundant
stuff that I thought was fairly self explanatory.

Sorry for writing so much - I gotta work on that! Here's the assembler
file, let me know if you have trouble downloading it:

https://netfiles.uiuc.edu/mnoone/www/AT90S8515-serial-controlled-
oscillations.asm

Thanks!

-Michael Noone



Relevant Pages

  • Re: =?ISO-8859-1?Q?Frequenzz=E4hler_mit_?= =?ISO-8859-1?Q?Offset_gesucht?=
    ... Vorzeiler und den Timer ein wenig anpassen. ... (AVR) ... Damit sollte es wohl hinhauen, ...
    (de.sci.electronics)
  • Re: =?ISO-8859-1?Q?Frequenzz=E4hler_mit_Offset_gesucht?=
    ... Vorzeiler und den Timer ein wenig anpassen. ... (AVR) ... Gruß Jan Conrads ...
    (de.sci.electronics)
  • Re: Using Forth at work
    ... It will have a serial port to talk to the outside world and a few accessories such as a keypad, an LCD and a second serial port to connect to a GPS receiver. ... tools that are a lot more expensive then Forth AVR tools such as SwiftX. ... re-write the program in its assembler and test it. ...
    (comp.lang.forth)
  • Re: help needed
    ... the ARM for the Atmel series is nothing like the AVR series... ... Serial port works differently but, significant improvements mean you will need to throw away any code you have for AVR serial ports. ... The different processor modes may throw you a bit. ... you almost need to throw away most of the stuff you already know about the AVR series to understand the ARM series and appeciate the differences. ...
    (comp.sys.arm)