Exact match. Not showing close matches.
PICList
Thread
'[SX] Invalid number of parameters error'
2005\12\05@105008
by
DJFXn/a
|
|
Here is the code that I am working with. Every time I try to compile it I get an error "Invalid number of parameters" because of the 3 conditions in the IF statement. Any help in correcting this problem would be greatly appreciated.
' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------
DEVICE SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ 4_000_000
' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------
Gas VAR RB.6
Flow VAR RB.5
Temp VAR RB.4
Solenoid VAR RC.0
Fan VAR RC.1
Alarm VAR RC.2
' -------------------------------------------------------------------------
' Main
' -------------------------------------------------------------------------
PROGRAM Start
Start:
IF Gas = 1 AND Flow = 0 AND Temp = 0 THEN Check
LOW RC.0 'Solenoid
HIGH RC.1 'Fan
HIGH RC.2 'Alarm
GOTO Start
Check:
HIGH RC.0 'Solenoid
LOW RC.1 'Fan
LOW RC.2 'Alarm
GOTO Start
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\12\05@110529 by Jon Williamsn/a
|
|
SX/B only allows one operator per line -- remember, we keep things very simple so you can see what's going on underneath. Here's another way to solve that problem:
Start:
LOW Solenoid
LOW Fan
LOW Alarm
Main:
temp1 = RB & %01110000
IF temp1 = 0 THEN
Solenoid = 1
Fan = 0
Alarm = 0
ELSE
Solenoid = 0
Fan = 1
Alarm = 1
ENDIF
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99429
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
For this code we are running LED's that represent our Solenoid, Fan and Alarm. The output I get is when I push any of the button's our Alarm and Fan LED's turn on. What I need is that only when gas, RB.6 is high the Alarm and Fan LED's turn on. If RB.6 is high and RB.5 or RB.4 are high, my Alarm and Fan LED's should turn off.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99448
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\12\05@130147 by Johnson Rodn/a
|
|
do one binary operation per line and store the value in a temporary variable; in this case i used tempBit.
tempBit = flow OR temp
tempBit = tempBit AND gas if tempBit = 1 then...
else...
endif
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99451
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
When I do this I get an error message: "BYTE Parameter Expected "Flow" and the same for Temp and Gas.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99459
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
Hi anyone I need help again!!! This time my error displays UNKNOWN COMMAND "LED". I think this time I have the logic correct. Pleas if anyone can help me I will realy acpreciate it Here is my code. It activates when and only if (gas = 1 and flow =0 and temp = 0.
' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------
' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------
Gas VAR RC.1
Flow VAR RC.2
Temp VAR RC.3
Solenoid VAR RB.0
Fan VAR RB.1
Alarm VAR RB.2 tempbit VAR bit
temp2 VAR bit
temp1 VAR BYTE
' -------------------------------------------------------------------------
' Main
' -------------------------------------------------------------------------
Start:
LOW Solenoid
LOW Fan
LOW Alarm
Main:
tempbit = Flow OR Temp
if tempbit = 0 THEN
temp2 = tempbit OR Gas
else
end if
IF temp2 = 1 THEN
Solenoid = 0
Fan = 1
Alarm = 1
ELSE
Solenoid = 1
Fan = 0
Alarm = 0
ENDIF
GOTO Main
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99470
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
SX/B does not allow AND or OR with bit variables. Mainly because the SX assembly language doesn't either.
Your making it too hard on yourself. Try this:
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99473
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
Well I tried it and it works!!!! I want to thank all you guys for the help. You don't know how much I appreciate it. Thank you again.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99479
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\12\05@201758 by Jon Williamsn/a
|
|
And sorry I lead you astray momentarily, DJ -- I was in the California office this morning and it a rush to get to my plane.... I'm safely back in Big D now.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99502
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
Now that worked but now I modified it and it doesn't work. Here is the new code:
' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------
' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------
Gas VAR RC.1
Flow VAR RC.2
Temp VAR RC.3
Solenoid VAR RB.0
Fan VAR RB.1
Alarm1 VAR RB.2
Alarm2 VAR RB.3
temp0 VAR Byte
temp3 VAR Byte
' -------------------------------------------------------------------------
' Main
' -------------------------------------------------------------------------
Start:
LOW Solenoid
LOW Fan
LOW Alarm1
LOW Alarm2
Main:
temp0 = Flow + Temp
temp0 = temp0 + ~Gas
' temp0 can ONLY be 0 if Flow=0, Temp=0, and Gas=1 alarm dange level
temp3 = Flow & Temp
temp3 = temp3 & Gas
' temp1 can ONLY be 1 if Flow=1, Temp=1, and Gas=1 alarm dang level rising
IF temp0 = 0 THEN
Solenoid = 0
Fan = 1
Alarm1 = 1
Alarm2 = 0
IF temp3 = 1 THEN
Solenoid = 1
Fan = 0
Alarm1 = 0
Alarm2 = 1
ENDIF
Solenoid = 1
Fan = 0
Alarm1 = 0
Alarm2 = 0
ENDIF
GOTO Main
Any Help is greatly appreciated.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99621
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\12\06@135101 by Jon Williamsn/a
|
|
You might consider this:
temp3 = RC & %00001110 ' mask unused bits
temp3 = temp3 >> 1 ' remove unused zero-bit
IF temp3 = %000 THEN
' do something
ENDIF
IF temp3 = %001 THEN
' do something else
ENDIF
IF temp3 = %010 THEN
' do yet something else
ENDIF
' more IF-THEN structures (like above) as required
It may seem a little verbose but I think it's cleaner and less error-prone that what you're currently attempting.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99624
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
Dude,
You CANNOT use AND or OR with bit variables. That means "&" and "|" too.
You also have your IF...ENDIF boogered up.
Just add the bit together like this:
temp3 = Flow + Temp
temp3 = temp3 + Gas
' temp3 can ONLY be 3 if Flow=1, Temp=1, and Gas=1 alarm dang level rising
IF temp3 = 3 THEN
' whatever
ENDIF
Keep working on it, and keep posting. We'll steer you in the right direction.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=99428#m99634
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2005
, 2006 only
- Today
- New search...