Would something like this work?
Code:[STR NUMS\16] X1 = (NUMS[1]-"0") X2 = (NUMS[3]-"0") X3 = (NUMS[5]-"0") X4 = (NUMS[7]-"0") X5 = (NUMS[9]-"0") X6 = (NUMS[11]-"0") X7 = (NUMS[13]-"0") X8 = (NUMS[15]-"0")
Would something like this work?
Code:[STR NUMS\16] X1 = (NUMS[1]-"0") X2 = (NUMS[3]-"0") X3 = (NUMS[5]-"0") X4 = (NUMS[7]-"0") X5 = (NUMS[9]-"0") X6 = (NUMS[11]-"0") X7 = (NUMS[13]-"0") X8 = (NUMS[15]-"0")
Dave
Always wear safety glasses while programming.
Do the 3 bytes ever represent more than 255?
If not, this might work ...
But there's a distinct possibility of getting the wrong numbers if there's nothing between the 3 byte data packets.Code:For LoopCount = 0 to n-1 HSERIN [DEC3 array(LoopCount)] Next LoopCount
DT
Maybe ideas here
http://www.picbasic.co.uk/forum/show...05&postcount=2
Dave
Always wear safety glasses while programming.
Thanks boys.
Currently, I do a simple 28bytes communication between radio modems using DT instant interrupts to get the Serial data like this:
If data are coming to the serial port, then if the 2 first are ## data are captured in the temp_array (28 long)Code:Get_char: ser_in=0 hserin 100,noreceived,[wait("##"),str temp_array\file] 'Get 28 characters if temp_array[0]=node then 'Are for this node station? ser_in=1 'if yes, then flag data and copy endif noreceived: 'else return @ INT_RETURN
The first byte is the node station. If data are for this node, then a flag is raised.
My concern is that, data can be any number including the $23 which is '#' character.
So this might lead the routine to hang if data are out of sync sometime.
My thought was to use data in the array only in ascii form without increasing length of temp_array x 3, by converting the ascii values while receiving them.
Ioannis
Please see the previous than yours post, that shows the timeout is there. But Darrel has explained very well why this might hang here:
http://www.pbpgroup.com/modules/newb..._id=28&forum=8
Ioannis
OOPPS, I was sleepy?
That was interesting, I now have it bookmarked.But Darrel has explained very well why this might hang here:
http://www.pbpgroup.com/modules/newb..._id=28&forum=8
Ioannis
Just curios, is that the same project?
Dave
Always wear safety glasses while programming.
Bookmarks