EmbeddedRelated.com
Forums

How to set GPIO pin P0.8 and P0.9 to high and low on LPC2103

Started by Santos Kumar Das December 19, 2008
Dear All,

I'm having problem to use "fast" GPIO on my LPC2103. I need to set GPIO pin
P0.8 and P0.9 to high and low, but couldn't make it.

Following are several ways, which I tried but can't see the high or low at
the pins.

1.

PINSEL0 = (PINSEL0 && 0xFFFFFEFF) || 0x00000100;

FIODIR = (FIODIR && 0xFFFFFEFF) || 0x00000100;

FIOCLR = (FIOCLR && 0xFFFFFEFF) || 0x00000100;

FIOSET = (FIOSET && 0xFFFFFEFF) || 0x00000100;

FIOCLR = (FIOCLR && 0xFFFFFEFF) || 0x00000100;

2.

IODIR = 0x00000100 ;//pin P0.7 configured as output

IOCLR = 0x00000100 ;//P0.7 goes LOW

IOSET = 0x00000100 ;//P0.7 goes HIGH

IOCLR = 0x00000100 ;//P0.7 goes LOW

3.

IODIR |= (1<<8) ;//pin P0.8 configured as output

delay_10us(3);

IOPIN |= (1<<8) ;

delay_10us(3);

IOSET |= (1<<8) ;//P0.8 goes HIGH

delay_10us(3);

IOCLR |= 0x00000100 ;//P0.8 goes LOW

delay_10us(3);

IOSET |= (1<<8) ;//P0.8 goes HIGH

delay_10us(3);

IOCLR |= (1<<8) ;//P0.8 goes LOW

3.

FIOMASK |= (unsigned char)(1<<8);

FIODIR |= (unsigned char)(1<<8);

FIOSET = (unsigned char)(1<<8);

delay_10us(100);

FIOCLR = (unsigned char)(1<<8);

delay_10us(100);

FIOSET = (unsigned char)(1<<8);

delay_10us(100);

FIOCLR = (unsigned char)(1<<8);

delay_10us(100);

4.

FIOMASK0 |= (unsigned char)0x00000100;

FIODIR0 |= (unsigned char)0x00000100;

FIOSET0 = (unsigned char)0x00000100;

delay_10us(100);

FIOCLR0 = (unsigned char)0x00000100;

delay_10us(100);

FIOSET0 = (unsigned char)0x00000100;

delay_10us(100);

FIOCLR0 = (unsigned char)0x00000100;

delay_10us(100);

5.

FIODIR0 = (unsigned char)0x00000100));

PINSEL0 = (unsigned char)0x00000100));

No. 5 is seems to be woking, but the pin can't make it to be off.

I'm not able to find the problem.

Could anybody please help me out for any other solution?

Thank you.

Santos

s...@actatek.com

Best Regards,

Santos Kumar Das (s...@actatek.com)

Software Engineer

skype: santos-hectrix

ACTAtek Pte Ltd/ Hectrix Ltd

18, Boon Lay Way, #09 - 96/97/98

TradeHub 21, Singapore 609964

Tel: (65) 65154520

HP: 91165950

Fax: (65) 65154521

Skype: hectrix-santos

E-mail: s...@actatek.com

Website: www.hectrix.com

Secure Access Control/Time Attendance & Advertising/Information Systems

New Company Achievement Award:

August 5, 2008 - ACTAtek Pte Ltd is pleased to know that Network Products
Guide a Silicon Valley Communications publication and a world leading
publication on technologies and solutions has named ACTAtek2, a winner of
the 2008 Best Products and Services Award (Best in Integrated Security
Appliance)

-----------------------------
Please visit our booth:

IFSEC India

Date: October 16-18, 2008

Venue: Hall 11, Pragati Maidan, New Delhi, India

Booth: 1161

Website: www.ifsecindia.com

Gitex Technology Week 2008
Date: October 19-23, 2008
Venue: Dubai International Convention and Exhibition Centre,

Sheikh Zayed Road , PO Box 9292, Dubai , United Arab Emirates
Booth: Z-61, Zabeel Hall
Website: www.gitex.com


An Engineer's Guide to the LPC2100 Series

Hi,

> PINSEL0 = (PINSEL0 && 0xFFFFFEFF) || 0x00000100;

You're setting PINSEL0 to 1. Excellent.

> FIOSET0 = (unsigned char)0x00000100;

Interesting. Setting FIOSET0 to 0.

> I'm not able to find the problem.

The problem is that you need to read a good book on C. Sorry, no, that's
the solution. The problem is that you don't understand C.

> Could anybody please help me out for any other solution?

Give up now? ;-)

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors