111Views10Replies
Aruino question
I have the arduino uno and i wsa wondering if there is a way i can get it to 3.26 mhz pulse? I don't care if it involves electrical parts.
I have the arduino uno and i wsa wondering if there is a way i can get it to 3.26 mhz pulse? I don't care if it involves electrical parts.
Comments
Best Answer 9 years ago
The Uno has a 16 Mhz clock, you should be able to program an output pin to
your desired frequency with software.
A
Answer 9 years ago
i can only get 63.5 khz shuld i try to get the frequency faster another way besides using decimals of a millisecond?
Answer 9 years ago
I take it you don't do machine code.
Answer 9 years ago
i'm new to using arduino.
Answer 9 years ago
This text box is not large enough to teach machine code.
Lets try another approach, buy a 3.26 Mhz crystal on ebay or Dig-ikey
and a buffer driver.
Answer 9 years ago
I modified a program and it has a flaw that if i make a decimal of a mirosec. it will pulse at 30hz. The greatest pulse is 99.3khz. This is when i tell it to delay for 1 mircosec. Can you explain why this doesn't make 1 mhz?
int outpin = 8;
void setup()
{
pinMode(8, OUTPUT);
}
void loop()
{
digitalWrite(8, HIGH);
delayMicroseconds(1);
digitalWrite(8, LOW);
delayMicroseconds(1);
}
Answer 9 years ago
Executing the C code instruction line takes more then a micro second.
Watch what happens when drop the delay instruction.
int outpin = 8;
void setup()
{
pinMode(8, OUTPUT);
}
void loop()
{
digitalWrite(8, HIGH);
digitalWrite(8, LOW);
}
In assembly code
LOOP:
set p8
nop
nop ' No Operation for a machine cycle
nop
clr p8
nop
jmp LOOP ' jump is equal to two nop
Answer 9 years ago
My arduino said there was a code problem, but where you trying to make a nanosecond pulse?
Answer 9 years ago
I was trying to show you that C-code takes many microseconds to execute and you don't need a delay.
Each C-code instruction takes many assembly code operations.
I hope you also learn about marking a Best answer.
Answer 9 years ago
Thanks a whole lot for your help. I am still learning a lot from tutorials on arduinos, but you have helped me a lot too.