'ARM'에 해당되는 글 2건

  1. 2010.07.22 arm FND
  2. 2010.07.16 ARM FND

arm FND

ARM 2010. 7. 22. 15:58


#define GPIO_C (*(volatile unsigned int *)0x40021018)
#define C_BSRR (*(volatile unsigned int *)0x40011010)
#define C_BRR (*(volatile unsigned int *)0x40011014)
#define RCC_L (*(volatile unsigned int *)0x40011000)
#define RCC_H (*(volatile unsigned int *)0x40011004)

 

  void t_delay(int n)
  {
      int i;
      for(i=0; i<n; ++i)
      {
        ;
      }
  }
 
int main(void)
{
  char FND[10]={0x06,0x9b,0x8f,0xa6,0xad,0xbc,0x27,0xbf,0xa7,0x3f};
  
  GPIO_C |=0x10;  //IOPCEN
  RCC_L |=0x33333333;
  RCC_H |=0x33;
  //C_BSRR |=0x40;
  C_BSRR |=0xff;
 
  while (1)
  {
     
    for(int j=0;10>=j;++j)
    {
      C_BRR |=FND[j];
      t_delay(900000);
     
      C_BSRR |=0xff;
    }
  }
 }

'ARM' 카테고리의 다른 글

ARM FND  (0) 2010.07.16
Posted by 지화명이
,

ARM FND

ARM 2010. 7. 16. 17:38


#define RCC_PORT  (*(volatile unsigned *)  0x40021018)


#define PORTC_LOW  (*(volatile unsigned *) 0x40011000)
#define PORTC_HIGH  (*(volatile unsigned *)0x40011004)
#define PORTC_BSRR  (*(volatile unsigned *)0x40011010)
static void delay(volatile double a)
{
  for(;a>0;--a)
  {
     ;
  }
}
void segment() //전부 불켜기
{
 
 
   PORTC_LOW |= 0x3<<0; //0  A
   PORTC_LOW |= 0x3<<4; //1  B
   PORTC_LOW |= 0x3<<8; //2  C
   PORTC_LOW |= 0x3<<12; //3   D
   PORTC_LOW |= 0x3<<16;  //4  E
   PORTC_LOW |= 0x3<<20;  //5  F
   PORTC_LOW |= 0x3<<24;  //6  .
   PORTC_LOW |= 0x3<<28;  //7  G
   PORTC_HIGH |= 0x3<<0; //0  power
 
}
void reset() //전부 리셋
{
  PORTC_BSRR |= 0xFF;
 
}
void set()  //전부 세
{
  PORTC_BSRR |= 0xFF<<16;
 
}

void zero()
{
  PORTC_BSRR |= 0x3F<<16;
}
void one()
{
  PORTC_BSRR |= 0x6<<16;
}
void two()
{
 
  PORTC_BSRR |= 0x1<<24;
  PORTC_BSRR |= 0x1<<23;
  PORTC_BSRR |= 0x1<<20;
  PORTC_BSRR |= 0x1<<19;
  PORTC_BSRR |= 0x1<<18;
  PORTC_BSRR |= 0x1<<17;
  PORTC_BSRR |= 0x1<<16;
}
void three()
{
  PORTC_BSRR |= 0x1<<24;
  PORTC_BSRR |= 0x1<<23;
  PORTC_BSRR |= 0x1<<19;
  PORTC_BSRR |= 0x1<<18;
  PORTC_BSRR |= 0x1<<17;
  PORTC_BSRR |= 0x1<<16;
}
void four()
{
  PORTC_BSRR |= 0x1<<24;
  PORTC_BSRR |= 0x1<<23;
 
 
  PORTC_BSRR |= 0x1<<21;
  PORTC_BSRR |= 0x1<<18;
  PORTC_BSRR |= 0x1<<17;
 
 

}
void five()
{
   PORTC_BSRR |= 0x1<<24;
  PORTC_BSRR |= 0x1<<23;
 
  PORTC_BSRR |= 0x1<<21;

  PORTC_BSRR |= 0x1<<19;
  PORTC_BSRR |= 0x1<<18;
 
   PORTC_BSRR |= 0x1<<16;
}
void six()
{
   PORTC_BSRR |= 0x1<<24;
  PORTC_BSRR |= 0x1<<23;
 
  PORTC_BSRR |= 0x1<<21;
    PORTC_BSRR |= 0x1<<20;
  PORTC_BSRR |= 0x1<<19;
  PORTC_BSRR |= 0x1<<18;
 
}
void seven()
{
   PORTC_BSRR |= 0x1<<24;
 
 
  PORTC_BSRR |= 0x1<<21;
 
  PORTC_BSRR |= 0x1<<18;
  PORTC_BSRR |= 0x1<<17;
   PORTC_BSRR |= 0x1<<16;
}
void eight()
{
   PORTC_BSRR |= 0x1<<24;
  PORTC_BSRR |= 0x1<<23;
 
  PORTC_BSRR |= 0x1<<21;
    PORTC_BSRR |= 0x1<<20;
  PORTC_BSRR |= 0x1<<19;
  PORTC_BSRR |= 0x1<<18;
  PORTC_BSRR |= 0x1<<17;
   PORTC_BSRR |= 0x1<<16;
}
void nine()
{
    PORTC_BSRR |= 0x1<<24;
    PORTC_BSRR |= 0x1<<23;
    PORTC_BSRR |= 0x1<<21;  
 

 
 
  PORTC_BSRR |= 0x1<<18;
  PORTC_BSRR |= 0x1<<17;
   PORTC_BSRR |= 0x1<<16;
}
int main(void)
{
   RCC_PORT |= 0x1<<4; //포트 C 열기
  while(1)
  {
 
 
    segment();
    delay(30000);
    reset();
    zero();
    delay(30000);
    reset();
    one();
    delay(30000);
    reset();
    two();
    delay(30000);
    reset();
    three();
    delay(30000);
    reset();
    four();
    delay(30000);
    reset();
    five();
    delay(30000);
    reset();
    six();
      delay(30000);
    reset();
    seven();
    delay(30000);
    reset();
    eight();
    delay(30000);
    reset();
    nine();
  
  
  }
 
  
}

'ARM' 카테고리의 다른 글

arm FND  (0) 2010.07.22
Posted by 지화명이
,