PDA

View Full Version : I've got to be missing something



Perrin`
- 18th July 2008, 17:10
As the title says... I need to do something rather simple but for some reason I cannot think of an easy way to do it. I know that there has to be one.

I'm recieving serial data and at the moment storing it bit by bit into a vector. For example 90.00;1.12;130.34

Vector(1)=9
Vector(2)=0
Vector(3)="."
...

So these numbers can vary in size and number of digits.


I need to basically do the DIG command backwards...

B0=123
B1=B0 DIG 1

This sets B1= 2.

What I need is to take Vector(1) and Vector(2) and put them together in 1 variable. Which in this case would be 90

skimask
- 18th July 2008, 17:21
Are you receiving the data as ASCII characters or as binary values?
In other words, in your example above...
Vector(1) --- is that a '9' as an ASCII character 9, ASCII value of $39 (57 decimal)?
Or 9 as in $09, %1001, decimal 9, as in I've got 9 fingers up, and one finger down?

If you're savvy enough (I like using that word savvy here lately :) ), you could look in the PBP manual under the SERIN2 statemen, and look at the DEC and WAIT modifiers. It just might (ok probably will) take care of everything for you without having to write a conversion routine.

Perrin`
- 18th July 2008, 17:25
decimal 57

skimask
- 18th July 2008, 17:36
decimal 57
Ok, again, look carefully at the SERIN2 command and it's modifiers.

What exactly is the format of the string you are receiving? How is it terminated (if at all)?

Perrin`
- 19th July 2008, 00:26
I've solved the problem in another way.

skimask
- 19th July 2008, 00:27
I've solved the problem in another way.
How did you do it?