Никак не могу заставить процик C8051F061 передавать байт в UART0. Может кто сталкивался, подскажите плиз, что я делаю не так. Вот привожу код:
#include "C8051F060.h"
#define SYSCLK 24500000 // SYSCLK frequency in Hz #define BAUDRATE 115200 // Baud Rate for UART0
// Peripheral specific initialization functions, // Called from the Init_Device() function void Reset_Sources_Init() { WDTCN = 0xDE; WDTCN = 0xAD; }
void Timer_Init() { SFRPAGE = TIMER01_PAGE; TCON = 0x40; TMOD = 0x20; CKCON = 0x10; TH1 = 0xF9; }
void UART_Init() { SFRPAGE = UART0_PAGE; SCON0 = 0x50; }
void Port_IO_Init() { SFRPAGE = CONFIG_PAGE; P0MDOUT = 0x01; XBR0 = 0x04; XBR2 = 0x40; }
void Oscillator_Init() { SFRPAGE = CONFIG_PAGE; OSCICN = 0x83; }
void Interrupts_Init() { IE = 0x80; }
// Initialization function for device, // Call Init_Device() from your main program void Init_Device(void) { Reset_Sources_Init(); Timer_Init(); UART_Init(); Port_IO_Init(); Oscillator_Init(); Interrupts_Init(); }
void main(void){
Init_Device();
while(1) { SBUF0=0xAA; while(TI0==0); TI0=0; }
}
|