Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] ARM 7 startup program

Status
Not open for further replies.

manvindar

Member level 1
Member level 1
Joined
Jun 10, 2012
Messages
41
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Banglore
Visit site
Activity points
1,529
i am new to ARM processors and want to write a simple code like monitoring pin P0.8 and if its high then LED should glow at Pin P0.22

how about to do that?
 

oh yea sry.....i am using LPC2129...and uvision 4

- - - Updated - - -

here is rough code

Code:
#include <LPC21xx.h>
#define led (1<<22)
#define sw (1<<8)
int main (void)
{ PINSEL0=sw;
IODIR0=0xFFFFFFF; if (sw == 1)

IOSET0 = (1<<22); 
else 
IOCLR0 = (1<<22);
}

- - - Updated - - -

whats wrong with this code???

Code:
#include <LPC21xx.h>
#define led (1<<22) // Led is bit 22
#define sw (1<<8)  // Switch is bit 8

int main (void)
{
  IODIR0 &= ~sw; // Set as inputs
  IODIR0 |= led; // Set as outputs

  while(1)
  {
    if (IOPIN0 & sw) // Check switch state, reflect to led
      IOSET0 = led;
    else
      IOCLR0 = led;
  }
}

[
 

whats wrong with this code???

Code:
#include <LPC21xx.h>
#define led (1<<22) // Led is bit 22
#define sw (1<<8)  // Switch is bit 8

int main (void)
{
  IODIR0 &= ~sw; // Set as inputs
  IODIR0 |= led; // Set as outputs

  while(1)
  {
    if (IOPIN0 & sw) // Check switch state, reflect to led
      IOSET0 = led;
    else
      IOCLR0 = led;
  }
}

[

I don't see a problem, what is the result of the code when you run it?
 

sry the code is correct..actually the led is embedded in dev board and its connected to the other way......
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top