If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.
Special Thanks To:
Aaron Holmes
Aaron Wheeler
Adam Horden
Alan Scrimgeour
Andre
Andrew Haynes
Anonymous000
asabase
Austin Weil
barney
Barry
Bert Hickman
Bill Kukowski
Blitzorn
Brandon Paradelas
Bruce Bowling
BubeeMike
Byong Park
Cesiumsponge
Chris F.
Chris Hooper
Corey Worthington
Derek Woodroffe
Dalus
Dan Strother
Daniel Davis
Daniel Uhrenholt
datasheetarchive
Dave Billington
Dave Marshall
David F.
Dennis Rogers
drelectrix
Dr. John Gudenas
Dr. Spark
E.TexasTesla
eastvoltresearch
Eirik Taylor
Erik Dyakov
Erlend^SE
Finn Hammer
Firebug24k
GalliumMan
Gary Peterson
George Slade
GhostNull
Gordon Mcknight
Graham Armitage
Grant
GreySoul
Henry H
IamSmooth
In memory of Leo Powning
Jacob Cash
James Howells
James Pawson
Jeff Greenfield
Jeff Thomas
Jesse Frost
Jim Mitchell
jlr134
Joe Mastroianni
John Forcina
John Oberg
John Willcutt
Jon Newcomb
klugesmith
Leslie Wright
Lutz Hoffman
Mads Barnkob
Martin King
Mats Karlsson
Matt Gibson
Matthew Guidry
mbd
Michael D'Angelo
Mikkel
mileswaldron
mister_rf
Neil Foster
Nick de Smith
Nick Soroka
nicklenorp
Nik
Norman Stanley
Patrick Coleman
Paul Brodie
Paul Jordan
Paul Montgomery
Ped
Peter Krogen
Peter Terren
PhilGood
Richard Feldman
Robert Bush
Royce Bailey
Scott Fusare
Scott Newman
smiffy
Stella
Steven Busic
Steve Conner
Steve Jones
Steve Ward
Sulaiman
Thomas Coyle
Thomas A. Wallace
Thomas W
Timo
Torch
Ulf Jonsson
vasil
Vaxian
vladi mazzilli
wastehl
Weston
William Kim
William N.
William Stehl
Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Registered Member #9252
Joined: Fri Jan 04 2013, 06:27AM
Location: Andromeda
Posts: 253
Sigurthr wrote ...
Yep, it was shielded.
At first I didn't hand write a program for the tests, as it was a quick look into the viability, and I'm not very experienced with arduino's lower level programming side. Basically I used a simple sketch that had you enter in a frequency via serial monitor and it would configure timer.1 to output pulses at the chosen frequency. I compared the output via scope and digital frequency counter. Ar 1MHz it was rather accurate, something like 999,400Hz. At 280KHz it was off by about 30KHz, somewhere around 250KHz. At 100KHz it was pretty accurate again. At direct fractions accuracy was good, at more distant fractions errors were introduced.
My initial impression was that it was something to do with the programming so I went and used a simple fixed variable and as little code as possible to see try and eliminate programming error. I hard coded in 10uS on and 10uS off, but still used digitalWrite functions. The result was ~37KHz. Clearly digitalWrite execution time was a problem. I looked into directly writing the IO registers but didn't give it a try, as at this point it was already proving to be too much hassle.
So, that's why I keep bringing up instruction execution delays. I literally had nothing other than standard setup, variable initialization, and two digitalWrite commands with variable calls and I couldn't get it to keep up. Assuming you write highly efficient code for timer.1 and the control loop, directly write to registers to avoid digitalWrite, and avoid any other high level instruction functions you may get something workable, but I don't know if you'll be able to set it to 50KHz and actually get 50KHz out. You might have to set it to 70KHz and get 51KHz out and call it good enough.
Steve Conner wrote ...
You will need to do as much of the work as you can in the timer hardware to avoid issues like this. You also need to check that the timer you're using has enough resolution to generate an accurate frequency. The Arduino libraries do a great job of abstracting away differences in the hardware, but by the same token they also do a great job of hiding its limitations. Read the microcontroller datasheet very carefully.
I think the problem described by Sigurthr is really two separate problems. The first one was limited resolution of a hardware timer, the second was instruction execution delays.
If I had to build something like this tomorrow, I would use a 4046 PLL chip, a PIC, and a CPLD.
Ash Small wrote ...
I'm not familiar with the Arduino myself, but you will want to avoid any high level programming, as this does introduce significant dalays.
I used to write stuff in machine code years ago, which avoids all of the problems with high level language, as well as low level assembler stuff.
Typing in all those ones and zeros is pretty time consuming, though, especially if you make a mistake.
Noted, This should be a fairly interesting little project to try, I don't think coding an arduino can include an electrocution hazard or a mosfet-bullet-blowing-in-your-face hazard, Thanks for all the input :)
Linas wrote ...
PSoC5LP does have FPGA like analog and digital capability, aka hardware processing as well as Cortex M3 core for more advanced stuff.
Maybe sone one would try to do something with it ?
if not, go to STM32F429, it can run at 200MHz, at his point you can do loops with 20ns precision ( GPIO toggle will go up to 100MHz)
The video shows as "This video has been removed by the user" :(
Registered Member #834
Joined: Tue Jun 12 2007, 10:57PM
Location: Brazil
Posts: 644
Some time ago I started a project for a drsstc controller using a PIC. The required functions could be easily programmed, but soon I hit the problem of lack of resolution in the high-frequency drive and did not proceed. I imagined solutions as skipping or adding clock cycles dynamically to keep reasonable precision, and even a method to make the PIC adjust the frequency of its own clock, but didn't experiment with them.
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.