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 ATmega128 (version 0.4.15)

2 posters

Go down  Message [Page 1 of 1]


I am currently using version 0.4.15

Is the analog comparator not implemented in atmega128? I tried an experiment, but it doesn't work



Hi, as far as I know comparator should work.

But if you can share an example of the comparator not working I can have a look.



Last edited by penmakers on Thu Nov 23, 2023 6:28 pm; edited 1 time in total


Analog Comparator on ATmega128 (version 0.4.15) 1


#include <mega128.h>
void main(void)
DDRC = 0xFF;    // port c out
DDRE = 0x0;            // port e in
ACSR = 0x0;        // a-comparator setup
SFIOR = 0x0;    // ACME=0, use AIN1

PORTC = 0x00;

if((ACSR & 0x20) != 0) // ACO = '1' (AIN0 >= AIN1)?      
     PORTC= 0xFF;
         PORTC= 0x0F;
Analog Comparator on ATmega128 (version 0.4.15) Attachmentanalog comparator only.zip
You don't have permission to download attachments.
(4 Kb) Downloaded 1 times

arcachofo likes this post

Sponsored content

Back to top  Message [Page 1 of 1]

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