Menu

Topic-icon value returned for all digital inputs varies with digital output statuses?

More
4 months 1 week ago #29534537 by JDB
Hello - I am using an SBL2360 connected by RoboCAN to an RIOX that has 7 momentary switch buttons on digital inputs and various LEDs on digital outputs.

a script running on the SBL invokes "ScanCANValue(2, _D, 1, 10, 0)" once when it starts, then inside its main loop uses "Digital_Inputs = ReadScannedCANValue(0)"

if I do not activate any LEDs on the digital outputs, Digital_Inputs returns predictable and expected values for individual button presses (1, 2, 4, 8, 16, 32, 48) however from the point at which I enable any digital output, the value returned by subsequent "Digital_Inputs = ReadScannedCANValue(0)" invocations is magically now a 6 digit number (same factor of 2 pattern). If a different or multiple digital outputs are active, the 6 digit number changes again.

I would like to ask why @02!D 1 (read all digital inputs over RoboCAN) doesn't always return 1,2,4,16,32,48 respectively for my 7 buttons, and if there is some secret to decoding the result returned by "Digital_Inputs = ReadScannedCANValue(0)" reliably when it decides to become 6 digit numbers.

Thanks

Please Log in or Create an account to join the conversation.

More
3 months 4 weeks ago #29534557 by Gabriel_Isko
Yes, you definitely have to read them all all at once. There is not that much buffer space in the can scanner in the SBL2360 to read all of the digital inputs from the RIOX. It should work fine if you want to execute the master script on the RIOX, since that has extended buffer space.

Keep in mind that the command to read all digital inputs is ?D, and it returns a bitmask of the inputs. The number of digits it has in decimal representation is somewhat arbitrary since it is a bitmask. I have attached a script that decodes it.

File Attachment:

File Name: 18.6.26RIO...2-26.zip
File Size:2 KB
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.089 seconds
Go to top