PropGCC concantenate ?
Rsadeika
Posts: 3,837
Since I just purchased a FLiP module, I decided to write a diagnostic program for my Roomba 510. I noticed that in the OI manual, for the Roomba, a lot of the commands provide 2 data bytes of information, some are unsigned and some are signed.
I get the part where I have to use the fdserialRX() to capture the two bytes, but how do I combine the two bytes to have one variable. On an Internet search a lot of suggestions refer to the use of concat(), merge(), and others. That is all fine, but PropGCC does not support those commands. So, what is available, in PropGCC, to concatenate two data bytes?
Ray
I get the part where I have to use the fdserialRX() to capture the two bytes, but how do I combine the two bytes to have one variable. On an Internet search a lot of suggestions refer to the use of concat(), merge(), and others. That is all fine, but PropGCC does not support those commands. So, what is available, in PropGCC, to concatenate two data bytes?
Ray
Comments
For example, outside of a code section I have sometimes made lists:
1) ...
2) ...
...
8) ...
9) ...
There is no excuse for intentionally buggering that up!
Thank you for the suggestions.
Ray
You have two bytes, each of which 8 bits and can therefore represent unsigned integers from 0 to 255.
But we know that one of the bytes is the high byte of a 16 bit number, so it really represents numbers 256 to 65535.
So all we have to do in multiply the high byte by 256 and add the low byte:
But a multiply by 256 is the same as shifting the bits left by 8 places:
That shift is faster than a multiply.
All this is the same as in decimal. The number 34 is (3 * 10) + 4
It works out for signed numbers as well.
You probably want to use something like: checkVal = fdserial_rxReady(roomba) to check that there is a byte of data available, before any fdserial_rxChar(roomba) function calls. OR, use: someVal = fdserial_rxTime(roomba, someMillisecondsToWaitVal), which will get a byte from the receive buffer if available, or wait for up to timeout ms to receive a byte.
dgately
I am not sure what is going on with the AB WX, the program should be showing the same value as the FLiP module was showing. I have the AB WX drawing power from the Roomba, at the din plug. When I apply the CSstart() and CSsafe() to the Roomba, it does put the Roomba into the OI mode, so that shows that the Roomba is getting and responding to commands sent.
On the AB WX I am using P0 and P1 for the serial connections. Since it looks like an Rx problem, I am starting to wonder if having the WX module active, it is having an affect on the fdserialRx() function? Or should I be using anything but the P0 and P1 for the serial connections?
Ray
As a quick experiment, I used P2 and P3 on the AB WX, and now the volts function seems to be working correctly. So, now I am wondering if I got a bad P0 or P1 on my AB WX. I guess now I have to do some diagnostics on my AB WX. I just got this board last week, so it is a new board that I am working with.
Ray
What is an AB WX with an active WX module?
7)
8)
9)
I don't see the problem.
-Phil
If I cut and paste your post I get this:
6)
7)
8)
9)
Such corruption of user input is intolerable.
Ray
-Phil
6)<br />
7)<br />
8<b></b>)<br />
9)<br />
This is the insanity of the web.
Ray
Anyone else think fluff like emoticons and other such nonsense should be removed from the web?
As old as I am I can handle the idea of emoji and other such fluff.
After all, for better or worse, they are encoded into Unicode.
What I do violently object to is the corruption of one's text into something one did not write. Computers should not corrupt data.
That is just 💩
Edit: The last character of that last line is also corrupt. What I actually typed was "& # 1 2 8 1 6 9 ;"
Without all the spaces in it of course.
No argument from me on the data corruption aspect. I really liked the WYSIWYG word processors when they came along. Unfortunately lately they seem to have become WYSIWYMG, and I like to to get what I see all the time, not most of the time.
The only thing that needs to be fixed is the freaking forum software that's been dysfunctional since 2015.
-Phil