Yes there is an excellent way and is called DT-Instant Interrupts!
Ioannis
It seems you do not read, or not read carefully.
Your PIC has USART.
USART has Interrupt that has nothing to do with PORTB.0 INT interrupt.
Darrels Interrupts cover all possible Interrupt sources of a PIC. You just have to enable th appropriate interrupt.
Example follows. On a terminal press key "1" to see the effect. (Not tested...)
IoannisCode:INCLUDE "DT_INTS-14.bas" ' Base Interrupt System INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler RX_INT, _Get_char, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @ INT_ENABLE RX_INT ; enable UART RX interrupt loop: if mybyte="1" then hserout "I got it!" mybyte=0 endif goto loop '---[USART RX Interrupt handler]---------------------------------------------------- Get_char: hserin 100,noreceived,[mybyte] 'Get byte noreceived: 'or if timeout return @ INT_RETURN
P.S. As a homework do set the USART parameters with DEFINE's to 9600
I'm not english spoken, but USART is on RB.1 (RX), I can not use that PIN, just RB.6 for incoming data, and RB.6 as far as I know, can not be managed with interrupts.
It's a finished PCB and I'm trying to add some features, but can't change the hardware, otherwise this problem will be very easy to solve, still don't know hoy can DT-Interrupts can be applied here
Regards
i don' know if your application will allow for it, but you can try adding polling throughout your code to have smaller wait times during the check and look for and use the wait command in serin2
If you can adjust your transmitting device add a bunch of dummy spaces before the transmission so if you miss 1 or 2 no big deal, you weren't going to use them anyway. I''ve used something similar in the past.Code:main: ... normal stuff gosub get_data ... more normal stuff gosub get_data ... more normal stuff goto main get_data: serin2 Serial_IN, 84, 50, nodata, [wait (129), x] nodata: return
If it is one off then I suggest to re-design your PCB. You won't have satisfactory results whatever you do besides the Interrupts generated by the USART.
There may be plenty of ideas, but will not respond fast enough.
Ioannis
RB6 can use Interrupt on change, so yes you can use it.
It show one problem though, it will detect the Start-Bit... so there's big chance that SERIN/DEBUGIN/SERIN2 will not work as expected. But you could roll your own serial routine which will ignore the start-bit. This will work or not depending of your Baudrate and if you go on a ASM or PBP interrupt + home made serial routine. When using Darrel's instant interrupt with PBP type, it need some time to save/restore PBP systems var. Have a look at the following
http://darreltaylor.com/DT_INTS-14/kudos.html
If you create your own PC software, OR if you create your own transmitter with another PIC... then it open a few other possibilities.
But yeah, when at all possible, I prefer the USART interrupt as well.
Last edited by mister_e; - 29th April 2009 at 18:09.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks