http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
[Mega128 EVM]의 USB2Serial은 UART1에 연결되어 있고 [/mega128_evm/00_hal/config.h]파일에 시리얼 출력 관련 정의가 되어 있다.
//UART1을 사용하기 위해
#define _UART1_ENABLE
#define _HAL_MEGA128_UART
//#define _UART0_ENABLE
//-----------------------------------------------------------------------------
#if 0
#define U0_printf printf
#define DebugPrint U0_printf
#define DebugInit U0_Init
#define DebugGetByte U0_GetByte
#define DebugIsByte U0_IsGetByte
#endif
#if 1
#define DebugPrint printf
#define DebugInit U1_Init
#define DebugGetByte U1_GetByte
#define DebugIsByte U1_IsGetByte
#endif
//-----------------------------------------------------------------------------
예제 소스
//-----------------------------------------------------------------------------<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><?xml:namespace prefix = o /> // Main Routine //----------------------------------------------------------------------------- int main(void) { SystemInit(); //Serial Init DebugInit(BAUD_115200); DebugPrint("Mega128 EVM Serial Test Program.\r\n"); //Init LED Led1Init(); while(1) { if(DebugIsByte()) { switch(DebugGetByte()) { case '1': Led1On(); DebugPrint("LED1 On\r\n"); break; case '2': Led1Off(); DebugPrint("LED1 Off\r\n"); break; } } } } //----------------------------------------------------------------------------- |