Programmatic way to determine 4-slot vs. 8-slot cRIO?


Is anyone aware of a way in software to determine whether code is running on a 4-slot vs. an 8-slot cRIO at runtime? We only have one 4-slot chassis and that’s on the competition 'bot. But, our 8-slot chassis is being used for development and the 2nd solenoid module is in slot 7 on the 8-slot but slot 4 on the 4-slot. Yes, we can do a #define, but it would be convenient to be able to determine the slot count at run time. Anyone have an approach short of allowing something to fail to test it?



The second solenoid module in both chassis should be referred to as Solenoid module 2. Is there something else you need to detect the difference for?

At the root of the file system I found a file called FRC_ImageVersion.ini. It gives some info about the image, language, etc. It may be that the FPGA version identifies a 4-slot from an 8-slot. Next to it is a load_out.txt file that tells you the vendor, module, and serial number of each module in the slot. You should be able to look in the file, or even at the size of the file and tell the type of controller you are running on. I’m sure there are APIs for doing this, but the file seems to be pretty simple.

Greg McKaskle

Thanks for the info. I’ll take a look at that file. You’re correct in that the solenoids are now simply references as module 1 and module 2. I was having a senior moment remembering back to when you actually have to specify the slot for some of the I/O constructors.