The processor of the x0xb0x is an ATmega162 microcontroller. There is a great site called AVR Freaks which appears to be for all things AVR.
The datasheet for the ATmega162 is available Here: 2513S.pdf. In depth documentation is available here: doc2513.pdf
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
LED Latch | Rotary COM3 | Rotary 1 | Rotary 2 | Rotary 4 | Rotary 8 | Tempow SW A | Tempo SW B |
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
SPL Clock | SPL Out | SPL In | USB TX | USB RX | Switch Latch |
Port C is concerned with Note, Accent, Rest and Slide Data.
When its output is 0x00, the x0xb0x interprets that as a rest
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Accent | Slide | Note Data |
Port D is for Midi and Din messages
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
DIN Sync | Midi Out | Midi In |
2 | 1 | 0 |
Note Latch | Gate |
What follows is a summary of the technical spec of the AtMega162 microcontroller(uC) as taken from the datasheet. It's purpose is to layout the basic information needed to look at the x0x firmware from an atomic level, examining not just the program flow, but how the microcontroller actually executes the code. No knowledge of microcontrollers is assumed, but it is advised that one looks over the datasheet as it contains many useful tables and graphs of the architechure of the uC.
The AtMega162 is a high performance, low power 8-bit AVR uC which uses the efficient RISC architechure. It contains 16KByte of self programming flash program memory, 1KByte of SRAM and a 512 byte EEPROM. The AtMega162 is capable of a throughput of up to 16MIPS. The AtMege162 has a variety of peripheral features including 2 8-bit timer/counters 2 16-bit timer/counters and 6 PWM channels. For the execution of code the AtMega162 provides 32 8-bit working registers, all of which are connected to the Arithmetic Logic Unit. This allows two registers to be accesed in a single instruction cycle. The ALU can perform instructions on two registers or between a reister and a constant or simply on a single register. The status register provides information about the most recent Arithmetic operation. Program flow is provided by conditonal and unconditional jump and call instructions which can directly address the whole address space.
Now, that was very brief and there are a number of questions that are certain to be floating about.
The three types of memory are as follows:
eeprom.h
for functions that read and write to the EEPROM.The status register is an 8-bit register like the rest, however, each bit has it's own purpose. Below is a description of each.
* Bit 7: The Global Interrupt Enable Bit "I bit". This is responsible for enabling interupts on a global level. If this bit is not set, no interrupts will occur, reguardless of individual interupt settings. After each interupt this bit is cleared (set to 0) by the hardware and must be reset using RETI. CLI and SEI can be used to clear and set this bit manually.
*Bit 6: Bit Copy Storage "T bit". This bit provides a holding place for bit operations. Using BST and BLD a bit can be moved from a register into the T bit or moved from the T bit into a register.
*Bit 5: Half Carry Bit "H bit". This bit indicates a Half Carry and is useful in BCD operations. What is a BCD? Well, that'll have to wait a bit.. (bad pun intended..)
*Bit 4: Sign Bit "S bit". This bit is always a exclusive or of the Negative Flag (N bit) and the Two's Complement Overflow Flag (V Bit).
*Bit 3: Two's Complement Overflow Flag "V bit". This bit supports Two's Complement arithmetic. What is this? More to come..
*Bit 2: Negative Flag "N bit". This indicates a negative result
*Bit 1: Zero Flag "Z bit". This indicates a zero result.
*Bit 0: Carry Flag "C bit". This indicates a carry.