Olin Lathrop wrote: > Good thing you're using a high level language that makes this sort of > thing > so easy to read. This is much more obscure in my equivalent assembler > module. I can't tell for sure, but I think you're being sarcastic. :-) > At the top the baud rate is defined: > > baud equ 115200 ;serial line baud rate > > Then in the derived constants section a macro is envoked that is passed > the > baud rate and knows the oscillator frequency from a global assembly time > constant. This macro figures out which flavor of UART the PIC has, what > the > optimal baud rate configuration is given the desired baud rate and the > oscillator frequency, and checks to make sure it is close enough for > reliable communication: > > uart_baud baud ;set asm constants for UART configuration > > Then in the module init routine another macro is envoked that takes the > state computed by the UART_BAUD macro and stuffs it in the appropriate > registers: > > uart_setup ;init to config from UART_BAUD, above > > The three lines of code above were copied directly from the QQQ_UART.ASPIC > template module. The macros are defined in STD.INS.ASPIC. Both are part > of > my PIC development environment described at http://www.embedinc.com/pic, > which can be downloaded for free from > http://www.embedinc.com/pic/dload.htm. So how would you change the baud rate, at run-time? In C, it's: Uart_SetBaudRate(9600); Vitaliy -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist