Running the sample "BLINK" program @ 16 MHz

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

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?

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

AWOL:
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. :stuck_out_tongue: lol

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 ?

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?

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 :astonished: (ME) lol

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

If it were possible to code it in Arduino firmware I'd
Gladly give it a go. Machine Language might be too
much for the short term. I really need a working,
adjustable program for proof of concept. I'll try
G&C and see if I get any nibbles THANX ALL!

Ultrashort pulses? Search for "direct port manipulation". This is not hard to pull off.

U know, I should try and do it myself if you folks can help
me get started. I want a very simple program like BLINK in
Machine Language and have adjustable (through code changes)
on and off phases. That is all I need, just a simple code for
ON & OFF. Once I prove the concept I can then get elaborate
and get an ARM based system and program in my safeties &
adjustable outputs, preferably using GUI which is prolly like
developing "windows" from the ground up :slight_smile: :slight_smile: :slight_smile:
Any idea where I should start??? Still a total noob/newb and
I work/drive over 12 hours a day which is the reason I am a
bit slow on the R&D phase. Which Machine Language would
I learn or is that a stupid Q (is it all the same w/hdwe. variants?)
So much to do with so little time

TIA Y'all!
undeRGRound

THX UDO!!! looking

Did you see this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230286016

How exactly timed does the "off" time have to be?

/*
  * pulse PORTB5 (LED) for n machine cycles (62.5ns each)
 * The off time is not particular controlled.
 */
void pulse(int n)
{
  uint8_t on, off;    //values for port reg with LED on and off

    cli();
  off = PORTB;
  on = off | (1<<PORTB5);
  switch(n) {
  case 1:
    asm volatile (
    " out %[port], %[on]\n"
      " out %[port], %[off]\n"
: //output specs (none)
: 
    [port] "I" (_SFR_IO_ADDR(PORTB)),
    [on] "r" (on),
    [off] "r" (off));
    break;
  case 2:
    asm volatile (
    " out %[port], %[on]\n"
      " nop\n"
      " out %[port], %[off]\n"
: //output specs (none)
: 
    [port] "I" (_SFR_IO_ADDR(PORTB)),
    [on] "r" (on),
    [off] "r" (off));
    break;
  case 3:
      asm volatile (
    " out %[port], %[on]\n"
      " nop\n nop\n"
      " out %[port], %[off]\n"
: //output specs (none)
: 
    [port] "I" (_SFR_IO_ADDR(PORTB)),
    [on] "r" (on),
    [off] "r" (off));
    break;
  default:
    // other values are easier.
    // And left as an exercise for the reader.
    break;
  }
  sei();
}

void setup() {
}
void loop() {
  for (int i = 0; i < 100; i++) {
    pulse(i);
  }
}

PS: I also need off phase to be 500 to 10,000 times or more longer.

westfw:
Did you see this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230286016

How exactly timed does the "off" time have to be?

Well for proof of concept total cycle time will likely fall around
1000 Hz (.001 sec) give or take. At this point adjusting the
Mark/Space timing will be needed, but if the concept is proven
I will be able to pour in some real money $
I will check these things THANK YOU ALL

@westfw:
Need to get the OL off the computer, the code does not
display properly on the iPhone. Need iPad I guess :slight_smile:
Accuracy of OFF times is not at all critical, I take it
you are implying it will be in a multiple of 62.5 nSec
which is perfectly acceptable. The ON increment is small
enough that a multiple will work well. A few nSec one way
or the other prolly makes no difference at all at this point.
Off times will be huge in comparison to the On times.
Later I believe that true nanosecond control will pay dividends
but the basic design is likely to work with these specs. It will
SURELY yield some valuable data if not total proof of theory.

I take it you are implying it will be in a multiple of 62.5 nSec which is perfectly acceptable.

Yes, it will be a multiple of 62.5ns (everything will be!), but that isn't the point.
The point is that if you have a short-ish "on" pulse, you only have to generate "exact" code for the duration of that pulse. If you need both the on and off times to be accurate (note that "accurate" is different than "short"), you pretty much have to control ALL of the code, which is MUCH harder. Figure that an average Arduino program can output a nearly exact 62.5ns pulse every 10ms +/- 5 ms (which is a LOT of variation in the off time.)

You're not reinventing MPIR, are you?

undeRGRound:
Seems the PWM is limited in speed and I need
to have the ability to set an output and a pause and repeat.

To be honest I don't understand this.
Your PWM output can be up to the clock speed.
Thus you can have one pulse every 62.5 nS.
That isn't "limited in speed".

@ westfw:
That could be acceptable for proof of concept. Slow but OK.
65 to 200 Hz is relatively slow (I see 1000 Hz as my low end)
But materials questions arise @ 1kHz range anyway.
What is MPIR? Hope no one has done what I'm doing :slight_smile:

@ Nick Gammon:
I had read that using the native PWM was slowed by the coding
Or something, what I am trying to do is get a minimal ON pulse
and adjustable on/off phases. The intended device to be controlled
is not an LED, I just need the ^**above^^^ mentioned pulses and
a wide range of adjustability. For now let's just say all I need is to
Generate a 'Scope Trace which is mostly FLATLINE...

undeRGRound:
@ Nick Gammon:
I had read that using the native PWM was slowed by the coding
Or something...

Oh aye.
Where did you read that?