Question about declaring subroutines and functions in SX/B
![RobotWorkshop](https://forums.parallax.com/uploads/userpics/915/nCTRZ4MIBWKDB.jpg)
Hello, I have read through the Elements of style guide for SX/B and have a question about declaring subroutines and functions in SX/B. In the example is shows:
WAIT_MS SUB 1,2
GET_TEMP FUNC 2
I read that subroutines can return a byte value and that functions can return a byte or word. It also sounds like you can pass more than one parameter to a subroutine or function.
What I have yet to find a reference to is just what the meaning/significance of the numbers are following the SUB and FUNC in the examples above. Does it specify how many are passed to the routine, How many are returned, or if it is a byte or word that is passed and returned?
Can anyone shed some light on what the meanings of these values are?
Thank You,
Robert
WAIT_MS SUB 1,2
GET_TEMP FUNC 2
I read that subroutines can return a byte value and that functions can return a byte or word. It also sounds like you can pass more than one parameter to a subroutine or function.
What I have yet to find a reference to is just what the meaning/significance of the numbers are following the SUB and FUNC in the examples above. Does it specify how many are passed to the routine, How many are returned, or if it is a byte or word that is passed and returned?
Can anyone shed some light on what the meanings of these values are?
Thank You,
Robert
Comments
Subroutine Declaration:
Label SUB {Min{, Max}}
Function Declaration:
Label FUNC ReturnCount{, Min{, Max}}
WAIT_MS SUB 1,2 ' Minimum of 1 byte, maximum of 2 bytes; byte or byte,byte or word
GET_TEMP FUNC 2 ' Returns 2 bytes; no parameters
Just remember that the values are BYTES. So if you want a FUNC that receives a WORD and returns a WORD you would use:
MyFunc FUNC 2,2
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
Good luck with your projects.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman