Conversion to Wiring

44 views
Skip to first unread message

Zap

unread,
Apr 19, 2011, 11:32:06 PM4/19/11
to rstep

I'm looking at useing rstep on a 'wireing' board (Arduino's parent)
with the mega128 micro. (128k)
The main reason is so I can add code for a LCD, a pendant and a SD
card reader so I can use the machine as a stand alone
(headless( without a PC)) CNC.

The question I have is what does the folowing line do ??

"TCCR0B &= ~_BV(CS00); //for ATmega168!! XXX: this will mess up
millis,micros,delay,delayMicroseconds"

And is it required for the m128 ?

Thanks Zap.

iklln6

unread,
Apr 21, 2011, 11:27:02 PM4/21/11
to rstep
TCCR0B &= ~(1<<CS00);

TCCR0B - Timer/Counter Control Register B
CS00 - Clock Select Bit 0
TCCR0B &=~(1<<CS00) - sets Clock Select Bit 0 in the Timer/Counter
Control Register B to 0

Arduino/Wiring sets up a clock using one of the timer/counter control
registers for user output in millis() and micros() -- different chips
(mega168, 328, 128, 644, etc). the rstep uses a clock to regulate
stepping that didn't play nicely with the 168's clock, but
atmega328's, 1280, 644, [unsure about 2560] use different timers and
don't have the conflict.

For this situation I recommend searching through the code (just search
the containing folder for files containing text) for TCCR and
familiarize yourself with the timers used by the rstep, then do the
same with the core version of wiring to see what clocks are used on
the 128, and verify that there will not be any conflicts. If rstep
clocks conflict with the wiring's mega128-version clocks then look
through the mega128 documentation to see what other clocks you have
available and can use for rstep.

Before that, though, i'd just comment out the line and see if any
problems pop up pertaining to timing. You might not even need to take
any action.
Reply all
Reply to author
Forward
0 new messages