I've programmed on a lot of other micro-controllers (starting with the 6502 and 6802) in various languages (asm, BASIC and C), but I don't do this professionally.
I'm using a mega128 board (the xTW board below) to translate X10 TW523 interface (TTL serial SYNC bit stream data) to Insteon (RS232 via an Insteon PLM or Insteon PLC). Technically I could do UPB, Z-Wave or any other Home Automation protocol also. So far I'm through the pin assignment and Pseudo code stage. I'm now writing code to test what I think something is supposed to do (like generate an interrupt every 120th of a second and toggle a gpio bit).
This is my first time dealing with an AVR so I have some learning to do (sort of the main point of choosing the AVR). The reason for the Mega128 was the need for two serial ports and the 128K of flash may be necessary but still use an 8 bit processor.
I have a number of interrupts that I need to deal with. One is a timer to generate the 50/60 Hz zero crossing pulse to the TW523, another is a 1 ms timer for the uC Rx pulse to the TW523, another is the TW523 uC Tx pin (interrupt on change), EEPROM handling and finally there is the PLM RS232 receive interrupt. I've enclosed a high level function diagram:
X10 Insteon Insteon or Raw API X10 PLC Cmd -----+ +-----+ +-----+ Zc|<----| |---->|Rx | uC Tx|---->| xTW | | PLM |---< AC > Rx|<----| |<----|Tx | -----+ +-+-+-+ +-+-+-+ ^ \ \_[gnd]_/ / ^ | \__[12v]__/ | | | | TW523 | \ Replacement / ---------v--------- xTW
In the end I may end up with more things that can cause interrupts but for now it's just this (I'm still working out those details).
My first concern is that I may not know what I'm asking for (I haven't given it my full thought yet). My main concern is interrupt priority and/or dealing with an interrupt while in another interrupt handler. At this moment I haven't given a priority to any interrupts but I have an idea of what I want. Is there some text, howto or posting that describe interrupt priority/interrupt-in-interrupt handling on the AVR? In the past my projects have not been so interrupt intensive.
My main loop will be dealing with the buffered data from the interrupts, translating from X10 to Insteon (or vise-versa) or preparing data (buffering) for output.
In the end this should end up as an article in Circuit Cellar magazine (if they accept it) and may be Open Source software (the Insteon portion of the code may be an issue).