MSRS-Bluetooth-Boe-Bot can't word after changing BS2p24 chip
Hello, I change BS2 chip to BS2p24 chip on MSRS-Bluetooth-Boe-Bot, but it can’t work, I try to debug in BS2 code of “BoeBotControlForMsrs.bs2” , it break at this function ·“Wait_For_Confirm”.
·
·
it’s an infinite loop in BS2p24 chip, but it can work in BS2 chip.
Someone to tell me how to fix this problem. thx.
·
Confirm_Connect:
pointer = ConnectionGranted
GOSUB Get_Packet
Wait_For_Confirm:
SEROUT 1, 84, [noparse][[/noparse]255, 0, 1, 0, 0]
[color=red]SERIN 0, 84, 20, Wait_For_Confirm, [noparse][[/noparse]WAITSTR buffer \ 2,
buffer2, buffer3,
buffer4][/color]
·
it’s an infinite loop in BS2p24 chip, but it can work in BS2 chip.

Someone to tell me how to fix this problem. thx.

Comments
-Stephanie Lindsay
Editor, Parallax Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
'**************** 'Conditional code '**************** #SELECT $STAMP 'PULSOUT Scaling #CASE BS2 POScale CON $0100 #CASE BS2P POScale CON $0280 #ENDSELECT #SELECT $STAMP 'PULSIN Scaling #CASE BS2 PIScale CON $0100 #CASE BS2P PIScale CON $0280 #ENDSELECT #SELECT $STAMP 'FREQOUT Duration Scaling #CASE BS2 FODScale CON $0100 #CASE BS2P FODScale CON $03C6 #ENDSELECT #SELECT $STAMP 'FREQOUT Freq Scaling #CASE BS2 FOFScale CON $0100 #CASE BS2P FOFScale CON $0044 #ENDSELECT #SELECT $STAMP 'Baud Rates #CASE BS2 T1200 CON 813 T2400 CON 396 T4800 CON 188 T9600 CON 84 T19K2 CON 32 T38K4 CON 6 #CASE BS2P T1200 CON 2063 T2400 CON 1021 T4800 CON 500 T9600 CON 240 T19K2 CON 110 T38K4 CON 45 #ENDSELECTThe baud rates section defines a set of constants based on the processor type that can be used in SERIN and SEROUT. i.e. SEROUT 2, T19K2, [noparse][[/noparse]$59, $03, $01]
The Scaling factors at the top are used to scale the values used in PULSIN, PULSOUT and FREQOUT. These scaling factors are used in conjunction with the Multiply Middle (*/) operator to arrive at the proper values based on the processor being utilized.
Example: PULSOUT 7, 5 */ POScale·· will produce the same Duration (10 microseconds) for both a BS2 and a BS2p
The units of duration for the BS2 is 2 microseconds, for the BS2p it's .8 microseconds, therefor you need to multiply the BS2 units by 2.5 to get the BS2p units, but the Basic Stamps only does integer math.
The */ operator effectively multiplies by a number of 256ths, so "*/ $0100" ·in effect is multiplying the number by 256/256 or 1 (the BS2 scaling factor is $0100).
If we multiply 2.5 (our actual scaling factor) by 256, we get 640. We then convert that to HEX $0280 and we have our final scaling factor (conversion to HEX is optional but it keeps the units and decimal parts seperate and is a bit easier to read.
The same example code above running on a BS2p will use its·scaling factor ($0280 or 640/256) to produce the same duration of 10 microseconds. The same is true for the other scaling factors whether you need to scale up or down from the BS2 that I use for baseline values.
You can study the "Conditional Compilation Directives" section of the Basic Stamp Editor help files for even more ways to make you code chip independent.
Hope this helps you with the move to the BS2p, sx or px
Steve
Post Edited (Duffer) : 4/19/2007 1:59:18 AM GMT