EmonLib have support to ATmega64

Hi to all,
I try to use the ATmega64 with EmonLib and CT-013-050 sensor by Arduino to read the current, but seem not work. So the library have support to Atmega64 or not ?

image

Regards,
bac

Welcome to the OEM forum, @Bac_Chu_Viet

Unfortunately, emonLib was written for the Atmel ATMega 328P processor, which is an 8-bit device. I am not familiar with the Atmega64, however I would expect a number of changes would have to be made to make it compatible, but I cannot tell you what those changes might be.

Hi Robert.Wall,

Thanks for your information.
I have read the EmonLib.cpp and modify a little as
#elif defined(AVR_ATmega644) || defined(AVR_ATmega644P) || defined(AVR_ATmega1284) || defined(AVR_ATmega1284P) || defined(AVR_ATmega64)
ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);

and result the code work well.

regards,
bac

1 Like

This is good to know, thank you.