Problem with src file?
Hello!
Well, Im still working on my kegerator code, and after compiling my code and finding several rookie mistakes, the program finally compiles. However,it brings up the src program (I am not sure why) and displays a "symbol <__else1> is not defined. I am uncertain as to why it is saying this, as I have my SX_Key set up to work in SXB.
Can anyone educate me? I would be thankful. ( I am using the BETA key, if that helps)
Thanks
P.s. I could not locate my file to upload. I can only find it using the SX_key. I think I saw this problem on another post? Any clues?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
Well, Im still working on my kegerator code, and after compiling my code and finding several rookie mistakes, the program finally compiles. However,it brings up the src program (I am not sure why) and displays a "symbol <__else1> is not defined. I am uncertain as to why it is saying this, as I have my SX_Key set up to work in SXB.
Can anyone educate me? I would be thankful. ( I am using the BETA key, if that helps)
Thanks
' ========================================================================= ' ' File...... ADC0831_Working_File.SXB ' Purpose... Tempurature controller for homebrew kegs ' Author.... ' E-mail.... ' Started... ' Updated... ' ' ========================================================================= ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' ' Reads value from an ADC0831 ' Note that the SpeedMult feature is used with SHIFTIN to bump the clock ' speed up to ~332 kBits/sec (ADC0831 max is 400).
' ------------------------------------------------------------------------- ' Device Settings ' -------------------------------------------------------------------------
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 ID "beercool"
' ------------------------------------------------------------------------- ' IO Pins ' -------------------------------------------------------------------------
Cpin PIN RA.2 OUTPUT ' shift clock Dpin PIN RA.1 INPUT ' shift data CS PIN RA.0 OUTPUT ' chip select
TX PIN RB.1 OUTPUT ' transmit to PC / Stampplot RC4 PIN RB.0 OUTPUT ' transmit to RC4
' ------------------------------------------------------------------------- ' Variables ' -------------------------------------------------------------------------
temperature VAR Byte ' main variable tmpB1 VAR Byte ' working variables tmpB2 VAR Byte tmpW1 VAR Word
' ------------------------------------------------------------------------- ' Constants ' -------------------------------------------------------------------------
IsOn CON 1 IsOff CON 0 App_Mod_On CON %1000 ' not currently used App_Mod_Off CON %0000 BaudMode CON "OT38400"
' ========================================================================= PROGRAM Start ' =========================================================================
' ------------------------------------------------------------------------- ' Subroutine Declarations ' -------------------------------------------------------------------------
DELAY_MS SUB 1, 2 ' delay in milliseconds TX_BYTE SUB 1 ' transmit a byte TX_STR SUB 2 ' transmit a string RESET_RC4 SUB 0 ' reset the RC-4 SET_RC4 SUB 1 ' set RC-4 relays Get_ADC SUB 0,1 ' get adc reading
' ------------------------------------------------------------------------- ' Program Code ' -------------------------------------------------------------------------
Start:
DELAY_MS 250 ' let RC-4 power up RESET_RC4
HIGH CS ' make CS output, no ADC LOW Cpin ' make clock 0-1-0
Main: temperature = Get_ADC watch temperature
If temperature >= 38 then SET_RC4 %1000 If temperature <= 34 then SET_RC4 %0000
DELAY_MS 250 BREAK
GOTO Main
' ------------------------------------------------------------------------- ' Subroutine Declarations ' -------------------------------------------------------------------------
' Use: aVar = GET_ADC ' -- reads ADC0831 and places value into 'tmprtr'
FUNC Get_ADC CS = 0 ' activate ADC0831 SHIFTIN Dpin, Cpin, MSBPOST, tmpB1\1, 4 ' start conversion SHIFTIN Dpin, Cpin, MSBPOST, tmpB1, 4 ' shift in the data CS = 1 ' deactivate ADC0831 RETURN tmpB1 ENDFUNC
' -------------------------------------------------------------------------
' Use: DELAY_MS duration ' -- replaces PAUSE
SUB DELAY_MS IF __PARAMCNT = 1 THEN tmpW1 = __PARAM1 ELSE tmpW1 = __WPARAM12 ENDIF PAUSE tmpW1 ENDSUB
' -------------------------------------------------------------------------
' Use: TX_BYTE byteVal ' -- transmit "byteVal" at "BaudMode" on pin "Sio"
SUB TX_BYTE SEROUT RC4, BaudMode, __PARAM1 ENDSUB
' -------------------------------------------------------------------------
' Use: TX_STR [noparse][[/noparse]string | label] ' -- "string" is an embedded string constant ' -- "label" is DATA statement label for stored z-String
SUB TX_STR tmpW1 = __WPARAM12 ' get address of string DO READINC tmpW1, tmpB1 ' read a character IF tmpB1 = 0 THEN EXIT ' if 0, string complete TX_BYTE tmpB1 ' send character LOOP ENDSUB
' -------------------------------------------------------------------------
' Use: RESET_RC4
SUB RESET_RC4 TX_STR "!!!!!!RC4" ' header (ensure sync) TX_BYTE %00 ' address TX_BYTE "X" ' reset command ENDSUB
' -------------------------------------------------------------------------
' Use: SET_RC4 relayBits
SUB SET_RC4 tmpB2 = __PARAM1 ' get relay bits TX_STR "!RC4" ' header TX_BYTE %00 ' address TX_BYTE "S" ' set command TX_BYTE tmpB2 ' relay bits ENDSUB
P.s. I could not locate my file to upload. I can only find it using the SX_key. I think I saw this problem on another post? Any clues?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
Comments
You need to add ENDIFs after the SET_RC4 commands -- like this:
I'm not sure what you mean when you say you couldn't locate the file to upload and could only find it with the SX-Key. What file? The src file?
Thanks,
PeterM
DOH! Thank you. I will try that.
PJMonty-
I saved my file in the Beta key, then tried to upload the file using parallax's upload file button. The file did not show up when I went to the correct file location. So I exited out of the SX-Key, and tried to find the file using the upload button again. I could not find it. So I restarted the SX-Key, went to the projects-->sxb folder and there was the file. It opened just fine. The file is a SXB file. It is like the only program that can see the file is the sx-key. Hope that clarifies.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
Post Edited (Shawn Lowe) : 8/19/2008 9:02:29 PM GMT
When I got home I put in the Endif's. It compiled right away! Thanks for answering what must have seemed like an obvious programming error! Everyone new should hopefully learn from this post.
Bean-
Can something be added to the help file of sxb 2.0 about endif with if...then's? Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
IF Condition [noparse][b]GOTO[/b [noparse][b]EXIT[/b
Function
Evaluate Condition and, if it is true, jump to the point in the program designated by Label.
Explanation
IF...THEN is decision maker that affects program flow. It tests a Condition statement and, if that statement is True, goes to a point in the program specified by Label. The available comparison operators are:
Comparisons are always written in the form: Variable Op Value.
Main:··IF StartBtn = 1 THEN Main ' wait for input to go lowCheck_Mode:··IF ModePin = 0 GOTO Show_AMPM ' use HH:MM xM format if mode = 0
Some programmers may prefer a more verbose style; the following syntax is also supported:
Check_Mode:··IF ModePin = 0 THEN GOTO Show_AMPM ' use HH:MM xM format if mode = 0·This is what is in my online help file. Perhaps I have an outdated copy?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
http://forums.parallax.com/showthread.php?p=597707
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!