Baud rate

hi sir,can u tell me how to change baud rate from 19200 to 9600 in pic16F628,

startMain
;set up I/O ports and serial port for 19,200 baud UART
bsf STATUS,RP0
movlw b’11110111’ ;smc reset is the only normal
movwf TRISB ; output–all others inputs or serial out
bcf OPTION_REG,NOT_RBPU ;enable PORTB pull-up resistors
movlw .12 ;set baud rate to 19,200 (assuming BRGH=1)
movwf SPBRG ;(address 99h)
movlw b’00100100’ ;bit 6 clear - 8-bit transmission
;bit 5 set - enable transmit
;bit 4 clear - UART asynchronous mode
;bit 2 set - high baud rate mode
;bits 7, 3, 1, 0 - don’t care
movwf TXSTA ;address 98h
bcf STATUS,RP0 ;select bank 0
movlw b’10010000’ ;bit 7 set - enable serial port
;bit 6 clear - 8-bit reception
;bit 4 set - continuous receive
;bits 5, 3:0 - don’t care
movwf RCSTA ;address 18h
;reset motor controller
bcf SMC_PORT,SRST
nop
nop
bsf SMC_PORT,SRST
movlw 0x00
movwf ARG1H
movlw 0x02
movwf ARG1L
call milliDelay

Hello,

The baud rate settings depend on your clock speed. You can find all of the parameters for setting a baud rate in the datasheet for the microcontroller you are using (look in the UART section).

- Jan

ok,thankz