Index: common/rs232_485.h
===================================================================
--- common/rs232_485.h	(revision 363)
+++ common/rs232_485.h	(working copy)
@@ -35,7 +35,7 @@
 
 #if (defined COM_RS232) || (defined COM_RS485)
 	
-	#ifdef _AVR_IOM169P_H_
+    #if defined(_AVR_IOM169P_H_) || defined(_AVR_IOM329_H_)
 		#define RS_need_clock() (UCSR0B & (_BV(TXEN0) | _BV(RXEN0)))
 		#define RS_enable_rx() (UCSR0B |= _BV(RXEN0) | _BV(RXCIE0))
 	#elif defined(_AVR_IOM169_H_) || defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
Index: common/rs232_485_hw.c
===================================================================
--- common/rs232_485_hw.c	(revision 363)
+++ common/rs232_485_hw.c	(working copy)
@@ -45,6 +45,24 @@
 /* The following must be AFTER the last include line */
 #if (defined COM_RS232) || (defined COM_RS485)
 
+#if defined (_AVR_IOM169_H_) || defined (_AVR_IOM32_H_)
+#define UDR0 UDR
+#define RXEN0 RXEN
+#define RXCIE0 RXCIE
+#define UCSR0A UCSRA
+#define UCSR0B UCSRB
+#define TXC0 TXC
+#define TXCIE0 TXCIE
+#define UDRIE0 UDRIE
+#define TXEN0 TXEN
+#define UBRR0H UBRRH
+#define UBRR0L UBRRL
+#define UCSR0C UCSRC
+#define UCSZ00 UCSZ0
+#define UCSZ01 UCSZ1
+#define U2X0 U2X
+#define URSEL0 URSEL
+#endif
 
 /*!
  *******************************************************************************
@@ -52,23 +70,16 @@
  *
  *  \note
  ******************************************************************************/
-#ifdef _AVR_IOM169P_H_
+#if defined (_AVR_IOM169P_H_) || defined (_AVR_IOM169_H_) || defined (_AVR_IOM329_H_)
 ISR(USART0_RX_vect)
-#elif defined(_AVR_IOM169_H_)
-ISR(USART0_RX_vect)
 #elif defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
 ISR(USART_RXC_vect)
 #endif
 {
-	#ifdef _AVR_IOM169P_H_
 		COM_rx_char_isr(UDR0);	// Add char to input buffer
-		UCSR0B &= ~(_BV(RXEN0)|_BV(RXCIE0)); // disable receive
-	#elif defined(_AVR_IOM169_H_) || defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
-		COM_rx_char_isr(UDR);	// Add char to input buffer
 		#if !defined(MASTER_CONFIG_H)
-			UCSRB &= ~(_BV(RXEN)|_BV(RXCIE)); // disable receive
+		UCSR0B &= ~(_BV(RXEN0)|_BV(RXCIE0)); // disable receive
 		#endif
-	#endif
 	#if !defined(_AVR_IOM16_H_) && !defined(_AVR_IOM32_H_)
     PCMSK0 |= (1<<PCINT0); // activate interrupt
   #endif
@@ -82,7 +93,7 @@
  *  - We send one byte
  *  - If we have send all, disable interrupt
  ******************************************************************************/
-#ifdef _AVR_IOM169P_H_
+#if defined (_AVR_IOM169P_H_) || defined(_AVR_IOM329_H_)
 ISR(USART0_UDRE_vect)
 #elif defined(_AVR_IOM169_H_) || defined(_AVR_IOM16_H_)  || defined(_AVR_IOM32_H_)
 ISR(USART_UDRE_vect)
@@ -91,23 +102,13 @@
 	char c;
 	if ((c=COM_tx_char_isr())!='\0')
 	{
-		#ifdef _AVR_IOM169P_H_
 			UDR0 = c;
-		#elif defined(_AVR_IOM169_H_) || defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
-			UDR = c;
-		#endif
 	}
 	else	// no more chars, disable Interrupt
 	{
-		#ifdef _AVR_IOM169P_H_
 			UCSR0B &= ~(_BV(UDRIE0));
 			UCSR0A |= _BV(TXC0); // clear interrupt flag
 			UCSR0B |= (_BV(TXCIE0));
-		#elif defined(_AVR_IOM169_H_) || defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
-			UCSRB &= ~(_BV(UDRIE));
-			UCSRA |= _BV(TXC); // clear interrupt flag
-			UCSRB |= (_BV(TXCIE));
-		#endif
 	}
 }
 
