Indy
Offline
Newbie
Karma: 0
Posts: 43
YEAR of the DRAGON
|
 |
« on: March 06, 2012, 12:17:54 pm » |
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?
|
|
|
|
|
Logged
|
working on my honorary doctorate LOL
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 314
Posts: 35519
Seattle, WA USA
|
 |
« Reply #1 on: March 06, 2012, 12:24:21 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Indy
Offline
Newbie
Karma: 0
Posts: 43
YEAR of the DRAGON
|
 |
« Reply #2 on: March 06, 2012, 12:37:19 pm » |
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
|
|
|
|
|
Logged
|
working on my honorary doctorate LOL
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #3 on: March 06, 2012, 12:53:01 pm » |
Your friend is the "nop" instruction
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
South Texas
Offline
God Member
Karma: 8
Posts: 976
|
 |
« Reply #4 on: March 06, 2012, 01:15:18 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #5 on: March 06, 2012, 01:18:53 pm » |
The bottom line is what you want to do is possible but the program won't look anything like the blink sample code.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Indy
Offline
Newbie
Karma: 0
Posts: 43
YEAR of the DRAGON
|
 |
« Reply #6 on: March 06, 2012, 02:15:22 pm » |
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.
|
|
|
|
|
Logged
|
working on my honorary doctorate LOL
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 314
Posts: 35519
Seattle, WA USA
|
 |
« Reply #7 on: March 06, 2012, 02:21:22 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #8 on: March 06, 2012, 02:37:28 pm » |
To be fair, a 16 MHz toggle was not requested. At least, that's how I read it.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 25
|
 |
« Reply #9 on: March 06, 2012, 02:56:14 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Online
Brattain Member
Karma: 249
Posts: 16534
Available for Design & Build services
|
 |
« Reply #10 on: March 06, 2012, 03:04:57 pm » |
@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.
|
|
|
|
|
Logged
|
|
|
|
|
Indy
Offline
Newbie
Karma: 0
Posts: 43
YEAR of the DRAGON
|
 |
« Reply #11 on: March 06, 2012, 03:13:53 pm » |
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.  lol
|
|
|
|
|
Logged
|
working on my honorary doctorate LOL
|
|
|
|
Indy
Offline
Newbie
Karma: 0
Posts: 43
YEAR of the DRAGON
|
 |
« Reply #12 on: March 06, 2012, 03:22:08 pm » |
@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?
|
|
|
|
|
Logged
|
working on my honorary doctorate LOL
|
|
|
|
Indy
Offline
Newbie
Karma: 0
Posts: 43
YEAR of the DRAGON
|
 |
« Reply #13 on: March 06, 2012, 05:09:30 pm » |
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  (ME) lol
|
|
|
|
|
Logged
|
working on my honorary doctorate LOL
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #14 on: March 06, 2012, 05:27:42 pm » |
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
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
|