프로젝트 자료실
작성자 임베디드코리아
작성일16-08-03 09:44
조회3,426회
댓글0건
#include "lm3s9b92.h"
int main()
{
unsigned long ulValue;
unsigned long ulLoop;
char ch[16]=" embedded korea";
ch[14] = '\n';
ch[15] = '\0';
ulValue = SYSCTL_RCC_R & ~(0x00400800);
SYSCTL_RCC_R = ulValue | 0x00000800;
ulValue = SYSCTL_RCC_R & ~(0x000027F0);
SYSCTL_RCC_R = ulValue | 0x00000540;
ulValue = SYSCTL_RCC_R & ~(0x07C00000);
SYSCTL_RCC_R = ulValue | 0x01C00000;
for(ulLoop = 32768; ulLoop > 0; ulLoop--)
{ ulValue = SYSCTL_RIS_R & 0x0040;
if(ulValue) {
break;
}
}
ulValue = SYSCTL_RCC_R & ~(0x00000800);
SYSCTL_RCC_R = ulValue | 0x00000000;
ulValue = SYSCTL_RCGC2_R & ~(0x01);
SYSCTL_RCGC2_R = ulValue | 0x01;
__asm(" nop ");
__asm(" nop ");
__asm(" nop ");
ulValue = GPIO_PORTA_AFSEL_R & ~(0x03);
GPIO_PORTA_AFSEL_R = ulValue | 0x03;
ulValue = GPIO_PORTA_PCTL_R & ~(0xFF);
GPIO_PORTA_PCTL_R = ulValue | 0x11;
ulValue = GPIO_PORTA_DEN_R & ~(0x03);
GPIO_PORTA_DEN_R = ulValue | 0x03;
ulValue = SYSCTL_RCGC1_R & ~(0x01);
SYSCTL_RCGC1_R = ulValue | 0x01;
__asm(" nop ");
__asm(" nop ");
__asm(" nop ");
ulValue = UART0_CTL_R & ~(0x01);
UART0_CTL_R = ulValue | 0x00;
ulValue = UART0_IBRD_R & ~(0xFF);
UART0_IBRD_R = ulValue | 0x1B;
ulValue = UART0_FBRD_R & ~(0x0F);
UART0_FBRD_R = ulValue | 0x08;
ulValue = UART0_LCRH_R & ~(0xFF);
UART0_LCRH_R = ulValue | 0x60;
ulValue = UART0_CTL_R & ~(0x01);
UART0_CTL_R = ulValue | 0x01;
while(1){
ulLoop = 0;
while(ch[ulLoop] != '\0') {
while( UART0_FR_R & 0x20);
UART0_DR_R = ch[ulLoop++];
}
} //end while
} //end main