Take a quick look around the 1 and 2Code:@ INT_DISABLE RX_INT ; Disable RX Interrupt hserin 100,timeout [databyte[1], databyte[2]] @ INT_ENABLE RX_INT ; Enable RX Interrupt @ INT_RETURN![]()
Take a quick look around the 1 and 2Code:@ INT_DISABLE RX_INT ; Disable RX Interrupt hserin 100,timeout [databyte[1], databyte[2]] @ INT_ENABLE RX_INT ; Enable RX Interrupt @ INT_RETURN![]()
Hi Skimask,
thanks for the reply. I will try with square brackets tomorrow. I started using round brackets for array addressing when inside a square bracket statement, like HSERIN, a short while ago after reading a post by Darrel. I will try the square brackets tomorrow and let you know if it makes any difference
Cheers
Rob
Oops - my post just crossed with Darrel's - thanks for the replies - I will try your example tomorrow Darrel and see what's occurring (hopefully!)
Cheers
Rob
Last edited by Rob; - 10th March 2008 at 20:40. Reason: Removed Quote
Rob,
Have you tried the str with hserin? Hserin[str time\7] will (should,) grab seven bytes, I've used this with Darrel's Instant Interrupts to capture over forty bytes without problem.
Jerry.
If your oscilloscope costs more than your car...
Yup, Square brackets will cause an error when they are inside other square brackets.
There's no need to DISABLE/ENABLE inside the handler. An interrupt source can't interrupt itself like it would in ON INTERRUPT.
But I think what's happening is that the handler is being called multiple times before the rest of the program see's the data.
As a test, try something like this ...This should return the first 2 bytes then disable the RX_INT.Code:hserin 100,timeout [databyte(1), databyte(2)] @ INT_DISABLE RX_INT ; Disable RX Interrupt @ INT_RETURN
The USART will overflow and stop working after that unless it is re-enabled quickly.
I'm not saying this is the way to properly receive data in an interrupt.
It's just a test to help understand what's going wrong.
<br>
DT
Following up on the Square brackets vs Round brackets ...
I honestly thought it was a PBP problem.
But with further investigation, I've found it to be a MicroCode Studio problem that only happens during an ICD compile.
Possibly first discovered by Bruce.
http://www.picbasic.co.uk/forum/showthread.php?p=23772
Which means that it only comes into play with HSEROUT/IN statements.
So I guess it's still a good idea to use Round brackets inside Square brackets, in case you ever plan on using the ICD.
But it also looks better for the programs that won't.
HTH,
EDIT: Good timing ski.
Last edited by Darrel Taylor; - 10th March 2008 at 23:53. Reason: ski's timing
DT
Hi Darrel,
thanks for your help on this one - it really had me stumped!
Cool - I didn't realise that!There's no need to DISABLE/ENABLE inside the handler. An interrupt source can't interrupt itself like it would in ON INTERRUPT.
I have tried what you asked me to above and it works every time! I've got it capturing all the bytes now by:But I think what's happening is that the handler is being called multiple times before the rest of the program see's the data.
As a test, try something like this ...This should return the first 2 bytes then disable the RX_INT.Code:hserin 100,timeout [databyte(1), databyte(2)] @ INT_DISABLE RX_INT ; Disable RX Interrupt @ INT_RETURN
The USART will overflow and stop working after that unless it is re-enabled quickly.
(the duplicate; databyte(0), databyte(0), just removes the $FD as I don't need it)Code:hserin 100,timeout, [databyte(0), databyte(0), databyte(1), databyte(2), databyte(3), databyte(4), databyte(5)] @ INT_DISABLE RX_INT
I'm now trying to re-enable the interrupt at some point after the data has been read by the rest of the program but it's not working at the moment. I will keep trying and update this thread later.I'm not saying this is the way to properly receive data in an interrupt.
It's just a test to help understand what's going wrong.
<br>
Cheers to all
Rob
Right, I was definitely being stupid!
There were actually 8 bytes of data being sent (the colons aren't sent nor are the spaces or slashes);
$FD SS:MM:HH DD/MM/YYYY
This meant that RCIF was being set again by the extra YY before I was doing anything with the data in my program. Thanks very much Darrel, I wouldn't have found this if you hadn't pointed me in the right direction.
Darrel, this is for a small project for my work and I was wondering if you would allow me to include your code in the finished item please? I know you've said to people in the past that they could but I thought I had better ask out of courtesy. I know you say keep the internet free, but obviously hosting your webpage costs YOU money so I wondered if you had anywhere to donate to help with these costs? I can't find anywhere on your webpage.
Cheers
Rob
Of course, you can use it to your hearts content.
The only thing I ask of anyone is....
"Don't remove my name and act like you wrote it."
Not saying you would, that's just my only rule.<hr>
Thank you for the offer of donation.
I really don't need the money, but if you wanted to make me feel like my program was worth it ...
Find you're local school for blind children. Every city has at least one.
Toss them a few bucks. Doesn't have to be alot.
Show me the receipt, and I'll rewrite your program for you, because it's still got some problems to be worked out in that RX handler.
<br>
DT
Thanks very much! Rest assured - I won't remove your name from it - you deserve massive credit for the hard work you've put into it!
I REALLY WILL have a look for our local school for blind children (not because I want you to re-write my program though!).I really don't need the money, but if you wanted to make me feel like my program was worth it ...
Find you're local school for blind children. Every city has at least one.
Toss them a few bucks. Doesn't have to be alot.
Show me the receipt, and I'll rewrite your program for you, because it's still got some problems to be worked out in that RX handler.
<br>
Thanks again
Rob
That has to be one of the most kind hearted things I've heard in a long time. Just confirms what I've always thought you were like Darrel..;o}
I will make an offer here too since kids are my favorite people. Fax or email me a copy of this, along with proof-of-purchase for PBP (gotta do the distributor thing you know), and I'll make sure you receive the next 2 new releases of PBP on CD free of charge.
Just let me know which new version you want, and it's on the way..;o}
P.S. Darrel will also get 2 new releases.
Last edited by Bruce; - 11th March 2008 at 21:45.
Bookmarks