What do I need to do to set up and use this feature:
On Interrupt UsartRX1Ready call XXX
how do I define what rx1 is?
where can I find documentation on the on interrupt command?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Interrupt by receive usart-1 will be enabled, then:
When some data is received via usart-1 an interrupt will occur, then XXX subroutine will be called, when executed the program will come back to the point where was interrupted.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But these are not interrupt pins, just usart pins, that's a harware module for rs232 comunication inside your PIC (if it has); you can enable an interrupt when some data is present at RX pin.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is what I got, but it is not working:
#chip 16F916, 4 'mhz
#config OSC=INTOSC, MCLRE=off, WDT=off
#mem 256 'Chip has 256 bytes
On Interrupt UsartRX1Ready call serial_in
lcdcon = 0
dim temp as byte
dim temp2 as byte
#define RecAHigh portc.7 off
#define RecAlow portc.7 on
Initser 1,r1200, 1+waitforstart, 8, 1, none, invert
dir portc.1 out
dir portc.7 in 'serial
main:
epread 1, aa
if aa = 1 then set portc.1 on
if aa = 0 then set portc.1 off
goto main
Sub serial_in
SerReceive 1, temp
SerReceive 1, temp2
temp = temp - 97 'a=1 b=2, etc
temp2 = temp2 - 48 ' sets number to actual not ascii value
EPWrite temp, temp2
End Sub
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There should be a help file named gcbasic.chm included with GCBASIC. If you can't access that, there's also online help. I've recently uploaded the help for the update.zip version of GCBASIC to http://gcbasic.sourceforge.net/newfiles/help/ .
What do I need to do to set up and use this feature:
On Interrupt UsartRX1Ready call XXX
how do I define what rx1 is?
where can I find documentation on the on interrupt command?
Interrupt by receive usart-1 will be enabled, then:
When some data is received via usart-1 an interrupt will occur, then XXX subroutine will be called, when executed the program will come back to the point where was interrupted.
but what pin is the interrupt on or where do i set it?
usart is a hardware inside your pic, it depends on the model you use, have a look to the datasheet of your pic, look for section:
Universal synchronous asynchronous receiver transmiter (USART) module.
Or in Pin Diagram look for RX and TX pins...
But these are not interrupt pins, just usart pins, that's a harware module for rs232 comunication inside your PIC (if it has); you can enable an interrupt when some data is present at RX pin.
thank you, finally some clarification
Here is what I got, but it is not working:
#chip 16F916, 4 'mhz
#config OSC=INTOSC, MCLRE=off, WDT=off
#mem 256 'Chip has 256 bytes
On Interrupt UsartRX1Ready call serial_in
lcdcon = 0
dim temp as byte
dim temp2 as byte
#define RecAHigh portc.7 off
#define RecAlow portc.7 on
Initser 1,r1200, 1+waitforstart, 8, 1, none, invert
dir portc.1 out
dir portc.7 in 'serial
main:
epread 1, aa
if aa = 1 then set portc.1 on
if aa = 0 then set portc.1 off
goto main
Sub serial_in
SerReceive 1, temp
SerReceive 1, temp2
temp = temp - 97 'a=1 b=2, etc
temp2 = temp2 - 48 ' sets number to actual not ascii value
EPWrite temp, temp2
End Sub
I think you are using software serial routines.
If you don't have it, download and use last update:
http://gcbasic.sourceforge.net/update.html
In folder: include/lowlevel , file: usart.h, there you can see hardware usart functions.
There should be a help file named gcbasic.chm included with GCBASIC. If you can't access that, there's also online help. I've recently uploaded the help for the update.zip version of GCBASIC to http://gcbasic.sourceforge.net/newfiles/help/ .
The page about On Interrupt is here: http://gcbasic.sourceforge.net/newfiles/help/oninterrupt.htm
so I read it, but It is a little confusing, what am I missing from my code to make it work?