ROBOTC.net forums
http://www.robotc.net/forums/

RobotC commands/syntax
http://www.robotc.net/forums/viewtopic.php?f=52&t=509
Page 1 of 1

Author:  guopeter [ Sun Apr 06, 2008 4:56 pm ]
Post subject:  RobotC commands/syntax

Does anyone know the programming format for the commands:
-SetSensorType;
-SetSensorMode
-SensorQuadEncoder;
-SensorType
-SensorFullCount
etc.???

Thanks!
2609

Author:  CC335 [ Sun Sep 21, 2008 8:16 pm ]
Post subject:  Re: RobotC commands/syntax

Have you checked the sensors menu in the help files?

Author:  Dick Swan [ Sat Sep 27, 2008 4:05 am ]
Post subject:  Re: RobotC commands/syntax

guopeter wrote:
Does anyone know the programming format for the commands:
-SetSensorType;
-SetSensorMode
-SensorQuadEncoder;
-SensorType
-SensorFullCount
etc.???

If you use the "Motors and Sensors Setup" command on the "Robot" sub-menu it will automatically generate the appropriate code to setup sensors for you. What it generates are a bunch of "#pragma" statements as the first line of your program. Then the compiler recognizes these pragmas -- which define the characteristics of the motors and sensors and automatically generates the code for them as part of the "prolog" code that is run at the start of your program.

"SetSensorType" sets up a sensor. This tells the NXT firmware which device driver it needs to run for a particular sensor port. It's a function that is the same as doing an assignment to "SensorType" variable.

"SensorQuaDEncoder" and "SensorFullCount" are unique variables for the VEX / IFI version of ROBOTC. They should be invisible in the NXT / FTC version.

If you really want to set up the sensors manually in your code you can. You should be able to find a few examples in the sample program folder.

If you want to see the code that is generated in the prolog code you can also see that. You may have to be in "Expert" Menu Level mode. Use the "F9" key to get a dis-assembly listing of your program. Look for the assembler code for the main task.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/