where did the behind-the-scenes code go?

in order to get a better understanding of how exactly things work on the robot, and to just do some off season research, I tried opening Motor Set Value, and then opening the only subvi that looked promising, DC Motor, only to find nothing of value in there. Can somebody tell me where all the code went?

Motor Set Output contains two implementations, CAN and PWM. The PWM scales the input according to the motor controller ranges and calls PWM set value. That VI calls DigitalModule Set PWM which calls DIO Write PWM which calls the purple node where the value is poked into a register on the FPGA.

If you are not seeing code like this, it could be that you opened and are viewing the simulated motor code. The bottom left of the VI window will tell you either My Computer or RT Compact RIO. You can right click there to change the target if needed.

Greg McKaskle

These attachments show the differences between the two versions.

Did you start with a Blank vi (PC target) and add Motor Set to it before drilling down?
(left picture is what you’d see with the PC as a target)

The right picture is what you’ll get opening Motor Set in an FRC framework project (defaulting to cRIO as a target).

SetMotor-wrong.jpg
SetMotor-right.jpg


SetMotor-wrong.jpg
SetMotor-right.jpg

This is the problem. I would have never guessed that what appears to be just a subvi would actually have the code change depending on if you are in a cRio project or not.

Thanks!

LabVIEW supports many types of platforms.

It is necessary to compile your VI code for each platform, and it is often useful to swap out vi.lib subVIs that are written differently, perhaps taking advantage of OS or architectural specializations. Other languages do this too. C runtime libraries are standardized at their interface, but pre-built for platform details.

In this case, since the Wintel platform doesn’t have an FPGA and can’t really be the robot, we used it as a simulate-flag. If the code is PC, it links to the simulator.

Greg McKaskle