Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Analog comparator on Arduino Mega (Atmega 2560) seems not implemented

2 posters

Go down  Message [Page 1 of 1]

BenZr



In a  lab I use atmega2560 (arduino mega), I need to trigger an interrupt when the comparator detects a voltage change.
I use 0.4.15-SR9 and I have tried to add it in ./src/simavr/cores/sim_mega2560.c in this way :
Code:

void m2560_init(struct avr_t * avr)
{
   struct mcu_t * mcu = (struct mcu_t*)avr;
   
   avr_eeprom_init(avr, &mcu->eeprom);
    /* ... */
   avr_uart_init(avr, &mcu->uart3);
   avr_acomp_init(avr, &mcu->acomp); // try
   avr_adc_init(avr, &mcu->adc);
    /* ... */

and it seems to work fine !

arcachofo

arcachofo

Hi Ben.
Thank you very much for the solution!

arcachofo

arcachofo

Solution implemented at Rev 277.

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum