Mi código está aquí:
#include <91x_lib.h>
UART_InitTypeDef UART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
void SCU_Configuration(void);
void GPIO_Configuration(void);
u8 i;
u8 name[]="ABCDE";
u8 c;
main()
{
c=0; i=5;
SCU_Configuration();
GPIO_Configuration();
UART_DeInit(UART0);
UART_InitStructure.UART_WordLength = UART_WordLength_8D;
UART_InitStructure.UART_StopBits = UART_StopBits_1;
UART_InitStructure.UART_Parity = UART_Parity_No ;
UART_InitStructure.UART_BaudRate = 9600;
UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_None;
UART_InitStructure.UART_Mode = UART_Mode_Tx;
UART_InitStructure.UART_FIFO = UART_FIFO_Disable;
//UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2;
//UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2;
UART_Init(UART0, &UART_InitStructure);
UART_ITConfig(UART0, UART_IT_Receive , DISABLE);
UART_ITConfig(UART0, UART_IT_Transmit , DISABLE);
UART_Cmd(UART0, ENABLE);
while(i--)
{
UART_SendData(UART0, name[c++]);
while(UART_GetFlagStatus(UART0, UART_FLAG_TxFIFOFull) != RESET);
}
}
void SCU_Configuration(void)
{
SCU_MCLKSourceConfig(SCU_MCLK_OSC);
SCU_PLLFactorsConfig(192, 25, 2);
SCU_PLLCmd(ENABLE);
SCU_RCLKDivisorConfig(SCU_RCLK_Div1); /* RCLK @96Mhz */
SCU_HCLKDivisorConfig(SCU_HCLK_Div1); /* AHB @96Mhz */
SCU_FMICLKDivisorConfig(SCU_FMICLK_Div1);/* FMI @96Mhz */
SCU_PCLKDivisorConfig(SCU_PCLK_Div2); /* APB @48Mhz */
SCU_MCLKSourceConfig(SCU_MCLK_PLL); /* MCLK @96Mhz */
SCU_BRCLKDivisorConfig(SCU_BRCLK_Div2 );
SCU_APBPeriphClockConfig(__UART0, ENABLE);
SCU_APBPeriphClockConfig(__GPIO3, ENABLE);
}
void GPIO_Configuration(void)
{
GPIO_DeInit(GPIO3);
GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector ;
GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt3 ;
GPIO_Init (GPIO3, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Enable;
GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1 ;
GPIO_Init (GPIO3, &GPIO_InitStructure);
}
Pensé que hice todo bien, pero no podía ver en la ventana de serie. Yo uso el tablero MCBSTR9. ¿por qué?