using different frequencies
Kris Cardoen
Posts: 46
Hi,
Normally I use the following freq in my programs
> system.Clock(80_000_000) 'Setting the clock
Now, I have connected encoders that support up-to Frequency = up to 30khz
I'm having trouble using the encoders, I guess that 80kz is too fast...
But when I change my setting to system.Clock(25_000_000) for example my Parallax Serial Terminal Plus gives strange symbols.
Is it possible to have different fequencies for different cogs and if not how can I solve this problem?
any help would be much appriciated
Normally I use the following freq in my programs
> system.Clock(80_000_000) 'Setting the clock
Now, I have connected encoders that support up-to Frequency = up to 30khz
I'm having trouble using the encoders, I guess that 80kz is too fast...
But when I change my setting to system.Clock(25_000_000) for example my Parallax Serial Terminal Plus gives strange symbols.
Is it possible to have different fequencies for different cogs and if not how can I solve this problem?
OBJ Encoder : "Quadrature Encoder" pst : "Parallax Serial Terminal Plus" pin : "Input Output Pins" 'instance for using I/O pins time : "Timing" 'instance for timing system : "Propeller Board of Education" 'instance for board of education VAR long Pos[3] 'Create buffer for two encoders (plus room for delta position support of 1st encoder) long forwardCounts long backwardsCounts PUB Main system.Clock(30_000_000) 'Setting the clock 'Initialise clock pst.Start(115_2000) Encoder.Start(0, 1, 1, @Pos) 'Start continuous two-encoder reader (encoders connected to pins 8 - 11) repeat pst.Str(String("pos 0 = ")) pst.dec(Pos[0]) pst.newline pst.Str(String("forwardCounts = ")) '<read Pos[0] ' or Pos[1] here> 'Read each encoder's absolute position forwardCounts := Encoder.ReadDelta(0) 'Read 1st encoder's delta position (value since last read) pst.Dec(forwardCounts) pst.newline time.Pause(2000)
any help would be much appriciated
Comments
This does not quite make sense. Where does ' that 80kz ' come from ?
What does 'trouble using' mean, exactly ?
Encoders are state/edge based, so will work from seconds-per-click, up to some HW/SW ceiling, and usually a library will say what it is tested to.
Some libraries will give error flags on illegal states, which can indicate over-run issues, and/or they may miss counts above a certain rate.
I'm quite new at this so please forgive my ignorance :-)
I was not able to read the signals from the encoders. Because it says max 30MZ max for the encoders I was wondering if
I had to modify my setting in the spin code to a lower value.
If I understand from your feedback this should not be a problem.
I guess I will have to look at the output signal of the encoders, maybe there is another reason for the problem.
Anyway thanks for helping to rule out this as a possible problem.
Can you control the speed of the encoders ?
Do they count Ok at low speeds ?
You need to report what does work, and what does not, and what test points you have tried.
I think he meant MHz.