BS2px can't find PSC
Hello, as I am new on stamp. Can anybody tell me why I always get error " undefind label " message for FindPSC on line SERIN? Thks,
Ricky
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM6}
Sdat····· PIN···· 15
Baud····· CON···· 84
buff····· VAR···· Byte(3)
· DEBUG·· "Finding PSC",CR
· SEROUT Sdat, Baud+84, [noparse][[/noparse]"!SCVER?",CR]
· SERIN· Sdat, Baud+84,FindPSC,[noparse][[/noparse]STR buff\3]
· DEBUG·· "PSC ver: ", buff(0), buff(1), buff(2),CR
· STOP
Ricky
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM6}
Sdat····· PIN···· 15
Baud····· CON···· 84
buff····· VAR···· Byte(3)
· DEBUG·· "Finding PSC",CR
· SEROUT Sdat, Baud+84, [noparse][[/noparse]"!SCVER?",CR]
· SERIN· Sdat, Baud+84,FindPSC,[noparse][[/noparse]STR buff\3]
· DEBUG·· "PSC ver: ", buff(0), buff(1), buff(2),CR
· STOP
Comments
I guess the best answer is because you copied the program incorrectly from the manual. Here's what it should look like:
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM6}
Sdat PIN 15
Baud CON 84
buff VAR Byte(3)
FindPSC:
DEBUG "Finding PSC",CR
SEROUT Sdat, Baud+84, [noparse][[/noparse]"!SCVER?",CR]
SERIN Sdat, Baud+84,FindPSC,[noparse][[/noparse]STR buff\3]
DEBUG "PSC ver: ", buff(0), buff(1), buff(2),CR
STOP
Just as a matter of information, I suspect your baudmode is incorrect.
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 9/28/2006 9:11:52 AM GMT
Ricky
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM6}
Sdat PIN 15 ' Serial Data I/O pin
Baud CON 396 ' Constant for 2400 baud
buff VAR Byte(3) ' temporary variable
FindPSC: ' Find and get the version
DEBUG "Finding PSC ",CR ' number of the PSC
SEROUT Sdat,Baud+$8000,[noparse][[/noparse]"!SCVER?",CR]
SERIN Sdat,Baud,500,FindPSC,[noparse][[/noparse]STR buff\3]
DEBUG "PSC ver: ",buff(0),buff(1),buff(2),CR
STOP
Thks,
Ricky
Ricky
I answered this question for you 10 minutes ago. The label "FindPSC" is missing, as it states. I even went so far as to copy the program and insert it in the correct place. See the above message, as it appears there as well.
If you're asking why it's there, you may want to consult the PBASIC Reference Guide or the PBASIC Help File for the proper syntax for the SERIN command. Either/both can be downloaded for FREE from the Parallax web site "Downloads Section".
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
I am·checking·on reference manual now.
bst rgds,
Ricky
I just reaized there is one more typo in the program you entered. This show s why a copy-and-paste approach is much better than hand coding examples. The revised program is below with both necessary changes noted ('·^^^^^ ).
Sdat PIN 15
Baud CON 84
buff VAR Byte(3)
FindPSC:
'^^^^^
DEBUG "Finding PSC",CR
SEROUT Sdat, Baud+84, [noparse][[/noparse]"!SCVER?",CR]
SERIN Sdat, Baud+84, 500, FindPSC, [noparse][[/noparse]STR buff\3]
'······························· ^^^
DEBUG "PSC ver: ", buff(0), buff(1), buff(2),CR
STOP
=====
My apologies for not catching that the first time around.
Regards,
Bruce Bates
Ricky -
I just reaized there is one more typo in the program you entered. This show s why a copy-and-paste approach is much better than hand coding examples. The revised program is below with both necessary changes noted ('·^^^^^ ).
Sdat PIN 15
Baud CON 84
buff VAR Byte(3)
FindPSC:
'^^^^^
DEBUG "Finding PSC",CR
SEROUT Sdat, Baud+84, [noparse][[/noparse]"!SCVER?",CR]
SERIN Sdat, Baud+84, 500, FindPSC, [noparse][[/noparse]STR buff\3]
'······························· ^^^
DEBUG "PSC ver: ", buff(0), buff(1), buff(2),CR
STOP
=====
My apologies for not catching that the first time around.
Regards,
Bruce Bates