Syntax error - Label is missing ':' ???
alisha
Posts: 3
I'm trying to use a BS1 with a DS1302 time keeping chip & crystal. I'm using the demo code from parallax & I've changed the Compiler directives to the BS1 (since it was written for a BS2), but when I try to run it, it gives a Syntax error 174 - Label is missing ':".
Any suggestions? Is this error because the code was written for a BS2?
Any suggestions? Is this error because the code was written for a BS2?
Comments
' =========================================================================
'
' File...... DS1302_Demo.bs2
' Purpose... Demonstrate The DS1302 Clock & RAM Functions
' Author.... Chris Savage -- Parallax, Inc.
' E-mail.... csavage@parallax.com
' Started...
' Updated... 10-09-2005
'
' {$STAMP BS1}
' {$PBASIC 1.0}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
' This code demonstrates the use of the DS1302 RTC/RAM Chip with the BASIC
' Stamp 2 Microcontroller, making easy use of the 12 Hour & 24 Hour time
' modes, as well as accessing the RAM. The sample code will use the DEBUG
' window for input and output for simplicity. You can change the output
' to the device of your choice. For example, using a Parallax Serial LCD
' requires very few changes to the code to use it for output.
' A modified version of this code was adapted to display the date and time
' on a Parallax Serial LCD Display (#27976), also with backlight (#27977)
' and on Parallax Professional Development Board (#28138, coming soon!)
' using a MAX7219 8-Digit Display Driver.
' This code will work on all BS2 Stamp Modules. You may need to change
' the Baud constant if you're not using a BS2, BS2e or BS2pe.
'
' The Parallax 2 X 16 Serial LCD Displays are availble at the following
' links:
' http://www.parallax.com/detail.asp?product_id=27976
' http://www.parallax.com/detail.asp?product_id=27977
'
' Pin Assignments
' 0 DS1302 DataIO
' 1 DS1302 Clock
' 2 DS1302 Chip Select
' 3 Parallax Serial LCD RX Line
'
[noparse][[/noparse] Revision History ]
'
[noparse][[/noparse] I/O Definitions ]
DataIO PIN 0 ' DS1302.6
Clock PIN 1 ' DS1302.7
CS1302 PIN 2 ' DS1302.5
LCD PIN 3 ' Parallax Serial LCD Display
Here's the address to the forum where Chris from parallax gave the demo code: http://forums.parallax.com/forums/default.aspx?f=21&m=68522
For the BS1, you'd use the SYMBOL declaration. It's not identical to the PIN declaration. It's more like the CON declaration for constants. You can read the description of each declaration in the Manual to sort out the differences.
There is also a document that might help do with the conversion from BS2 to BS1, here is a link for your convenience.
BS1/BS2 Conversion Document:
http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/BS1nBS2ConvTips.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
I have the same situation, got a basic stamp 1(with the module). The application im truing to program is a gas sensor. Tried to modify the sample made for a bs2 by modifing headings and pin assigments , and got the same error. Let me know if u where able to solve urs.
Thanks,
Jorge
Jorge, have you read the links and documents listed above? Post your code if that is what you want help with.
[/QUOTE]
Hi , here is the code:
' =========================================================================
'
' File...... CO Gas Sensor.bs2
' Purpose... Runs the CO Gas Sensor Module Heater
' Author.... Parallax, Inc.
' E-mail.... support@parallax.com
' Started... 02-09-2009
' Updated...
'
'{$STAMP BS1}
'{$PBASIC 1.0}
'
' =========================================================================
'
[ Program Description ]
' This program runs the Gas Sensor Heater through two phases (voltages) as
' recommended by the manufacturer datasheet. The sensor should run for at
' least 10 minutes in clean air before any calibration is done.
' The first phase is the PURGE phase where the heater element is turned on
' at a full 5V. This clears the sensor and no checking for an alarm
' condition is done here. The DEBUG screen will count down the 60 seconds
' of this phase.
' The second phase is the SENSE phase where the heater element is run at
' ~1.4V for 90 seconds. It is during this phase that the sensor can be
' calibrated or that the sensor is checked for alarm conditions.
'
[ I/O Definitions ]
SET IOS:
hsw VAR BIT ' Heater Switch Control
alr VAR BIT ' Alarm Input Sense
hsw=OUT0
alr=IN1
'
[ Variables ]
index VAR Word ' Counter Variable
'
[ Program Code ]
Main:
DO
LOW hsw ' Turn Heater ON
FOR index = 59 TO 0 ' Count Down 60 Seconds
DEBUG HOME, "PURGE MODE...", DEC2 index, " "
PAUSE 1000 ' 1 Second Pause
NEXT
index = 1710 ' Approximately 90 Seconds
DO ' Of Iterations On BS2
DEBUG HOME, "SENSE MODE...", DEC2 index / 19
LOW hsw ' Turn Heater ON
PAUSE 15 ' For 15 mS
INPUT hsw ' Turn Heater OFF
PAUSE 3 ' For 3 mS
index = index - 1 ' Decrement Counter
IF alr = 1 THEN ' Check For Alarm Condition
DEBUG " ***ALARM***" ' Display Alarm Condition
ELSE
DEBUG " " ' Clear Alarm Condition
ENDIF
LOOP UNTIL index = 0 ' End Of Sense Mode Loop
LOOP
I'll take a look on that and rewrite it.
Thanks,
Jorge
I see you had been trying to start a new thread about powering your CO sensor in the Sensors forum, but it did not stick because it was a copy of what you had posted off topic here. I moved your question and my response to a new thread there in Sensors.