#include #include #define SETTO(value, bit, to) value = ((to) ? value | BIT(bit) : value & ~BIT(bit)) #define ISSET(value, bit) ((value) & (BIT(bit))) #define BIT(x) (1 << (x)) #define SET(x) |= BIT(x) #define CLR(x) &= ~BIT(x) void nop_delay(unsigned int count) { for (unsigned int i = 0; i < count; i++) { asm volatile ("nop"); } } int main(void) { // Initialize display, cursor off // Clear display and home cursor //Clear 7-seg DDRC |= 0xCF; DDRG |= 0x04; PORTC |= 0x38; PORTG CLR(2); for (signed char i = 7; i >= 0; i--){ PORTC CLR(6); // Clock high for certain period PORTC SET(7); nop_delay(8); // Clock low for certain period PORTC CLR(7); nop_delay(8); } PORTG SET(2); } {{:et:supervisors:solutions:andurid_4_termistor.hex|}} {{:et:supervisors:solutions:andurid_2_kaugus_algeline.hex|}}