I created a new project and I defined a delay function using two for loops in my project. When I want to build the project I receive 6 errors. The variables of the for loops can't be defined for some reasons. If I write for( uint8_t count =0; count<UINT16_MAX; count++) I get the errors, but if I define count not in the for loop and use it in the loop I don't receive any errors. I actually never had this problem at my previous project and I didn't changed the code or settings during creating the project, nevertheless when I create a new project I encounter this problem
#include "lpc17xx_gpio.h" const uint8_t segmentTable[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F}; void Delaylow () { for(uint16_t count=0; count<UINT16_MAX; count++) for(uint8_t count2=0;count2<20; count2++) { } } int main () { FIO_ByteSetDir(1,2,0xFF,1); GPIO_SetDir(0,(1<<1)|(1<<2)|(1<<3),1); GPIO_SetDir(0,(1<<16),0); GPIO_ClearValue(0,(1<<3)); GPIO_SetValue(0,(1<<2)); GPIO_SetValue(0,(1<<1)); while(1) { GPIO_ClearValue(0,(1<<1)); GPIO_SetValue(0,(1<<2)); GPIO_SetValue(0,(1<<3)); FIO_ByteSetValue(1,2,segmentTable[0]); FIO_ByteClearValue(1,2,~segmentTable[0]); Delaylow(); GPIO_ClearValue(0,(1<<2)); GPIO_SetValue(0,(1<<3)); GPIO_SetValue(0,(1<<1)); FIO_ByteSetValue(1,2,segmentTable[0]); FIO_ByteClearValue(1,2,~segmentTable[0]); Delaylow(); GPIO_ClearValue(0,(1<<3)); GPIO_SetValue(0,(1<<2)); GPIO_SetValue(0,(1<<1)); FIO_ByteSetValue(1,2,segmentTable[0]); FIO_ByteClearValue(1,2,~segmentTable[0]); Delaylow(); } }
I added the C file of my code.
Thanks in advance