Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/02/07 19:43
Read: times


 
#143909 - Here's what ST sent me (and I tried 0x50)
Responding to: ???'s previous message
I tried 0x50 in SCON0 with no change.

Here is what ST sent me:

#define USE_TIMER1 //Select timer for baud rate generator
//#define BAUD_19200
#define BAUD_115200

// setup TIMER1 to generate the proper baud rate
void com_baudrate (void)
{
#ifdef USE_TIMER1
TI = 0 ;
// set timer 1 up as a baud rate generator
TR1 = 0; // stop timer 1
ET1 = 0; // disable timer 1 interrupt
PCON |= 0x80; // 0x80=SMOD: set serial baudrate doubler
TMOD &= ~0xF0; // clear timer 1 mode bits
TMOD |= 0x20; // put timer 1 into MODE 2

// magic formula: (unsigned char) (256 - (OSC_FREQ / (16L * 4L * baudrate)));
TH1 = -11; //for 19200 bps
TL1 = 0x00;
TR1 = 1; // start timer 1
#endif
#ifdef USE_TIMER2
TI = 0 ;
#ifdef BAUD_19200
RCAP2H = 0xFF;//Sets baud rate at 19200
RCAP2L = 0xBF;//for both UART0 and UART1
#endif
#ifdef BAUD_115200
RCAP2H = 0xFF;//Sets baud rate at 19200
RCAP2L = 0xF5;//for both UART0 and UART1
#endif

T2CON = 0x34; //Sets timer2 on, UART0 TCKL and RCKL, timer, reload

SCON0 = 0x74;

#endif

After I trimmed down the code for submission, I don't even get 2400 baud activity.

I found that it WAS working at 2400 baud by flipping through the baud rate settings in HyperTerminal.



List of 6 messages in thread
TopicAuthorDate
uPSD3354D-40U6 UART0 runs at 1/8 Speed            01/01/70 00:00      
   show the UART code            01/01/70 00:00      
   post your code...            01/01/70 00:00      
   Here's my code...            01/01/70 00:00      
      hummm...            01/01/70 00:00      
         Here's what ST sent me (and I tried 0x50)            01/01/70 00:00      

Back to Subject List