Oklahoma
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
|
 |
« on: January 13, 2010, 02:38:56 pm » |
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
Newbie
Karma: 0
Posts: 8
Arduino rocks
|
 |
« Reply #2 on: January 13, 2010, 02:44:15 pm » |
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
Brattain Member
Karma: 144
Posts: 19380
I don't think you connected the grounds, Dave.
|
 |
« Reply #3 on: January 13, 2010, 03:06:52 pm » |
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.
|
|
|
|
Oklahoma
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
|
 |
« Reply #4 on: January 13, 2010, 03:25:33 pm » |
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
Brattain Member
Karma: 144
Posts: 19380
I don't think you connected the grounds, Dave.
|
 |
« Reply #5 on: January 13, 2010, 03:26:51 pm » |
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.
|
|
|
|
Oklahoma
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
|
 |
« Reply #6 on: January 13, 2010, 03:28:14 pm » |
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
Brattain Member
Karma: 144
Posts: 19380
I don't think you connected the grounds, Dave.
|
 |
« Reply #7 on: January 13, 2010, 03:29:56 pm » |
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.
|
|
|
|
Oklahoma
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
|
 |
« Reply #8 on: January 13, 2010, 03:35:30 pm » |
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
Brattain Member
Karma: 144
Posts: 19380
I don't think you connected the grounds, Dave.
|
 |
« Reply #9 on: January 13, 2010, 03:38:31 pm » |
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.
|
|
|
|
Oklahoma
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
|
 |
« Reply #10 on: January 13, 2010, 03:39:51 pm » |
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
Brattain Member
Karma: 144
Posts: 19380
I don't think you connected the grounds, Dave.
|
 |
« Reply #11 on: January 13, 2010, 03:46:31 pm » |
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.
|
|
|
|
Oklahoma
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
|
 |
« Reply #12 on: January 13, 2010, 03:52:44 pm » |
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
|
|
|
|
|
|