EmbDev.net

Forum: FPGA, VHDL & Verilog Use of rotary encoder in Spartan 3E


Author: Nirav Bhatt (Company: Uvic) (nirav_bhatt)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Hello everyone,

I have generated four signals/output (G1, G2, G3 and G4) using the 
attached code. G1 and G2 are out of phase while G3 and G4 are out of 
phase. At present, the requirement of the code is to give a variable 
phase shift between G1 and G3 as shown in the attached figure. I am able 
to achieve the phase shift using the code by manually changing inputs, 
reprogram, load and run. But it is taking too much time for the 
experiment.
Could I be able to use the rotary encoder on Spartan 3E board to change 
the phase shift? If anyone can help me with the code, it would help my 
project a lot.
I can provide more information as required.

Thank you
Nirav

Author: Duke Scarring (Guest)
Posted on:

Rate this post
0 useful
not useful
Nirav B. wrote:
> Could I be able to use the rotary encoder on Spartan 3E board to change
> the phase shift?
I think: yes

You could write code which detect edges on the rotary encoder and count 
up or down a counter value.

This counter value can be used in your code to set the phase shift.
Btw. what is the minimum and maximum phase shift you need?
What resolution is acceptable?

Duke

Author: Nirav Bhatt (Company: Uvic) (nirav_bhatt)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Thank you for getting back on this Duke.

Yesterday I tried to work on the code by giving a "phaseshift" integer 
in the code and introduce in the output condition statement of G3 and 
G4. Initially, I thought of using a potentiometer with the board but the 
code worked in a funny way, G3 and G4 does not go high on the expected 
count.

The phase shift shall be minimum zero degree and maximum 180 degrees 
between G1 and G3. While G1 and G2 are out of phase and G3 and G4 are 
out of phase. The resolution can be of 1 degree.

If you could help/direct me how to proceed with the code, it would be a 
great help for me.

Thank you

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig