Re: Mechanical TV Project
Posted: Sat Jul 28, 2018 1:57 am
FlyMario wrote:Ok here is what I am thinking.
An Arduino has a 16mhz clock. At 12.5 fps 1,280,000 clocks should pass per frame. At 32 Lines, 40000 clocks should happen per line. If I were to sample the ports at 32 times per line I could use 1250 (~1240 realistically) clocks. I do have an adjustable oscillator chip (ICL8038) that I could use to pulse the interrupt line at 12800 times per second. Anyways I have a direction to try. If you guys have any suggestions please let me know. Maybe this is old hat and had a lot of issues.
Have you reviewed my Arduino televisor build? I know you're going about things a different way, but a lot of the timing issues and interesting alternate ways of doing things are discussed in the thread, and it would be such a shame for you to be embarking on an Arduino televisor without at least being aware of what has gone before. see viewforum.php?f=28
In specific answer to your question, the general form of an Arduino setup is that you have a loop() which runs as fast as possible, and a setup() - or something similar to those two. You can, of course, setup various interrupts to get things happening at constant times. I don't quite understand what you mean by "sample the ports" - I assume you are somehow connecting audio to the arduino and having the playback from (say) a CD player external to the Arduino...? Not very clear to me. I went about it a different way, by making the Arduino itself do the playback of the WAV file, from an attached SD card. It made things very simple, as it totally removed the analog conversion/process. Once you are all digital, the timing is inherent in the data - and sychronisation becomes very simple indeed. All of my source code (and Keith's) is available for download/review at... https://github.com/andrew-davie/NBTV - at the very least it's a good example of tightly optimised Arduino code running a televisor.
Good luck!