Go Down

Topic: Running the sample "BLINK" program @ 16 MHz (Read 1 time) previous topic - next topic

undeRGRound

Well, that pretty much says exactly what I want to do.
Is this possible? Seems the PWM is limited in speed and I need
to have the ability to set an output and a pause and repeat.
This will allow me to run an extremely short on pulse of 1 to
(oh let's say) 10 units and run an off interval of 1 to 10,000
or more and repeat. Simple as that, now how can I do it?
working on my honorary doctorate LOL

PaulS

Quote
This will allow me to run an extremely short on pulse of 1 to
(oh let's say) 10 units

And what are these mysterious units?

The chip runs one machine instruction 16 million times per second. You can't really expect to turn a pin on or off with a single machine instruction, so 16MHz PWM is wishful thinking.

undeRGRound

Each "unit" is 62.5 nanoseconds or the reciprocal of 16 million.
I have had input from others on Arduino forums implying
this is possible
working on my honorary doctorate LOL

AWOL

"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.

kf2qd

Underground - If you can get you program to execute 16 million times a second, YES, but what you need to understand is that the code to blink takes many instructions, ans thus there is no way you can get anywhere close.

If you write some really tight, dedicated code in assembly language you can get rid if all the extra instructions that are there from compiling the c code, then you can get the numbers higher for PWM frequency.

I took some stepper driver code from 1260 bytes to 88 bytes by coding in assembler.

AWOL

The bottom line is what you want to do is possible but the program won't look anything like the blink sample code.
"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.

undeRGRound

Ah-HA!
^^^(begins to see the light)^^^
U see, my good people, I have a wonderful great
Invention I am attempting to bring to life. I guess
what I really need to do is contract such a program
and pay for it. OR get a "partner" as such. But at this
time I just need the stripped down, bare bones
coding that will accomplish such a feat of speed
and accuracy.

Seems you all are telling me the Arduino reads and executes
the Wiring language which slows it way down from it's absolute
16 MHz speed limit. Makes sense now. I need machine coding
so the Arduino reads and executes Directly with no lag. ?
working on my honorary doctorate LOL

PaulS

Quote
But at this
time I just need the stripped down, bare bones
coding that will accomplish such a feat of speed
and accuracy.

You also need realistic expectations. Even with assembly language programming you can not toggle the pin on and off 16 million times a second.

AWOL

To be fair, a 16 MHz toggle was not requested.
At least, that's how I read it.
"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.

T_Lex

Apologies for the possible thread-jack, but there is a physical limitation as to how "fast" the eye can see.  I've seen different numbers, but let's say the eye can't register anything faster than 60 blinks per second.

Can the Arduino make the LED flash that fast?  As a thought exercise, how fast can the LED blink, even if it looks solid?

CrossRoads

@underGround, you are still after a short on-pulse followed by variable-length off time, yes?
Were you able to get anywhere with things like sbi, cbi, sei ?

@T-Lex,
once you get much past 24 blinks/second, (TV refresh speed) I think the eye just perceives the LED as on, with differing brightness levels dependent on the on-time vs the off-time.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

undeRGRound


To be fair, a 16 MHz toggle was not requested.
At least, that's how I read it.


WINNER WINNER!!!
Chicken Dinner!

Correct, AWOL!
I want a 62.5 to 125 nanosecond (or more) Pulse
followed by an adjustable off cycle. The whole
instruction set could last upwards of a millisecond (.001)
or more. I just need that ultra short ON Cycle. And it is
NOT for an LED.  :P lol
working on my honorary doctorate LOL

undeRGRound


@underGround, you are still after a short on-pulse followed by variable-length off time, yes?
Were you able to get anywhere with things like sbi, cbi, sei ?


fat16lib didn't have anything for me, prolly too busy to
educate me just so we could talk on his level. Your PM
listed sli & cli didn't it?
working on my honorary doctorate LOL

undeRGRound

Should I lock this topic and post again?
Is there anyone out there who would write such a code string
for a fee? I'm willing to go that route but the code needs to be
User-Adjustable by a noob  :smiley-eek: (ME) lol
working on my honorary doctorate LOL

AWOL

Quote
Is there anyone out there who would write such a code string for a fee? I

If you had no intention of trying yourself, maybe you should've put it in Gigs and Collaborations to begin with
"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.

Go Up