hi all, i would like to know whether it is possible to change the baudrate of the serial port to different rates, i have a program which have to communicate with different devices with different baudrates. I try to change the BRGR0 and BRGR1 values but when that part of the code is executed in the simulator, the values do not change to another baudrate different from the default value(115200). Is the code executed not working on simulation or do i have to reset a Register to trigger that UART must be restarted. Any help is appreciated. Many thanks, khaled Sarsam
Are you sure you have selected the BRG as the source of the UART's clock?
dear Neil, Thank you for the reply, For example., When i select device one,. the baudrate must be 115200 and the simulation executes it perfectly, i can see the values loaded into BRGR's which have to be 0x00 and 0x30. After that i select my second device(just enabling port P1.3) to trigger the processor that other device has to be selected and the baudrate should be changed to 19200. The program points that it executes the commando's to reload the values of BRGR's with 0x01 and 0x70 for 19200. After that is been done, the serial perpherial show's still 115200 instead of 19200 so it is a bit strange, the registers are loaded with good values but then the Baud does not change on the simulation so that's why i cant see any change in the simulation if i reload the values of BRGR's with different values. so i certainly choose the right values for the BRGR's.
sorry i forgot to say that BRGCON is selected as 0x03 so my source is BRG for the UART clock.
Do you clear the BRGGEN bit in the BRGCON sfr before you reset the divisor and set it again after?
it executes the commando's to reload the values of BRGR's with 0x01 and 0x70 for 19200. After that is been done, the serial perpherial show's still 115200 two possibilities: *your code is wrong - did you step through the setting routine and see the actual asm. *since the BGR is unique, the simulator does not reflect it correctly, after all it IS a simulator. a simple test would be to temporarily change the code where the 115k is set to set something else and see what happens. Erik
also With a simulator, there is no guarantee that the behaviour will be the same on an actual chip. No simulator (that you can afford) will be "perfect". Erik
thank you people all for the support, I saw the ASM file and indeed the values are changed to the desired values in the BRGR, I think the simulator doesnot scan again to see whether the values in the BRGRs are changed whether not so that's why it sticks to the first baudrate selected. Thank you all, i will test it on my evaluation board when i get it back from my friend, best wishes, khaled