amirtafrishi
Junior Member level 1
Thanks for ur attention. I've changed my functions but again there is no sign of improvment.Could u please give me sources for If Function ? I think my If function doesn't works .
OR maybe I should have any kind of delay?
This is my latest program :
I've try to Examine all of my ADC input but i put high voltage about 3.3 to 5 Volt for preventing To Light the port which is off. but all light up in regular structure....
- - - Updated - - -
Also there is no Error in compiling.....
OR maybe I should have any kind of delay?
This is my latest program :
Code:
#include "lpc17xx.h"
#include "type.h"
#include "adc.h"
extern volatile uint32_t ADCValue[ADC_NUM];
extern volatile uint32_t ADCIntDone;
extern volatile uint32_t OverRunCounter;
/*****************************************************************************
** Main Function main()
******************************************************************************/
int main (void)
{
uint32_t i,j;
uint16_t L;
/* SystemClockUpdate() updates the SystemFrequency variable */
SystemClockUpdate();
LPC_GPIO2->FIODIR = 0x000000FF; /* P2.xx defined as Outputs */
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
/* Initialize ADC */
ADCInit( ADC_CLK );
while(1)
{
L = ADCRead(0);
L = (L >> 4) & 0x00000FFF;
if ( L < 100 )
break;
}
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
while(1)
{
L = ADCRead(1);
L = (L >> 4) & 0x00000FFF;
if ( L < 100 )
break;
}
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
while(1)
{
L = ADCRead(2);
L = (L >> 4) & 0x00000FFF;
if ( L < 100 )
break;
}
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
while(1)
{
L = ADCRead(3);
L = (L >> 4) & 0x00000FFF;
if ( L < 100 )
break;
}
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
while(1)
{
L = ADCRead(4);
L = (L >> 4) & 0x00000FFF;
if ( L < 100 )
break;
}
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
while(1)
{
L = ADCRead(5);
L = (L >> 4) & 0x00000FFF;
if ( L < 100 )
break;
}
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
while(1)
{
L = ADCRead(6);
L = (L >> 4) & 0x00000FFF;
if ( L < 100 )
break;
}
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
while(1)
{
L = ADCRead(7);
L = (L >> 4) & 0x00000FFF;
if ( L < 100 )
break;
}
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
while(1)
{
L = ADCRead(8);
L = (L >> 4) & 0x00000FFF;
if ( L < 100 )
break;
}
LPC_GPIO2->FIOCLR = 0x000000FF; /* turn off all the LEDs */
for(i = 0; i < 8; i++)
{
LPC_GPIO2->FIOSET = 1 << i;
for(j = 1000000; j > 0; j--);
}
LPC_GPIO2->FIOCLR = 0x000000FF;
for(j = 1000000; j > 0; j--);
}
- - - Updated - - -
Also there is no Error in compiling.....