led control with a switch

2 views
Skip to first unread message

Hypernuclide

unread,
Dec 24, 2009, 2:21:39 PM12/24/09
to Hypernuclide
This program is for the proteus LPC2138 devboard
Forum link:-http://hypernuclide.com/viewtopic.php?f=30&t=62

#include<LPC21XX.h>
#define led 0X0000AA00
void delay();
main()
{

PINSEL0=0X00000000;
//port0
IODIR0=0X0000FF00;//make the pins from P0.8 - P0.15 as outputs
while(1)
{
if(!(IOPIN0&(1<<16))) /*check the status of the switch if low start
blinking*/
{
IOSET0=led;
delay();
IOCLR0=0X0000FF00;
delay();
}
else
IOCLR0=0X0000FF00;
}

}
void delay()
{
int i,j;
for(i=0;i<1000;i++)
{
for(j=0;j<500;j++);
}
}

note the if condition inorder to check the status of a pin use '&' for
AND operation not '&&' and use
1 or (1<<0) or 0x00000001
2 or (1<<1) or 0x00000002
4 or (1<<2) or 0x00000004
for checking the pins in 0th,1st,2nd,....

santhosh santhosh

unread,
Dec 25, 2009, 12:18:15 AM12/25/09
to hypern...@googlegroups.com
I need PIC16F877A circuit with program example with compiler name


From: Hypernuclide <hypern...@gmail.com>
To: Hypernuclide <hypern...@googlegroups.com>
Sent: Fri, December 25, 2009 12:51:39 AM
Subject: led control with a switch

sirish

unread,
Dec 25, 2009, 5:16:41 AM12/25/09
to Hypernuclide

On Dec 25, 10:18 am, santhosh santhosh <thos...@yahoo.com> wrote:
> I need PIC16F877A circuit with program example with compiler name
>

check this one http://hypernuclide.com/viewtopic.php?f=36&t=75

Message has been deleted

Hypernuclide

unread,
Dec 25, 2009, 7:01:51 AM12/25/09
to Hypernuclide

On Dec 25, 10:18 am, santhosh santhosh <thos...@yahoo.com> wrote:

> I need PIC16F877A circuit with program example with compiler name
>

next u request anything which is off the topic create your own post!
here u go :- http://groups.google.com/group/hypernuclide/browse_thread/thread/26778e918f9ac710

Reply all
Reply to author
Forward
0 new messages