??? 03/06/07 19:52 Read: times |
#134418 - Proper baud rate... Responding to: ???'s previous message |
You stated you still don't know which baud rate to use...
Why not try the same one that the device is programmed for? (56k baud) If you haven't programmed the device yet, then why not pick a baud rate, program the device, then select that same baud rate for your communication link? You are leaving yourself wide open to ridicule by being offended by Erik's comments. Here's a little help, but I don't suggest you copy and paste; learn by reading... #define MICRO_FREQUENCY 22118400L * * * void SetBaudrate( ulong BaudRate ) { EA = 0; // Disable Interrupts // 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 TH1 = (byte) (256 - (MICRO_FREQUENCY / (192L * BaudRate))); TR1 = 1; // start timer 1 EA = 1; // Enable Interrupts } best of luck, -db |