Hi,
Attached is the upgraded serial output command
subroutine. I?revised it to check the? ready bit before sending the output
character. Now, It doesn't need the delay and will not globber the output. Also, I added
a carry return at the beginning
of the line.
Check it out and let me know of any problem.
rosarite
*************************** Source Code? **********************
Option Explicit
'Baisc_Bx2
'program revision 6_2_2007
'Output data to com1 subroutine
'----------------------------- Main program? ----------------------------------
public output_data as string*20? 'output message variable
'***************************** program body ************************************
??? Public Sub Main()
dim count_char as byte
dim loop_1 as byte
dim var_char as byte
start:
var_char=1
output_data = "This is a test"??? ??? 'Load message to be output
call serial_output
'Print the alphabet characters from A to T
??? ??? for loop_1=65 TO 85
??? ??? ??? mid(output_data,var_char,1)=chr(loop_1)
??? ??? ??? var_char=var_char+1
??? ??? next
call serial_output
goto start
end sub
'********************************* output subroutine **************************
???? sub serial_output()
'For the BX24 7.37 MHz the UBBR = baud rate register should be set using the following
'values: 47=9600 31=14400 23=19200 15=28800 11=38400 7=57600 5=76800? 3=115200
'Warning the monitor port in the I/O Ports must be set manually to the same
'UBBR baud rate value for this routine to work.
dim loop1 as integer
dim mess_len as integer
mess_len = len(output_data)??? ??? ??? 'Check for message lenght
Register.UBRR=47??? ??? ??? ??? ? ? ? ? ? 'Set Baud rate setting? here
Register.UDR =asc(chr(13))??? ??? ??? 'Output carry return code??? ???
??? ??? ??? ???
??? for loop1 = 1 to mess_len
??? ??? do
??? ??? 'Check the status register bit 5 = ready to receive a new
??? ??? 'character for transmission
??? ??? 'USR is the UART status register
??? ??? loop until (getbit(Register.USR,5) = 1)
???? Register.UDR=asc(mid(output_data,loop1,1)) 'output data to uart port
??? next?????????????
end sub
'******************************************************************************
________________________________________________________________________
AOL now offers free email to everyone. Find out more about what's free from AOL at
AOL.com.
[Non-text portions of this message have been removed]

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )