Change the name back to USART.BAS. Either put it in your project folder, or better yet you can place it in the Swordfish/UserLibrary folder.
When SF looks for an include file, it looks in the following folders (in this order)
1) the project folder
2) Swordfish/UserLibrary
3) Swordfish/Library
The first one it finds is the one it uses.
Also, try this code and see what happens
Code: Select all
// device and clock...
device = 18F67J60
clock = 25
config FOSC = HSPLL
config FOSC2 = ON
config CP0 = OFF // Turn Code Protect On And Off
#option USART_BRGH = true
#option USART_BRG16 = true
include "DL_Timer.bas"
include "utils.bas"
include "USART.bas"
include "Convert.bas"
include "isrrx.bas"
dim LED as PORTB.5
dim LED1 as PORTB.4
dim VID_SWITCH as PORTB.3
// variables...
dim RXData(12) as byte
dim ByteCount as byte
dim I as byte
dim DelayTime as word
dim SecCount as word
dim PacketFlag as boolean
dim TMR0IP as INTCON2.2
const ipLow = 1, ipHigh = 2
event LEDFlash()
toggle(LED)
SecCount = SecCount + 1000
end event
interrupt Timer0_ISR(ipLow)
if Timer0.InterruptFlag =1 then
Timer0.SInterrupt()
endif
end interrupt
PacketFlag = false
ByteCount = 0
DelayTime = 10000
SecCount = 0
// setup serial port, ISRRX, etc
// clear buffer to start
output(LED)
output(LED1)
output(VID_SWITCH)
USART.SetBaudrate(br4800)
ISRRX.Initialize // init the ISRRX module!
TMR0IP = 0 // set tmr0 intr to low priority
Timer0.Initialize(LEDFlash)
Timer0.SetPrescaler(Timer0.PS256)
Timer0.EightBit = 0
Timer0.Preload=49911
Timer0.EnableInterrupt()
Timer0.Enabled()
enable(Timer0_ISR) ' Start Interrupts
while true
if SecCount = DelayTime then
USART.Write("Hello World",13,10)
toggle(LED1)
SecCount = 0
end if
while ISRRX.DataAvailable()
RXData(ByteCount) = ISRRX.ReadByte()
inc(ByteCount)
if (ByteCount = 12) then
PacketFlag = true
break // exit 'while' loop if packet received
endif
wend
if (PacketFlag) then
USART.Write("Byte Count Value Is ",DecToStr(ByteCount), 13 ,10)
' Timer0.Disabled()
// echo packet back out the uart
for I = 0 to (ByteCount-1)
USART.WriteByte(RXData(I))
next
if ((RXData(0) = $FE) and (RXData(1) = $1F) and (RXData(3) = $04)) then
USART.Write("MATCH",$13,$10)
toggle(LED1)
endif
// prepare for next packet
ByteCount = 0
PacketFlag = false
' Timer0.Enabled()
endif
wend