Copy USART.bas to your user library and add the following (replacing the two existing subs)
Code: Select all
Dim
FPacing As Word // write byte pacing (us)
// public variables...
Public Dim
Pacing As FPacing // write pacing (us)
{
****************************************************************************
* Name : WriteByte *
* Purpose : Write a Byte value To the hardware USART *
* : Wait Until ready To send Is enabled, Then send WREG Byte *
****************************************************************************
}
Public Sub WriteByte(pValue As WREG)
Repeat
ClrWDT
Until (ReadyToSend) // wait for transmitter to be available
TXRegister = WREG // load the byte into the txreg
If (FPacing > 0) Then // add any char pacing
while (TRMT = 0) // first, wait for the TSR to be empty
ClrWDT
end while
DelayUS(FPacing) // now, wait the specified delay time
EndIf
End Sub
{
****************************************************************************
* Name : WriteItem (OVERLOAD) *
* Purpose : Write a String value To the hardware USART *
****************************************************************************
}
Sub WriteItem(pText As String)
FSR0 = AddressOf(pText)
while (INDF0 <> 0)
WriteByte(POSTINC0)
end while
End Sub
// Module initialisation...
FPacing = 0