So about programming the AVR microcontrollers, Timothy S. Margush
So finishing up with:
Some assembly required : assembly language programming with the AVR microcontroller / Timothy S. Margush (2012 CRC Press)
CRC Press books are always good!
CRC part of Taylor Francis
taylorandfrancis.com/So I am going to try and capture all I want from the entire book, as it is complex and some does need this additional treatment.
so they talk about the Atmel ATmega16 microcontroller, shown in the traditional microprocessor through the hole package of a wide 40 pin DIP.
THey show their STK-500 Development Kit. It actually has a bunch of sockets, including the standard narrow DIP. These can take their PIC chips.
So lots of stuff can go into this $79 board, though presumably only one at a time.
Then they also talk about a much more powerful AVR, though still 8 bits. And it is surface mount and you use it on the AVR XPLAIN demo board. It has no sockets, though it has some other chips to make it all work. This board has USB and a special chip for that. Whereas the earlier board seems only to be RS-232.
Both have momentary contact buttons and LEDs.
To explain these they show you a Digital PDP8/E, to get across the idea of switches and lights.
www.i-programmer.info/images/stories/ComputerCreators/bell/pdp8e.jpgI remember using such, the switches and the magnetic memory cores.
Says these AVR processors run code from the Flash Memory. Not sure if this is always true. I would want to run most of it from the Static Ram most of the time.
So we have the Stack, as we have function calls. But we have dynamic memory allocation, and so we also have the Heap.
So want to revisit this complex but critical topic of Serial Data Communications.
DTE ( Data Terminal Equipment )
DCE ( Data Communications Equipment )
So a modem would be DCE, and then the terminal which connects to it is DTE.
So a Null Modem cable or adapter reverses some connections.
So it used to be 25 pin, and you had to reverse 3 different pairs. Could be a much more complex handshaking set up.
But with PC's and the PC-AT they went to 9 pins, commonly called DB-9, but more properly called DE-9.
So they call it the PC Signal Set, but more properly it is EIA/TIA-574
en.wikipedia.org/wiki/RS-232hardwarebook.info/Serial_%28PC_9%29So with DTE, pin 2 is transmit data, pin 3 is receive data. Pin 5 is ground.
With DCE, pins 2 and 3 are reversed, pin 5 stays the same.
So one way communications only needs ground and one other wire. Need ground and two other wires for 2 way communications.
So RS-232 needs both plus and minus 12 volts. The demo boards have a level shift chip to accommodate this.
So they call mark, usually draw high, as -12 volts. When the signal drops to +12 volts, the call this Space, and that first drop is Start, and this is when the PLL starts to lock up.
So then data bits can be between 4 and 9, and then one or more stop bits.
Usually using asynchronous, but if you want to use synchronous, you need to also send the clock. One will be master, one will be slave.
So now we are going to talk about Interrupts. There is a non-maskable interrupt. But on these AVR's, that is the same as Reset, and it can trigger on either edge change!
You can use interrupts to eliminate switch bounce.
Sieve of Eratosthenes
en.wikipedia.org/wiki/Sieve_of_EratosthenesWay to find all the prime numbers, up to a limit.
Has integer arithmetic, 32 bits. For floating point, only hardware support for single precision, 32 bits.
Talks about programming in C, and combining with Assembler. Their C does not have to link after, often.
Talks about AVR Studio 4
Here is AVR Studio 7
www.microchip.com/mplab/avr-support/atmel-studio-7Xplained boards
www.microchip.com/design-centers/8-bit/avr-mcus/get-started-nowThis is their high power pro board
www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATMEGA4809-XPRO$38.00 pro board