자바강의2

javabasic 2010. 7. 22. 15:43

'javabasic' 카테고리의 다른 글

chatting-frame ui  (0) 2010.07.23
채팅 UI  (0) 2010.07.22
자바 강의  (0) 2010.07.22
계산기(자바)  (0) 2010.07.16
연습문제 3장 3번문제  (0) 2010.07.07
Posted by 지화명이
,

자바 강의

javabasic 2010. 7. 22. 15:42

'javabasic' 카테고리의 다른 글

채팅 UI  (0) 2010.07.22
자바강의2  (0) 2010.07.22
계산기(자바)  (0) 2010.07.16
연습문제 3장 3번문제  (0) 2010.07.07
3장 2번문제  (0) 2010.07.07
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 지화명이
,