View Full Version : New PBP user
J. Mark Wolf
- 31st October 2005, 13:19
I'm a new PBP user and am porting a large program from another basic compiler.
In PBP I'm not clear as to how to fill a numeric array, then later refer to it specifically in OWOUT commands.
The code below is how it is done in the previous compiler
Sensor0 bytetable $28,$9e,$50,$1b,$00,$00,$00,$85 'DS18B20 ID code
OWOUT w1,1,[MatchROM,STR Sensor0\8,ReadScratch] 'send ID code
Can someone on the forum please jot down the equivalent PBP code here?
TIA
crematory
- 31st October 2005, 17:46
Hello
[quote]
SensorID VAR BYTE[8] 'DS18B20 ID array
' DS18B20 ID intialization
SensorID[0] = $28
SensorID[1] = $9E
\/
\/
\/
SensorID[7] = $85
For the OWOUT command, you better read about it in the manual....
bye
J. Mark Wolf
- 31st October 2005, 18:37
So then, a FOR/NEXT loop and a LOOKUP table is the most practical way to do this PBP?
for i = 1 to
LOOKUP 1, [$28,$9e,$50,$1b,$00,$00,$00,$85], sensor0
next i
crematory
- 31st October 2005, 19:59
your option is time consuming while looking for that value...
J. Mark Wolf
- 1st November 2005, 14:08
I'm not looking for a value, I'm just trying to load the array, so that I can subsequently refer to in my OWOUT command ("Sensor\8" indicated below).
OWOUT w1,1,[MatchROM,STR Sensor0\8,ReadScratch] 'send ID code
J. Mark Wolf
- 3rd November 2005, 02:09
I am finally able to fill my string array but it is UGLY! The following code works, but it barks!
for x = 0 to 3
lookup x,["0",".","0","0"],y
RevLevString(x) = y 'load string array with "0.00"
next x
'
for x = 0 to 19
lookup x,["O","C","T"," ","2","5",","," ","2","0","0","5"," ","9",":","2","5","p","m"," "],y
RevDateString(x) = y 'load str array with "OCT 25, 2005 9:25pm"
next x
A competing product accomplishes the same thing as follows:
RevLevString bytetable "0.96"
RevDateString bytetable "OCT 01, 2005 7:25pm "
Is there a more elegant way to fill a string array in PBP?
Melanie
- 3rd November 2005, 07:06
You can also load your string by storing it in Program Codespace (several threads on this forum on this topic), or by storing it in internal or external EEPROM. Again a small For/Next Loop will accomplish the loading.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.