diff --git a/newcode/yaMBSiavr.c b/newcode/yaMBSiavr.c index 3a00621..c733b47 100644 --- a/newcode/yaMBSiavr.c +++ b/newcode/yaMBSiavr.c @@ -45,7 +45,6 @@ THE POSSIBILITY OF SUCH DAMAGE. #include #include "yaMBSiavr.h" #include -#include "aBusIO.h" volatile unsigned char BusState = 0; volatile uint16_t modbusTimer = 0; @@ -180,26 +179,27 @@ void modbusTickTimer(void) ISR(UART_RECEIVE_INTERRUPT) { - unsigned char data; - data = UART_DATA; - modbusTimer=0; //reset timer - if (!(BusState & (1<MaxFrameIndex) modbusReset(); - else - { - rxbuffer[DataPos]=data; - DataPos++; //TODO: maybe prevent this from exceeding 255? - } - } else - if (!(BusState & (1<MaxFrameIndex) modbusReset(); + else + { + rxbuffer[DataPos]=data; + DataPos++; //TODO: maybe prevent this from exceeding 255? + } + } else + if (!(BusState & (1<> 8); @@ -242,6 +243,7 @@ void modbusInit(void) * Arguments: - packtop: Position of the last byte containing data. * modbusSendException is a good usage example. */ +//TODO void modbusSendMessage(unsigned char packtop) { PacketTopIndex=packtop+2; diff --git a/newcode/yaMBSiavr.h b/newcode/yaMBSiavr.h index aa9b4c2..a2e54ac 100644 --- a/newcode/yaMBSiavr.h +++ b/newcode/yaMBSiavr.h @@ -39,7 +39,6 @@ THE POSSIBILITY OF SUCH DAMAGE. ************************************************************************/ #include -#include "aBusIO.h" /** * @code #include @endcode * @@ -179,7 +178,7 @@ THE POSSIBILITY OF SUCH DAMAGE. #define UBRRH UBRR0H #define UBRRL UBRR0L -#elif defined(__AVR_ATmega8__)|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) || defined(__AVR_ATmega323__) +#elif defined(__AVR_ATmega7__)|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) || defined(__AVR_ATmega323__) #define UART_TRANSMIT_COMPLETE_INTERRUPT USART_TXC_vect #define UART_RECEIVE_INTERRUPT USART_RXC_vect #define UART_TRANSMIT_INTERRUPT USART_UDRE_vect @@ -188,6 +187,13 @@ THE POSSIBILITY OF SUCH DAMAGE. #define UART_DATA UDR #define UART_UDRIE UDRIE +#elif defined(__AVR_ATxmega32A4__) +#define UART_TRANSMIT_COMPLETE_INTERRUPT USARTD0_TXC_vect +#define UART_RECEIVE_INTERRUPT USARTD0_RXC_vect +#define UART_TRANSMIT_INTERRUPT USARTD0_DRE_vect +#define UART_DATA USARTD0.DATA + + #else #error "no definition available" #endif