@@ -117,10 +118,8 @@
  *
  *  \note
  ******************************************************************************/
-#ifdef _AVR_IOM169P_H_
+#if defined (_AVR_IOM169P_H_) || defined (_AVR_IOM169_H_) || defined(_AVR_IOM329_H_)
 ISR(USART0_TX_vect)
-#elif defined(_AVR_IOM169_H_)
-ISR(USART0_TX_vect)
 #elif defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
 ISR(USART_TXC_vect)
 #endif
@@ -129,11 +128,7 @@
 		// TODO: change rs485 to receive
 		#error "code is not complete for rs485"
 	#endif
-	#ifdef _AVR_IOM169P_H_
 		UCSR0B &= ~(_BV(TXCIE0)|_BV(TXEN0));
-	#elif defined(_AVR_IOM169_H_) || defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
-		UCSRB &= ~(_BV(TXCIE)|_BV(TXEN));
-	#endif
 }
 
 /*!
@@ -150,26 +145,18 @@
 	//long ubrr_val = ((F_CPU)/(baud*8L)-1);
 	uint16_t ubrr_val = ((F_CPU)/(COM_BAUD_RATE*8L)-1);
  
-	#ifdef _AVR_IOM169P_H_
 		UCSR0A = _BV(U2X0);
 		UBRR0H = (unsigned char)(ubrr_val>>8);
 		UBRR0L = (unsigned char)(ubrr_val & 0xFF);
 		UCSR0C = (_BV(UCSZ00) | _BV(UCSZ01));     // Asynchron 8N1 
-	#elif defined(_AVR_IOM169_H_) || defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
-		UCSRA = _BV(U2X);
-		UBRRH = (unsigned char)(ubrr_val>>8);
-		UBRRL = (unsigned char)(ubrr_val & 0xFF);
 		#if defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
-            UCSRC = (1<<URSEL) | (_BV(UCSZ0) | _BV(UCSZ1));     // Asynchron 8N1
+            UCSR0C = (1<<URSEL0) | (_BV(UCSZ00) | _BV(UCSZ01));     // Asynchron 8N1
             #if defined(MASTER_CONFIG_H)
-			  UCSRB = _BV(RXCIE) | _BV(RXEN);
+			  UCSR0B = _BV(RXCIE0) | _BV(RXEN0);
 			#endif
         #else 
-            UCSRC = (_BV(UCSZ0) | _BV(UCSZ1));     // Asynchron 8N1
+            UCSR0C = (_BV(UCSZ00) | _BV(UCSZ01));     // Asynchron 8N1
         #endif
-	#else
-		#error 'your CPU is not supported !'
-	#endif
 	#if !defined(_AVR_IOM16_H_) && !defined(_AVR_IOM32_H_)
     PCMSK0 |= (1<<PCINT0); // activate interrupt
   #endif
@@ -190,21 +177,12 @@
 		// TODO: change rs485 to transmit
 		#error "code is not complete for rs485"
 	#endif
-	#ifdef _AVR_IOM169P_H_
 		if ((UCSR0B & _BV(UDRIE0))==0) {
 			UCSR0B &= ~(_BV(TXCIE0));
 			UCSR0A |= _BV(TXC0); // clear interrupt flag
 			UCSR0B |= _BV(UDRIE0) | _BV(TXEN0);
 			// UDR0 = COM_tx_char_isr(); // done in interrupt
 		}
-	#elif defined(_AVR_IOM169_H_) || defined(_AVR_IOM16_H_) || defined(_AVR_IOM32_H_)
-		if ((UCSRB & _BV(UDRIE))==0) {
-			UCSRB &= ~(_BV(TXCIE));
-			UCSRA |= _BV(TXC); // clear interrupt flag
-			UCSRB |= _BV(UDRIE)  | _BV(TXEN); 
-			//UDR = COM_tx_char_isr(); // done in interrupt
-		}
-	#endif
 	sei();
 }
 
Index: OpenHR20/Makefile
===================================================================
--- OpenHR20/Makefile	(revision 363)
+++ OpenHR20/Makefile	(working copy)
@@ -45,17 +45,28 @@
 # 5.4.2008: Dario Carluccio
 #           command line parameters for "avr-size" on Linux and Windows.
 
+# set a default - can be overriden on the command line with:
+#   make HW=THERMOTRONIC <...>
 # HW = THERMOTRONIC
 HW = HONEYWELL 
+# HW = HR25
 
-# MCU name
+# set up the TARGET and MCU based on HW
+# TARGET = Target file name (without extension).
+# MCU = MCU name
 ifeq ($(HW),THERMOTRONIC)
-    MCU = atmega169
+	MCU = atmega169
 	F_CPU = 1000000
-else
-    MCU = atmega169p
+	TARGET = thermotronic
+else ifeq ($(HW),HONEYWELL)
+	MCU = atmega169p
 	F_CPU = 4000000
-endif    
+	TARGET = hr20
+else ifeq ($(HW),HR25)
+	MCU = atmega329pa
+	F_CPU = 4000000
+	TARGET = hr25
+endif
 
 
 
@@ -63,10 +74,6 @@
 FORMAT = ihex
 
 
-# Target file name (without extension).
-TARGET = hr20
-
-
 # Object files directory
 #     To put object files in current directory, use a dot (.), do NOT make
 #     this an empty or blank macro!
@@ -188,6 +195,9 @@
 ifeq ($(HW),THERMOTRONIC)
     CFLAGS += -DTHERMOTRONIC=1
 endif
+ifeq ($(HW),HR25)
+    CFLAGS += -DHR25=1
+endif
 
 #---------------- Assembler Options ----------------
 #  -Wa,...:   tell GCC to pass this to the assembler.
Index: OpenHR20/lcd.c
===================================================================
--- OpenHR20/lcd.c	(revision 363)
+++ OpenHR20/lcd.c	(working copy)
@@ -40,6 +40,16 @@
 #include <avr/sleep.h>
 #include <avr/version.h>
 
+// redefine variable names for newer processor
+#ifdef _AVR_IOM329_H_
+#define LCDDR7 LCDDR07
+#define LCDDR6 LCDDR06
+#define LCDDR5 LCDDR05
+#define LCDDR2 LCDDR02
+#define LCDDR1 LCDDR01
+#define LCDDR0 LCDDR00
+#endif
+
 // HR20 Project includes
 #include "main.h"
 #include "lcd.h"
@@ -52,9 +62,12 @@
 #define LCD_CONTRAST_MAX      15   //!< \brief contrast maxmum
 #define LCD_MAX_POS            4   //!< \brief number of 7 segment chars
 #define LCD_MAX_CHARS  (sizeof(LCD_CharTablePrgMem))   //!< \brief no. of chars in \ref LCD_CharTablePrgMem
+#ifdef HR25
+#define LCD_REGISTER_COUNT     12   //!< \brief no. of registers each bitplane
+#else
 #define LCD_REGISTER_COUNT     9   //!< \brief no. of registers each bitplane
+#endif
 
-
 // Vars
 volatile uint8_t LCD_used_bitplanes = 1; //!< \brief number of used bitplanes / used for power save
 
@@ -200,25 +213,47 @@
 #if THERMOTRONIC==1
     39,    //!<  Field 0
     35,    //!<  Field 1              
+    31,    //!<  Field 2
+    27     //!<  Field 3
+#elif HR25==1
+	39,    //!<  Field 0
+	35,    //!<  Field 0
+    30,    //!<  Field 2
+    26     //!<  Field 3
 #else
     40,    //!<  Field 0
     36,    //!<  Field 1              
-#endif
     31,    //!<  Field 2
     27     //!<  Field 3
+#endif
 };
 
+
+#ifdef HR25
 // Look-up table to adress a segment inside a field
 uint8_t LCD_SegOffsetTablePrgMem[] PROGMEM =
 {
      2,    //  Seg A            AAAA
      3,    //  Seg B           F    B
+    26,    //  Seg C           F    B
+    25,    //  Seg D            GGGG
+    24,    //  Seg E           E    C
+     0,    //  Seg F           E    C
+     1     //  Seg G            DDDD
+};
+#else
+// Look-up table to adress a segment inside a field
+uint8_t LCD_SegOffsetTablePrgMem[] PROGMEM =
+{
+     2,    //  Seg A            AAAA
+     3,    //  Seg B           F    B
     27,    //  Seg C           F    B
     25,    //  Seg D            GGGG
     24,    //  Seg E           E    C
      0,    //  Seg F           E    C
      1     //  Seg G            DDDD
 };
+#endif
 
 //! Look-up table for adress hour-bar segments
 uint8_t LCD_SegHourBarOffsetTablePrgMem[] PROGMEM =
@@ -251,10 +286,13 @@
 
     // LCD Control and Status Register B
     //   - clock source is TOSC1 pin
-    //   - COM0:2 connected
+    //   - COM0:2 connected (HR25 also has COM3)
     //   - SEG0:22 connected
+#ifdef HR25
+	LCDCRB = (1<<LCDCS) | (1<<LCDMUX1) | (1<<LCDMUX0) | (1<<LCDPM2) | (1<<LCDPM0);
+#else
 	LCDCRB = (1<<LCDCS) | (1<<LCDMUX1) | (1<<LCDPM2)| (1<<LCDPM0);
-
+#endif
     // LCD Frame Rate Register
     //   - LCD Prescaler Select N=16       @32.768Hz ->   2048Hz
     //   - LCD Duty Cycle 1/3 (K=6)       2048Hz / 6 -> 341,33Hz
@@ -887,6 +925,11 @@
     	LCDDR10 = LCD_Data[LCD_Bitplane][6];
     	LCDDR11 = LCD_Data[LCD_Bitplane][7];
     	LCDDR12 = LCD_Data[LCD_Bitplane][8];
+#ifdef HR25
+    	LCDDR15 = LCD_Data[LCD_Bitplane][9];
+    	LCDDR16 = LCD_Data[LCD_Bitplane][10];
+    	LCDDR17 = LCD_Data[LCD_Bitplane][11];
+#endif
 	}
 
 
Index: OpenHR20/lcd.h
===================================================================
--- OpenHR20/lcd.h	(revision 363)
+++ OpenHR20/lcd.h	(working copy)
@@ -218,6 +218,128 @@
 #define LCD_SEG_MOON       68   // 12, 5 |  SEG221   |  [8], BIT 5
 //*****************************************************************
 #else
+
+#ifdef HR25
+/*! \verbatim
+ *******************************************************************************
+ *  LCD Layout:
+ *        ---------------------------BAR24------------------------------    
+ *
+ *        0|1|2|3|4|5|6|7|8|9|0a|0b|0c|0d|0e|B |0f|B |B |B |B |B |B |B |    
+ *        0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|  
+ *        --------------------------BAR_SUB-----------------------------
+ *                                                                          
+ *  MOON SUN SUPER2 D1   D2   D3      D4       D5    D6   D7         PADLOCK
+ *  BATOUT SPANNER                                                                       
+ *  BAT1,2 SNOW   3A         2A                  1A         0A       DEGREE CELCIUS       
+ *      Prog   3F    3B   2F    2B    Col2    1F    1B   0F    0B    PERCENT
+ *      Auto      3g         2g       Col1       1g         0g          
+ *      Eco    3E    3C   2E    2C            1E    1C   0E    0C    MINUS/VERTPLUS       
+ *      Manu      3D   Col3  2D       Col4       1D   Col5  0D       DOOROPEN   
+ *                                                                          
+ *******************************************************************************
+ \endverbatim   */
+#define LCD_SEG_B0          0
+#define LCD_SEG_B1          1
+#define LCD_SEG_B2          2
+#define LCD_SEG_B3          3
+#define LCD_SEG_B4          4
+#define LCD_SEG_B5          5
+#define LCD_SEG_B6          6
+#define LCD_SEG_B7          7
+
+#define LCD_SEG_B8          8
+#define LCD_SEG_B9          9
+#define LCD_SEG_B10        10
+#define LCD_SEG_B11        11
+#define LCD_SEG_B12        12
+#define LCD_SEG_B13        13
+#define LCD_SEG_B14        14
+#define LCD_SEG_B16        15
+
+#define LCD_SEG_B17        16
+#define LCD_SEG_B20        17
+#define LCD_SEG_B21        18
+#define LCD_SEG_BAR_SUB    19
+#define LCD_SEG_B23        20
+
+#define LCD_SEG_ECO        24
+#define LCD_SEG_PROG       25
+#define LCD_SEG_3F         26
+#define LCD_SEG_3G         27
+#define LCD_SEG_3A         28
+#define LCD_SEG_3B         29
+#define LCD_SEG_2F         30
+#define LCD_SEG_2G         31
+
+
+#define LCD_SEG_2A         32
+#define LCD_SEG_2B         33
+#define LCD_SEG_COL2       34
+#define LCD_SEG_1F         35
+#define LCD_SEG_1G         36
+#define LCD_SEG_1A         37
+#define LCD_SEG_1B         38
+#define LCD_SEG_0F         39
+
+#define LCD_SEG_0G         40
+#define LCD_SEG_0A         41
+#define LCD_SEG_0B         42
+#define LCD_SEG_MINUS      43
+#define LCD_DEGREE         44
+#define LCD_PADLOCK        45
+
+#define LCD_SEG_MANU       48
+#define LCD_SEG_AUTO       49
+#define LCD_SEG_3E         50
+#define LCD_SEG_3D         51
+#define LCD_SEG_3C         52
+#define LCD_SEG_COL3       53
+#define LCD_SEG_2E         54
+#define LCD_SEG_2D         55
+
+#define LCD_SEG_2C         56
+#define LCD_SEG_COL4       57
+#define LCD_SEG_COL1       58
+#define LCD_SEG_1E         59
+#define LCD_SEG_1D         60
+#define LCD_SEG_1C         61
+#define LCD_SEG_COL5       62
+#define LCD_SEG_0E         63
+
+#define LCD_SEG_0D         64
+#define LCD_SEG_0C         65
+#define LCD_SEG_DOOR_OPEN  66
+#define LCD_SEG_VERTPLUS   67
+#define LCD_SEG_PERCENT    68
+#define LCD_SEG_CELCIUS    69
+
+#define LCD_SEG_BAT_OUTLINE 72
+#define LCD_SEG_BAT_TOP     73 // BAT1
+#define LCD_SEG_BAT_BOTTOM  74 // BAT2
+#define LCD_SEG_SNOW        75
+#define LCD_SEG_SPANNER     76
+#define LCD_SEG_MOON        77
+#define LCD_SEG_SUN         78
+#define LCD_SEG_SUPER2      79
+
+#define LCD_SEG_D1          80
+#define LCD_SEG_D2          81
+#define LCD_SEG_D3          82
+#define LCD_SEG_D4          83
+#define LCD_SEG_D5          84
+#define LCD_SEG_D6          85
+#define LCD_SEG_D7          86
+#define LCD_SEG_B15         87
+
+#define LCD_SEG_B18         88
+#define LCD_SEG_B19         89
+#define LCD_SEG_B22         90
+#define LCD_SEG_BAR24       91
+
+
+#else /* HR20 */
+
 // LCD_SEG:_xx for LCD_SetSeg   // LCDDR | AtMega169 |  LCD_Data[]
 #define LCD_SEG_B0          0   //  0, 0 |  SEG000   |  [0], BIT 0
                                 //  0, 1 |  SEG001   |  [0], BIT 1
@@ -288,7 +410,8 @@
                                 // 12, 4 |  SEG220   |  [8], BIT 4
 #define LCD_SEG_MOON       69   // 12, 5 |  SEG221   |  [8], BIT 5
 //*****************************************************************
-#endif
+#endif /*HR25*/
+#endif /*!THERMOTRONIC*/
 
 //***************************
 // LCD Strings:
