I'm using the upsd3312d and i'm working with the Uart0 to send data to a serial port (r232) i have a transiver (ICL3225e) between the serial port and the uart, i can Reseive Data from the computer but i cannot send data to the computer.. i'm seen the data that go out of the Tx line in is always in low.. Here is the code that i'm using...
//1.2 #define Timer2_Set_BaudRate(BaudRate) timer2_baud = (65536L - ( (FREQ_OSC * 125L) / (4L * UART0_BAUD_RATE))); RCAP2L = (timer2_baud & 0x00FF); RCAP2H = (timer2_baud >> 8); //1.3 Configure Timer2: Mode-Timer, Interrupt-No, Start //1.1 Select UART0 Baud Generator: TCLK-Timer2, RCLK-Timer2 T2CON = 0x34; //Set and start Timer2. //sbit TF2 = T2CON^7; // Timer2 overflow flag. //sbit EXF2 = T2CON^6; // External signal flag. Set when negative transition occur on T2EX and EXEN2=1. //sbit RCLK = T2CON^5; // UART0 receive clock select. 0-Timer1, 1-Timer2 //sbit TCLK = T2CON^4; // UART0 transimit clock select. 0-Timer1, 1-Timer2 //sbit EXEN2 = T2CON^3; // Timer2 external signal (T2EX) enable. //sbit TR2 = T2CON^2; // Start/Stop control //sbit C_T2 = T2CON^1; // Timer/Counter select //sbit CP_RL2 = T2CON^0; // Capture/Reload select //2. Configure P3.0,P3.1 as UART0 pins P3SFS |= 0x03; // P3SFS = 0x01; // Force On the Transiver for the RS-232 P3_2 = 1; //3. Set UART0 operating mode SCON = 0x50; // enable first serial UART & receiver //4. Configure MCU Interrupt support PS = 1; // high priority for UART interrupt ES = 1; // Enable UART0 interrupt EA = 1; // Enable global interrupt flag I have a while loop in were i write to the SBUF but nothing happen... I make some other test with the Mode 0 and it transmit but i need to change the baud rate, so this mode is not good form me... Can you help me? Thanks :D [ This message was edited by: maritzayanet on 16-07-2005 02:08 ]
I had problems with this too and it was because of the oscillator. I was using a 36.000Mhz crystall in fundamental mode, I was supposing that the frequency was 36MHz but it was not true, it was 18.000Mhz. I had to put the crystall to work in third overtone mode so I really had 36.000MHz and know it works perfectly.