Unable to publish the post. Please notice you can only post once every 5 minutes and only edit posts after 30 seconds. Once you reach 100 published posts this limit will be removed.
Shame on you Arduino Forum !!!
BAD, BAD, BAD, BAD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Hello ASK_ME, have try your Rotary_Encoder_3_DUO.ino very nice, I have code for 3 axis with arduino mega2560 and display SSD1963 code working nice with 3 axis but problem is refreshing display nummbers of axis dont turn in real time so I got today ARDUINO DUE SAM3X and try with your code but problem is becouse I have 7" SSD1963 i try repair code for SSD1963 or You have maybe code for rotary encoder with 7" SSD1963?
If can You help I will happy!
@heliro
The mega 2560 has no Hardware-Quadrature-Encoder!
mega2560 is to slow to handle 3 encoders at the same time but this is dependent of the rotations speed!
I learned Quadrature decoder usage from the code of ard_newbie, I measured the speed of the shaft by using signals QA and QB only.
what I understood is..................
The rotary encoder will have three signals as per my knowledge, which are named as QA,QB and Index. The signals QA and QB signals are enough for the measurement of speed. In ATSAM3X8E their is an option of using the hardware Quadrature decoder module.
There are two quadrature decoders modules in the device which are incorporated in Timer/Counter-0 and Timer/Counter-2. Therefore by manipulating the registers of each channel in the timer/counter segment the speed or position of the shaft can be calculated.
steps to measure the speed.
Initialize the channel-0 in counter mode. To count the number pulses for a particular time interval.
Initialize the channel-2 in timer mode. For generating the triggering pulses for the channel-0, such that counter value will be stored into the register and then reset to zero every time.
The code is available at ard_newbie posts. If anybody wants my code just put a message to me. mine is a bit modified version of ard_newbie code.
If their is any mistake in my analysis, please inform me.
I just wanted to add (for anyone who finds this thread in the future) that you can deal with the underflow by type-casting the register value to a signed 32 bit number.
encoderPosition = (int32_t) REG_TC2_CV0;
This will give you negative values as the encoder rotates past zero with the upper and lower limits of int32.