ON 20030615@10:07:32 AM at page: http://www.sxlist.com/techref/scenix/lib/io/osi2/serial/rs232.htm JMN-EFP-786 James Newton Code:
In the clock, UART, etc. VP's, the assumption is that the processor is
running at 50 Mhz.  The constants that are used are:

int_period = 163		;period between interrupts
;
tick_lo = 80			;50000 = msec instruction count
tick_hi	= 195			; for 50MHz, turbo, prescaler=1 

To convert these for use at 4 Mhz, change the constants to:

int_period = 104		;period between interrupts
;
tick_lo = 160			;4000 = msec instruction count
tick_hi = 15			; for 4MHz, turbo, prescaler=1

That's all you need for the clock/timer VP's.  For the UART VP, here
are the settings for 2400 and 1200 BPS.  (at 4Mhz you can't go higher
than 2400, and I didn't bother to figure out anything lower than 1200)

; *** 2400 baud (at 50MHZ)
;baud_bit       =       7                       ;for 2400 baud
;start_delay    =       128+64+1                ; "    "    "
;int_period     =       163                     ; "    "    "
;
; *** 2400 baud (at 4MHZ)
baud_bit        =       4                       ;for 2400 baud
start_delay     =       16+8+1                  ; '    '     '
int_period      =       104                     ; '    '     '
;
; *** 1200 baud (at 4MHZ)
;baud_bit       =       5                       ;for 1200 baud
;start_delay    =       32+16+1                  ; '    '    '
;int_period     =       104                     ; '    '    '

I have tested the 2400 baud settings and it works.  I've not tested
the 1200 baud settings but the math follows and they should work.

Note that the time allowed in the ISR is significantly shorter with
these settings.  If you need more time in the ISR you could use 204
for int_period and adjust everything else accordingly.

William Phelps