Forums

GPIO TOGGLING PROBLEM

Started by PATEL VIPUL January 28, 2008
Hi all,

I am using LPC2101 for my application in which i have to use P0.0 to P0.3. And here is the code just for testing these pins.

PINSEL0 = 0; // Make all pins GPIO function
IODIR = 0x0F; // Make P0.0-P1.3 as output
while(1)
{
if(flag==0)
{
IOSET = 0X0F;
flag=1;
}
else
{
IOCLR = 0X0F;
flag=0;
}
Delay(100);
}

But same time only P0.1 and P0.0 are toggling other two pins remain uneffected. so i can not understand the problem.......this also happen with other few pin on LPC2101

So can anybody help.......Thanks in advance

Thanks and Regards,
Vipul Patel

---------------------------------
Save all your chat conversations. Find them online.

An Engineer's Guide to the LPC2100 Series

PATEL VIPUL wrote:
> But same time only P0.1 and P0.0 are toggling other two pins remain uneffected. so i can not understand the problem.......this also happen with other few pin on LPC2101
>
P0.2, 3, 17 and 18 have open-collector outputs. You have to add pull-up
resistors to have them toggle between high and low pin state.
Those pins are also meant for I2C communication which requires OC outputs.

Alex
l... napisa(a):

Hi all,

I am using LPC2101 for my application in which i have to use P0.0 to
P0.3. And here is the code just for testing these pins.

PINSEL0 = 0; // Make all pins GPIO function
IODIR = 0x0F; // Make P0.0-P1.3 as output
while(1)
{
if(flag==0)
{
IOSET = 0X0F;
flag=1;
}
else
{
IOCLR = 0X0F;
flag=0;
}
Delay(100);
}

But same time only P0.1 and P0.0 are toggling other two pins remain
uneffected. so i can not understand the problem.......this also happen
with other few pin on LPC2101

P0.2 and P0.3 are open drain pins. Try connect pullups.
Albert





Thanks Alex

I solve my problem...........thanks Group
Hi all,
>
>I am using LPC2101 for my application in which i have to use P0.0 to P0.3. And here is the code just for testing these pins.
>
> PINSEL0 = 0; // Make all pins GPIO function
> IODIR = 0x0F; // Make P0.0-P1.3 as output
> while(1)
> {
> if(flag==0)
> {
> IOSET = 0X0F;
> flag=1;
> }
> else
> {
> IOCLR = 0X0F;
> flag=0;
> }
> Delay(100);
> }
>
>But same time only P0.1 and P0.0 are toggling other two pins remain uneffected. so i can not understand the problem.......this also happen with other few pin on LPC2101
>
>So can anybody help.......Thanks in advance
>
>Thanks and Regards,
> Vipul Patel
>
>---------------------------------
> Save all your chat conversations. Find them online.
>
>