C8051F060 UART problem

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

I tried to use c0851F060's UART0,but I found there is no output signal
from tx0 and rx0(I using crossbar to mapping tx0 rx0 to P_0,P_1),I
don't know why?,so can anyone remind me that any passable wrong I colud

make?

p.s my internal oscillator is 24.5Mhz,how can I create baud rate 9600?
thanks for gave me advice friends,I still confuse,so I repost this
problem.My program as below:

#include <c8051f060.h>                    // SFR declarations


int i;
char g=0x35;


void Oscillator_Init()
{
    SFRPAGE   = CONFIG_PAGE;
    OSCICN    = 0x82;



}


void Timer_Init()
{
    SFRPAGE   = TMR2_PAGE;
    TMR2CN    = 0x04;
    RCAP2L    = 0xFD;
    RCAP2H    = 0xFF;


}


void UART_Init()
{
    SFRPAGE   = UART0_PAGE;
    SCON0     = 0x50;
    SSTA0     = 0x05;


}


void Port_IO_Init()
{
    // P0.0  -  TX0 (UART0), Push-Pull,  Digital
    // P0.1  -  RX0 (UART0), Open-Drain, Digital
    // P0.2  -  Unassigned,  Open-Drain, Digital
    // P0.3  -  Unassigned,  Open-Drain, Digital
    // P0.4  -  Unassigned,  Push-Pull,  Digital
    // P0.5  -  Unassigned,  Push-Pull,  Digital
    // P0.6  -  Unassigned,  Push-Pull,  Digital
    // P0.7  -  Unassigned,  Push-Pull,  Digital

    // P1.0  -  Unassigned,  Open-Drain, Digital
    // P1.1  -  Unassigned,  Open-Drain, Digital
    // P1.2  -  Unassigned,  Open-Drain, Digital
    // P1.3  -  Unassigned,  Open-Drain, Digital
    // P1.4  -  Unassigned,  Open-Drain, Digital
    // P1.5  -  Unassigned,  Open-Drain, Digital
    // P1.6  -  Unassigned,  Open-Drain, Digital
    // P1.7  -  Unassigned,  Open-Drain, Digital


    // P2.0  -  Unassigned,  Open-Drain, Digital
    // P2.1  -  Unassigned,  Open-Drain, Digital
    // P2.2  -  Unassigned,  Open-Drain, Digital
    // P2.3  -  Unassigned,  Open-Drain, Digital
    // P2.4  -  Unassigned,  Open-Drain, Digital
    // P2.5  -  Unassigned,  Open-Drain, Digital
    // P2.6  -  Unassigned,  Open-Drain, Digital
    // P2.7  -  Unassigned,  Open-Drain, Digital


    // P3.0  -  Unassigned,  Open-Drain, Digital
    // P3.1  -  Unassigned,  Open-Drain, Digital
    // P3.2  -  Unassigned,  Open-Drain, Digital
    // P3.3  -  Unassigned,  Open-Drain, Digital
    // P3.4  -  Unassigned,  Open-Drain, Digital
    // P3.5  -  Unassigned,  Open-Drain, Digital
    // P3.6  -  Unassigned,  Open-Drain, Digital
    // P3.7  -  Unassigned,  Open-Drain, Digital


    SFRPAGE   = CONFIG_PAGE;
    P0MDOUT   = 0xF1;
    XBR0      = 0x04;
    XBR2      = 0x40;



}


// Initialization function for device,
// Call Init_Device() from your main program
void Init_Device(void)
{
    Oscillator_Init();
    Timer_Init();
    UART_Init();
    Port_IO_Init();


}


void delay(int x)
{
        int i;
        for(i=0;i<x;i++);


}


void UART_Tx(char command)
{

SBUF0=command ;
while(TI0==0) ;
TI0=0 ;



}


void main (void)
{

        WDTCN = 0xde;
        WDTCN = 0xad;
        LED=0;
        Init_Device();


  while(1)
  {
        UART_Tx(g);


        delay(100);
  }


Site Timeline