LM89623S와 Bluetooth모듈 을 연결해 보았다. 생각보다뭐 별거 없었다.
연결한 방법은 간단하다 MCU RX,TX 선을 Bluetooth모듈의 RX,TX를 크로스로연결만 하면 납땜은 끝난다.
코딩부분에서 전송이 되고있는지 확인해보기위해 샘플 코드인 uart_echo 프로그램을 다운로딩해서
테미널 프로그램으로 테스트해보았다.
잘~돌아간다.
#include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/gpio.h" #include "driverlib/interrupt.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "drivers/rit128x96x4.h" #ifdef DEBUG void __error__(char *pcFilename, unsigned long ulLine) { } #endif void UARTIntHandler(void) { unsigned long ulStatus; // // Get the interrrupt status. // ulStatus = UARTIntStatus(UART0_BASE, true); // // Clear the asserted interrupts. // UARTIntClear(UART0_BASE, ulStatus); // // Loop while there are characters in the receive FIFO. // while(UARTCharsAvail(UART0_BASE)) { // // Read the next character from the UART and write it back to the UART. // UARTCharPutNonBlocking(UART0_BASE, UARTCharGetNonBlocking(UART0_BASE)); } } //***************************************************************************** // // Send a string to the UART. // //***************************************************************************** void UARTSend(const unsigned char *pucBuffer, unsigned long ulCount) { // // Loop while there are more characters to send. // while(ulCount--) { // // Write the next character to the UART. // UARTCharPutNonBlocking(UART0_BASE, *pucBuffer++); } } //***************************************************************************** // // This example demonstrates how to send a string of data to the UART. // //***************************************************************************** int main(void) { // // Set the clocking to run directly from the crystal. // SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // // Initialize the OLED display and write status. // RIT128x96x4Init(1000000); RIT128x96x4StringDraw("UART Echo", 36, 0, 15); RIT128x96x4StringDraw("Port: Uart 0", 12, 16, 15); RIT128x96x4StringDraw("Baud: 115,200 bps", 12, 24, 15); RIT128x96x4StringDraw("Data: 8 Bit", 12, 32, 15); RIT128x96x4StringDraw("Parity: None", 12, 40, 15); RIT128x96x4StringDraw("Stop: 1 Bit", 12, 48, 15); // // Enable the peripherals used by this example. // SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Enable processor interrupts. // IntMasterEnable(); // // Set GPIO A0 and A1 as UART pins. // GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Configure the UART for 115,200, 8-N-1 operation. // UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); // // Enable the UART interrupt. // IntEnable(INT_UART0); UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); // // Prompt for text to be entered. // UARTSend((unsigned char *)"Enter text: ", 12); // // Loop forever echoing data through the UART. // while(1) { } }
'IT > Cortex-M3' 카테고리의 다른 글
Cortex-m3와 모터드라이브 연결 (0) | 2011.09.08 |
---|---|
myCortex-LM8962 보드로 개발하기 (3) | 2011.04.13 |