'----------------------------------------------------------------------------
'                          RS232BUFFEROUT1.BAS
'                     (c) 2000-2002 MCS Electronics
'Sample demonstrates how to use a serial output buffer on the second UART
'this sample will only work for chips with a seond UART like the M161 and M128
'----------------------------------------------------------------------------
$regfile = "m161def.dat"
$baud1 = 9600
$crystal = 4000000

'setup to use a serial output buffer
'and reserve 20 bytes for the buffer
Config Serialout1 = Buffered , Size = 20
Open "Com1:" For Binary As #1

'It is important since UDRE interrupt is used that you enable the interrupts
Enable Interrupts
Print #1 , "Hello world"
Do
 Wait 1
 'notice that using the UDRE interrupt will slown down execution of waiting loops like waitms
 Print #1 , "test"
Loop
End


Close #1
