signedness using tilde

Hi

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

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#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
while(1)
{
GPIOA->ODR = 0x00000020;
delayMs(500);
GPIOA->ODR &=~0x20;
delayMs(500);
}
}
void delayMs(int delay)
{
int i=0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

0