Pages: [1]   Go Down
Author Topic: Using Internal Clock of Arduino Duemilanove  (Read 1324 times)
0 Members and 1 Guest are viewing this topic.
Oklahoma
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I was wanting to know if/how it is possible to utilitze the "Internal 128 kHz RC Oscillator" of the ATMega328 on my Duemilanove.  I am trying to interface my Arduino with a Quadrature Decoder which must be connected to the clock of the microprocessor for synchronization.  

Does anyone know how I could set up my Arduino to connect it's internal clock (pin PB6 on the ATMega328 Datasheet).

I'm fairly inexperienced with the Arduino besides writing some code so I need help!! Thanks in advance!

Logged

Oklahoma
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the Quadrature Decoder I was hoping to use:
http://www.poli.usp.br/d/PMR2450/detector_de_quadratura%20.pdf

and here is the ATMega328 datasheet:
http://www.atmel.com/dyn/resources/prod_documents/doc8161.pdf

If anyone sees a reason these cannot work together please let me know.  
Logged

Oklahoma
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If it is simpler, I could use any of the internal clocks, or is it possible to connect my quadrature decoder to the same crystal oscillator that is acting as the clock for the Arduino?

I just thought of connecting the decoder to the same external clock, if/how would that be possible?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24287
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

14MHz is a pretty fast quadrature encoder - what sort of rates are you actually expecting?
(BTW - this should really be in "Hardware/Interfacing")
« Last Edit: January 13, 2010, 03:09:43 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Oklahoma
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

probably around 12MHz (12,000 pulses/second) will be most likely.  

As for where it should be, sorry.  I mean to put it there but must've scrolled down a little too far on accident.  Is there a way to move it?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24287
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
12MHz (12,000 pulses/second)
sp. "12kHz"
« Last Edit: January 13, 2010, 03:28:13 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Oklahoma
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Once again, my mistake.  I'm on a lab computer at my university campus with a keyboard I'm not very used to so I hit a M instead of K.. Sorry.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24287
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But that "k" instead of a "M" makes a whole 1000 times of a difference - are you sure you need that chip now?
« Last Edit: January 13, 2010, 03:35:44 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Oklahoma
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, a 1000 is a big difference but I still believe I do.  

I am needing to read from 8 encoders for one robot and so I think I would run into problems if I use interrupts directly on the Arduino, for example if two or more encoders pulsed at nearly the same time, the first one would trigger the interrupt causing the next one to be missed.  Does that sound correct?

Using the external IC, it can keep count while the Arduino polls them for the position data whenever I need it for my navigation.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24287
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, that sounds sensible.
I just had to ask - you be amazed at the number of people who overspecify because they equate "RPM" to "Hz".
I'm not sure why the encoder needs to be synced to the processor clock though. Need to have another read of the datasheet.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Oklahoma
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The sync is for the counter IC.  The encoder will be connected to the counter IC, and the counter IC to the Arduino. The sync is necessary for the read commands to be properly send from the Arduino to the IC, and the IC also does some filtering which requires the pulse duration of the encoder to be at least 3 clock cycles.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24287
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, sorry, I meant the counter, not the encoder, but I'm still not getting the clock sync requirement.
« Last Edit: January 13, 2010, 03:55:31 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Oklahoma
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After some searching I cannot find the part to buy that I posted earlier, only the datasheet.  Here is a similar IC but made for 2-axis quadratures instead of only one, halving the number of them I would need.

http://www.avagotech.com/pages/en/motion_control_encoder_products/integrated_circuits/decoder_ic/hctl-2032-sc/

The sync to the clock of the microprocessor is for timing the signals sent from the microprocessor to read from the output latch on the counter.  The clock signal is used internally in the counter for helping to filter (the 3 clock cycles during one pulse of the encoder to reduce noise), and also to time the data transfer from the counter to the output latch which is done on the rising edge of each clock pulse.  

Does that make sense?
Logged

Pages: [1]   Go Up
Jump to: