Are there errors in the current version of the Basic Stamp IDE???
jknightandkarr
Posts: 234
in BASIC Stamp
First off here's this:
1) The line "Main:" I get the response "ERROR: Undefined Symbol" but the Line "Reset:" is apperently JUST FINE........ How can "Main:" have an issue when "Reset:" is fine????? And they are written the same way as the book, except for the comment lines. I know it's been quite a while since my Basic Stamp skills have been used, and I expect to screw up some, but this isn't making sense.
2) The "DO" part of the "DO.....LOOP" gets me "ERROR: Expected a constant, variable, unary operator, or '(' " I have it written the SAME way as printed in the StampWorks v2.1.pdf pg 144, with the added extra stuff written in the same format... The line "GOSUB Button0" I thought might have been an issue, the label is made but no code yet. Commented out, but no change. I saw a few errors I did, but those errors shouldn't cause this and fixed before and as I found em. So far nothing fixes this.....
The only thought's I have is the BS2 IDE is pissed off at me from not using it for few years. But I have a feeling this is probly NOT the issue. LOL Thanks if anyone spots what the issue is, cause I am out of ideas.........
Joe
EDIT: On " "Status ..........", CR," I removed the ", CR," and that let me check memory map, but it shouldn't effect the Do..Loop.. I know the next Debug command in the "Main:" was left out, but that shouldn't cause it.
' {$STAMP BS2} ' {$PBASIC 2.5} 'Setup I/O Pins Clock PIN 0 'Shift Register Clock SerData PIN 1 'Serial Data Latch PIN 2 'Output Latch Load1 PIN 3 'Input Load 1 (Buttons) Load2 PIN 4 'Input Load 2 (Settings) Audio PIN 5 'DTMF Output 'Con DelayTime CON 100 'Delay Time 1/10th sec 'Variables Buttons VAR Bit(10) 'Controll Buttons Settings VAR Bit(10) 'On/Off or Momentary? 1=On/Off, 0=Momentary Relays VAR Bit(10) 'The Output Relays DTMF VAR Nib '16 different DTMF Tones 'Startup Reset: LOW Latch HIGH Load1 HIGH Load2 DEBUG CLS, "Buttons 9876543210", CR, "------- ----------", CR, "Status ..........", CR, 'Main Program Main: DO GOSUB Get_165A 'Get status of buttons GOSUB Get_165B 'Get status of button setup GOSUB RandomDTMF 'Play DTMF Tone 'GOSUB Button0 GOSUB Put_595 'Update relays PAUSE DelayTime 'Pause 1/10th second LOOP 'Subroutines Get_165A: PULSOUT Load1, 5 'Load inputs SHIFTIN SerData, Clock, MSBPRE, [Buttons] 'Shift in data RETURN Get_165B: PULSOUT Load1, 5 'Load settings SHIFTIN SerData, Clock, MSBPRE, [Settings] 'Shift them in RETURN Put_195: SHIFTOUT SerData, Clock, MSBFIRST, [Relays]'Send pattern to relays PULSOUT Latch, 5 'latch 595 INPUT SerData 'Float data lione RETURN RandomDTMF: RANDOM DTMF DTMFOUT 5, 500, 500, [DTMF] RETURNI can't even start to check my program as for some odd reason the IDE will NOT let me check memory map or upload I am getting some odd errors that according to documentation, DON'T make sense... I am writing a similar program for the Propeller, but for the heck of it, decided to try my BS2 & BS2pe to do the same thing, but here is what's going on:
1) The line "Main:" I get the response "ERROR: Undefined Symbol" but the Line "Reset:" is apperently JUST FINE........ How can "Main:" have an issue when "Reset:" is fine????? And they are written the same way as the book, except for the comment lines. I know it's been quite a while since my Basic Stamp skills have been used, and I expect to screw up some, but this isn't making sense.
2) The "DO" part of the "DO.....LOOP" gets me "ERROR: Expected a constant, variable, unary operator, or '(' " I have it written the SAME way as printed in the StampWorks v2.1.pdf pg 144, with the added extra stuff written in the same format... The line "GOSUB Button0" I thought might have been an issue, the label is made but no code yet. Commented out, but no change. I saw a few errors I did, but those errors shouldn't cause this and fixed before and as I found em. So far nothing fixes this.....
The only thought's I have is the BS2 IDE is pissed off at me from not using it for few years. But I have a feeling this is probly NOT the issue. LOL Thanks if anyone spots what the issue is, cause I am out of ideas.........
Joe
EDIT: On " "Status ..........", CR," I removed the ", CR," and that let me check memory map, but it shouldn't effect the Do..Loop.. I know the next Debug command in the "Main:" was left out, but that shouldn't cause it.
Comments
My students make that mistake a lot and so I looked for it from your descriptions.
I then copied your program into MacBS2 and did a check syntax after deleting that comma. My only problem in your code was the GOSUB Put_595 and when I commented that line out, your program compiles fine.
I am a teacher and all of my bots are at school right now, but your program seems fine with what I did above, so you may want to check and see if something is going on with the USB drivers.
Hope this helps.
Tim
After those two errors were corrected Map and Syntax check gave their blessings to your prose.
Joe
Joe
I need to go through the What is a microcontroller? Txt again..... So used to the Prop I keep screwing up....
Joe
Edit1: I changed PIN to CON, that fixed that, now my IF THEN ELSE statements are screwy. The ide telling me that ELSE being treated as a lable. I know this laptop I am using to write code not the best, but shouldn't cause these issues....
Edit2: Ok I found the fix, some how the $ got removed from the ' {$STAMP BS2} & ' {$PBASIC 2.5} lines, so thats fixed. Probly got deleted when I changed the $ to % the laptop sometimes will move the cursor for some odd reason... Now on the IF THEN ELSE commands, does it have to be or can I use
I keep getting 'ELSE' must be preceded by 'IF' or 'CASE'
Joe
Joe
I made the following changes and Syntax Check doesn't gripe;
In your posting there are many more of these errors.
I can't tell why moving the GOSUB Onoff0 to a separate line makes it work, but it does.
Hal
Joe
On page 474 of the BASIC Stamp Reference Manual (page 478 of the PDF) is a chart that shows which commands were added in PBASIC 2.5.
The Stamps-In-Class text "Industrial Control" was written in PBASIC 2.0 and the program flow is much more "spaghetti"-like compared with the later written "Process Control".
IF...THENs would "jump" to another place in the program and GOTO Main or Loop was also common.