signedness using tilde


I'm a beginner and as a beginner, I start with simple code....

#include "stm32f4xx.h" // Device header
void delayMs(int delay);

int main(void)
		RCC->AHB1ENR |=1;									//ENABLE GPIOA clock
		GPIOA->MODER |= 0x00000400;						// ob 0000 0000 0000 0000 0000 0100 0000 0000
				GPIOA->ODR = 0x00000020;
				GPIOA->ODR &=~0x20;
void delayMs(int delay)
		int i=0;
				delay --;
				for (i=0;3195;i++);

Kiel does not like tilde at the line GPIOA->ODR &=~0x20;

with the warning: main.c(15): warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion].

Without that line, I could switch on the LED connected, but once I add this line, the LED is always on.

Any idea?

Thanks in advance

Fausto Tromba

Parents Reply Children
No data
More questions in this forum