SQ_TRI_p-13

 SQUARE


#include <lpc21xx.h>


void delay(void);


int main ()

{

PINSEL0 = 0x00000000 ; // Configure P0.0 to P0.15 as GPIO

PINSEL1 = 0x00000000 ; // Configure P0.16 to P0.31 as GPIO

IO0DIR  = 0x00FF0000 ;

   

while(1)

    {

    IO0PIN = 0x00000000;

        delay();

        IO0PIN = 0x00FF0000;

        delay();

    }

}   


void delay(void)

{

unsigned int i=0;

    for(i=0;i<=95000;i++);

}

TRIANGULAR


#include <LPC21xx.h>


int main ()

{

unsigned long int temp=0x00000000; 

  unsigned int i=0;


  IO0DIR=0x00FF0000;

   

    while(1)

    {

    // output 0 to FE 

        for(i=0;i!=0xFF;i++)

        {

        temp=i;

          temp = temp << 16;

          IO0PIN=temp;

        }

       

// output FF to 1   

        for(i=0xFF; i!=0;i--)

        {

        temp=i;

          temp = temp << 16;

          IO0PIN=temp;

        }

}//End of while(1)

}//End of main()



Comments

Popular posts from this blog

Dc_p-10

stepp_p-11