PDA

View Full Version : Need help converting to PB Pro from Mbasic Pro



tcbcats
- 11th February 2004, 08:43
Need help converting code to PB Pro

I have three bytes of data in a string that represents a hex number. Between “000000” and “FFFFFF”
The MSB is not needed because the highest end value will only go to $FFFFF
The Hex data in the three bytes looks like this:
$00, $08, $00
In this example, this represents the hex value 800 and the decimal value of 2048.

I need to convert the collected 3 bytes into 5 bytes where each byte represents one of the positions in the field.

The code to do this in Mbasic is as follows:

Data is in a string var as ….
Payload(0), = $00
Payload(1), = $08
Payload(2), = $00

Sending this to internal flash looks like this:
WriteDM 0, [HEX Payload(0)\1,HEX Payload(1)\2,HEX Payload(2)\2] ;***

The data is now in 5 bytes of flash that can be read into another string that is 5 bytes long.
Example:
ReadDM 0, [MYID(0),MYID(1), MYID(2),MYID(3), MYID(4)]


In PB Pro, I know how to do the “READ” and “WRITE” functions but I have not figured out how to do the required byte shifts needed to do get the same results in PB Pro.

How would one do the *** line in PB Pro?


My next question is how to get the now 5 bytes of data into a word so the value can be sent serially as 800 hex or 2048 Decimal using the standard serial modifiers. I have code that works for this in Mbasic but I have not figured out how to do it in PB Pro.


Thanks.
tcbcats