Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   2012 crio II encoder java constructor (http://www.chiefdelphi.com/forums/showthread.php?t=100584)

Secretspy97 01-18-2012 06:34 PM

2012 crio II encoder java constructor
 
We purchased a new 4 slot crio to test for this year. During our testing we installed a digital sidecar in slot number 2. Then we plugged an encoder into dio ports 1 and 2. We tried to read from the encoder by constructing it the following way:

shooterSpeed = new Encoder( 2, 1, 2, 2, true, Encoder.EncodingType.k4X)

This constructor takes slot, port, slot, port, ... So we specified slot 2 port 1 slot 2 port 2. This didn't seem to work. All readings were 0.

During our debug we decided to try specifying slot 1 instead of slot 2. Suddenly the encoder began to function.

shooterSpeed = new Encoder( 1, 1, 1, 2, true, Encoder.EncodingType.k4X);

Has anyone else experienced something like this? This is pretty strange because slot 1 has the analog breakout plugged in to it.

kinganu123 01-18-2012 09:50 PM

Re: 2012 crio II encoder java constructor
 
I think there was a bug last year, can't exactly remember, but you may have to use Encoder.EncodingType.k2X or write your own Encoder.EncodingType.k4X

davidthefat 01-18-2012 09:56 PM

Re: 2012 crio II encoder java constructor
 
Check the wiring. We were trying to debug the encoders for like 2 weeks because of faulty wiring.

Joe Ross 01-18-2012 10:10 PM

Re: 2012 crio II encoder java constructor
 
Quote:

Originally Posted by Secretspy97 (Post 1108602)
Has anyone else experienced something like this? This is pretty strange because slot 1 has the analog breakout plugged in to it.

This is how it is supposed to work from now on. It no longer references slot number, but references which module. The first digital module (in slot 2 of both cRIOs) is 1. The second digital module (in slot 4 of the new cRIO or slot 6 of the old cRIO) is 2. This is so you don't have to change your code to switch between cRIOs.

Quote:

Originally Posted by kinganu123 (Post 1108720)
I think there was a bug last year, can't exactly remember, but you may have to use Encoder.EncodingType.k2X or write your own Encoder.EncodingType.k4X

The bug you are probably thinking of had to do with the rate output, and would be unrelated to this problem. It was also fixed this year.


All times are GMT -5. The time now is 08:54 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi