--- main.c~ Tue Sep 30 12:47:14 2003 +++ main.c Fri May 28 11:44:16 2004 @@ -14,11 +14,16 @@ * ****************************************************************************/ -#include // Note there is a bug in this file that includes iotiny22.h instead of iotiny26.h -#include +#include +#include +#include + +#define __disable_interrupt cli +#define __enable_interrupt sei + #include "USI_UART_config.h" -__C_task void main( void ) +int main( void ) { unsigned char myString[] = "\n\rYou just sent me: "; @@ -41,6 +46,6 @@ } USI_UART_Transmit_Byte( USI_UART_Receive_Byte() ); // Echo the received character } - __sleep(); // Sleep when waiting for next event + sleep_mode(); // Sleep when waiting for next event } } --- USI_UART.c~ Thu Oct 2 14:40:50 2003 +++ USI_UART.c Fri May 28 11:43:09 2004 @@ -17,8 +17,13 @@ * ****************************************************************************/ -#include // Note there is a bug in ioavr.h file that includes iotiny22.h instead of iotiny26.h. -#include +#include +#include +#include + +#define __disable_interrupt cli +#define __enable_interrupt sei + #include "USI_UART_config.h" @@ -32,7 +37,7 @@ #define USI_COUNTER_MAX_COUNT 16 #define USI_COUNTER_SEED_TRANSMIT (USI_COUNTER_MAX_COUNT - HALF_FRAME) #define INTERRUPT_STARTUP_DELAY (0x11 / TIMER_PRESCALER) -#define TIMER0_SEED (256 - ( (SYSTEM_CLOCK / BAUDRATE) / TIMER_PRESCALER )) +#define TIMER0_SEED (256 - ( (1UL * SYSTEM_CLOCK / BAUDRATE) / TIMER_PRESCALER )) #if ( (( (SYSTEM_CLOCK / BAUDRATE) / TIMER_PRESCALER ) * 3/2) > (256 - INTERRUPT_STARTUP_DELAY) ) #define INITIAL_TIMER0_SEED ( 256 - (( (SYSTEM_CLOCK / BAUDRATE) / TIMER_PRESCALER ) * 1/2) ) @@ -58,7 +63,7 @@ //********** Static Variables **********// -__no_init __regvar static unsigned char USI_UART_TxData @ 15; // Tells the compiler to store the byte to be transmitted in registry. +register unsigned char USI_UART_TxData asm("r2"); // Tells the compiler to store the byte to be transmitted in registry. static unsigned char UART_RxBuf[UART_RX_BUFFER_SIZE]; // UART buffers. Size is definable in the header file. static volatile unsigned char UART_RxHead; @@ -181,8 +186,7 @@ // The pin change interrupt is used to detect USI_UART reseption. // It is here the USI is configured to sample the UART signal. -#pragma vector=IO_PINS_vect -__interrupt void IO_Pin_Change_ISR(void) +SIGNAL(SIG_PIN_CHANGE) { if (!( PINB & (1<