EmbeddedRelated.com
Forums
Memfault Beyond the Launch

C8051F060?

Started by freekyidea August 20, 2005
 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); 
  }

1. freekyidea 	  Aug 20, 5:29 am     show options
Newsgroups: comp.arch.embedded
From: "freekyidea" <p4693...@ccmail.ncku.edu.tw> - Find messages by
this author
Date: 20 Aug 2005 05:29:17 -0700
Local: Sat, Aug 20 2005 5:29 am
Subject: C8051F060?


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

<snip>

RTFM - specifically Section 23 "Timers" and more specifically, Table
22.1 "Timer Settings for Standard Baud Rates Using The Internal
Oscillator Frequency: 24.5 MHz"


Bob

Thank you Bob ! very appreciate you that answer my question,but I am
sorry
I didn't get the mail that you wrote to me,I don't know why...I am sure
I am
not delete that mail,so...can you send me again please?
p4693127@ccmail.ncku.edu.tw

//===================================================
RTFM - specifically Section 23 "Timers" and more specifically, Table
22.1 "Timer Settings for Standard Baud Rates Using The Internal
Oscillator Frequency: 24.5 MHz
//===================================================
I can't find this...which spec. above ?

Thank you Bob ! very appreciate you that answer my question,but I am
sorry
I didn't get the mail that you wrote to me,I don't know why...I am sure

I am
not delete that mail,so...can you send me again please?
p4693...@ccmail.ncku.edu.tw

Thank you Bob ! very appreciate you that answer my question,but I am
sorry
I didn't get the mail that you wrote to me,I don't know why...I am sure

I am
not delete that mail,so...can you send me again please?
p4693127@ccmail.ncku.edu.tw

>>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
<snip> RTFM - specifically Section 23 "Timers" and more specifically, Table 22.1 "Timer Settings for Standard Baud Rates Using The Internal Oscillator Frequency: 24.5 MHz" Bob Reply
Dear Bob:
I still not get any mail? Is this mean you want to send me a mail?
or is my misunderstanding? ha ha~~^^
>>1. freekyidea Aug 20, 5:29 am show options >>Newsgroups: comp.arch.embedded >>From: "freekyidea" <p4693...@ccmail.ncku.edu.tw> - Find messages by >>this author >>Date: 20 Aug 2005 05:29:17 -0700 >>Local: Sat, Aug 20 2005 5:29 am >>Subject: C8051F060?
Tthanks for helping me configuration baud rate 9600,please tell me why my Tx won't output? I will very appreciate you ~
Dear Bob~
Can you give me a sample cord for C8051F060 UART0?
I tried several times...UART0 still can't word.
please help me~


Memfault Beyond the Launch