P171
소스
static void delay_int_count(volatile unsigned int nTime)
{
for(; nTime>0; nTime--);
}
int main(void)
{
(*(volatile unsigned *)0x40021018 |= 0x8;
(*(volatile unsigned *)0x40010C04 |=0x10;
(*(volatile unsigned *)0x40010C14 |= 0x200;
delay_int_count(10000);
(*(volatile unsigned *)0x40010C10 |= 0x200;
while(1)
{
;
}
}
[GPIO Set Reset 레지스터]
GPIO핀의 값을 Reset하고 Set하는 작업으로 동작을 On, Off시켰다.
1.Port bit Reset register [GPIOx_BRR]
Address offset:0x14
Reset value: 0x0000 0000
GPIO register map을 참고한다.
0x40010C14 |= 0x200;
0x200=0b001000000000이 된다. 즉, BR9가 ON되어 핀9가 Reset된다.(Register reset)
2.Port bit set/reset register [GPIOx_BSRR]
Address offset: 0x10
Reset value : 0x0000 0000
0x40010C10 |= 0x200으로 인해 BS9가 ON되어 핀9가 Set된다.(Register set)
delay_int_count(10000);
시간지연. 설명 pass
'중도연재종료 > CORTEX M3' 카테고리의 다른 글
GPIO_Init (0) | 2013.05.25 |
---|---|
Key가 눌린것 알아채기 (0) | 2013.05.24 |
고급스러운 코딩1. (0) | 2013.05.24 |
LED회로도를 통한 기본적인 이해 (0) | 2013.05.22 |
Cortex M3 시작. 자료 (0) | 2013.05.22 |