xvISRRX on Q41
Posted: Sat Jun 04, 2022 4:51 am
Hello again, I have been trying to get the most out to the Q41 Chips, and getting into a little bit of trouble, oane again kinda lost...
I was able to define simple interrupt by reading the examples posted by Jerry about the IVT module, then I found that exist is a version of the ISRRX that is supposed to work with the VIC chips, I spent hours testing, analizing and comparing the xvISRRX Library and try to make the ISRRX Help File example using the xvISRRX Library but had no results...
there is the code I am trying to make work (That oviously works weel on the older chips using the old ISRRX Lib)
On the terminal I got the "START TEST ISR", but when I send someting nothing happens... (on the older chip with the old ISRRX lib I got the response correctly...)
Am I doing something wrong?
I was able to define simple interrupt by reading the examples posted by Jerry about the IVT module, then I found that exist is a version of the ISRRX that is supposed to work with the VIC chips, I spent hours testing, analizing and comparing the xvISRRX Library and try to make the ISRRX Help File example using the xvISRRX Library but had no results...
there is the code I am trying to make work (That oviously works weel on the older chips using the old ISRRX Lib)
Code: Select all
Device = 18F16Q41 'Automatically brings in device file 18F16Q41.bas
Clock = 64 '64MHz
Config FEXTOSC = HS,
RSTOSC = HFINTOSC_64MHZ
Include "pps.bas"
#option USART_RX = PORTB.5
#option USART_TX = PORTB.7
Include "USART.bas"
#option RX_BUFFER_SIZE = 250
#option RX_PRIORITY = ipLow
Include "xvISRRX.bas"
// RX OnData() event...
Sub OnData()
// ignore CR and LF...
If ISRRX.DataByte = 13 Or ISRRX.DataByte = 10 Then
ISRRX.ProcessByte = false
// replace period with space character...
ElseIf ISRRX.DataChar = "." Then
ISRRX.DataChar = " "
EndIf
End Sub
Public Sub InitPPS()
'Module: UART pin directions
Input(PORTB.5) ' Make RX1 pin an input
Output(PORTB.7) ' Make TX1 pin an output
'Module: UART1
U1RXPPS = $000D 'RB5 > RX1
RB7PPS = $0010 'TX1 > RB7
End Sub
' program start...
Output(PORTA.2)
Low(PORTA.2)
InitPPS()
USART.SetBaudrate(br9600)
ISRRX.Initialize(@OnData)
USART.write(13,10,"START TEST ISR",13,10)
' loop forever...
While true
DelayMS (500)
Toggle(PORTA.2)
' read data from the buffer and output...
While ISRRX.DataAvailable
USART.Write(ISRRX.ReadByte)
Wend
Wend
Am I doing something wrong?