Possible pointers...
Finally had a chance to look at your code and I am wondering exactly what your are trying to accomplish with the interrupts and you are receiving a string into var P but I do not see where P is used.
A couple of things that might help you.
Like Darrel said about interrupts, get in and out as fast as you can.
That being said I think I would use the interrupt to receive data. This can be accomplished using DT's instants if you use the USART. I have only used DT's intants for this a time or tow and they worked great, thanks Darrel! There are examples on how to set it all up on his web site.
The only thing you would be doing inside the interrupt is receive data. The data will be processed else where. Using USART and interrupts you should not miss any data.
Now for the RF.
If you are using radio modules like the ones found at rentron.com then they need to be "trained" to receive data. This is done by sending a bunch of 0s and 1s. There is some controversy about this but sending $A5 first seems to work well. Also send a SYNK byte, this will take place of your MT3. You will wait for the SYNK.
Code:
TRAIN = $A5
SYNK = $7E
HSEROUT [TRAIN,SYNK,"your data will be here"]
In the receiver side, the interrupt will be triggered when the USART "hears" something. If the SYNK is not received then exit the interrupt. If SYNK is good save the data then exit the interrupt.
That might be enough to make it work but you may also want to add a simple checksum.
A quick and dirty way is to take the value you are sending, 41, and multiply by 3 before you send. That value would be saved into a VAR CH_SUM, = 123. Send 41 and CH_SUM.
When you receive save 41 to your code VAR and save CH_SUM also. Before you act on the data divide CH_SUM by 3 and check to see if it equals "code". If not you have had a bad transmission.
There are several ways to do this, the above is just one to give you some ideas.
Hope my babbling did not confuse the issue.
[/code]
Bookmarks