Applied Sensors DS1620 - Tracy Allen's improvement.
Hi all, I tried to improve DS1620.bs2 according to the code from Tracy Allen's App-notes and I need some answers to the following questions:
i) BS2 tell me "Error 140-Variable modifier is out-of-range." for X.BIT15, ii) "LOOP:" don't appear as "screen:", one is in blue, a PBASIC command expected a DO I suppose, the other in black the begin of a routine, iii) what is "\" in "[noparse][[/noparse]x\9]" and in "REP "-"\degC.BIT15", I can't find it in the help.
P.S.: Code attached was deleted.
Post Edited (MichelB) : 8/1/2009 4:34:35 PM GMT
i) BS2 tell me "Error 140-Variable modifier is out-of-range." for X.BIT15, ii) "LOOP:" don't appear as "screen:", one is in blue, a PBASIC command expected a DO I suppose, the other in black the begin of a routine, iii) what is "\" in "[noparse][[/noparse]x\9]" and in "REP "-"\degC.BIT15", I can't find it in the help.
P.S.: Code attached was deleted.
Post Edited (MichelB) : 8/1/2009 4:34:35 PM GMT
Comments
In order to use VAR X.BIT15, X must be declared as a word, not
as a byte.
LOOP is a reserved word and cannot be used as a label. Change
LOOP to LOOP_1 at the start of your loop and also change GOTO LOOP
to GOTO LOOP_1.
You will find that there is another syntax error in:
Look up the SHIFTIN command under the Help screen and you will find the answer
to your question about [noparse][[/noparse]x\9].
phil
Post Edited (phil kenny) : 8/1/2009 3:15:58 PM GMT
Post Edited (MichelB) : 8/1/2009 4:36:02 PM GMT
an earlier version of PBASIC, most likely version 2.0
You are running PBASIC version 2.5. A number of changes were made
in version 2.5 that cause problems with Tracy's original code. The
syntax errors you encountered were a resullt of these changes.
Try changing your program as follows:
old code:
new code:
I don't have a DS1620 to try it with, but it should work for temperatures of
0 deg C and above and will get you started.
phil
Post Edited (phil kenny) : 8/1/2009 6:08:53 PM GMT
Anyway, I have not updated the code on the web page, and as you have discovered, it does not compile under PBASIC 2.5. The things that need to be changed are the use of LOOP as a label, and the addition of the {$STAMP BS2} and the {$PBASIC 2.5} directives, and the DEBUG ? SDEC degF. Good catch on that last one. DEBUB ? degF is good syntax, but not with the SDEC. Here is is with those changes, using a DO:LOOP instead of a GOTO. In early versions of PBASIC, there was no DO:LOOP. I threw in the full conversion and display of Fahrenheit with the decimal point. I don't know why you are seeing a small circle after the degC= on the display. The purpose of REP "-"\degC.bit15 is to display a negative sign only if the temperature is negative. That is allowable syntax for any version of PBASIC.
edit: added the DEC format modifier in the DEBUG statement for degF. Also capitalization per PBASIC 2.5
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 8/2/2009 5:42:17 PM GMT
DEBUG command lines.
If you change your code from
to
it will display properly. The DEBUG statement seems to need a formatting
command. In the case DEC will give proper formatting.
phil
Post Edited (phil kenny) : 8/2/2009 3:46:51 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com