View Single Post
Old 15th Sep 2019, 7:51 am   #9
Karen O
Rest in Peace
 
Join Date: Jul 2011
Location: Bridgnorth, Shropshire, UK.
Posts: 787
Default Re: Orton PIC video clock

Hi Ian,

My choice of 14.7456MHz for the PIC crystal is key to generating 'square' pixels. The clock face is displayed on a 128x128 pixel area that needs to be square otherwise you'll get an elliptical clock! (we'll ignore the fact that CRT monitors often have poor linearity and that modern LCD monitors often take liberties with aspect ratio).

There is no video interface on the PIC. The video is generated using a double buffered serial port which can be used to generate an arbitrary stream of bits (the pixels) without interruption. The PIC has to feed the serial port at just the right time to make the digits appear on the screen. That code was generated by a program I wrote in MATLAB which works out the right series of serial port assignments and pauses. I'd have gone md trying to work it out manually!

The fingers: for these I use another PIC peripheral - the pulse width modulator. The code uses this to generate the horizontal line segments that make up each finger. The PWM is used alternately to generate the hour and minute hands.

You're probably shaking your head in disbelief but that is par for the course for my kind of PIC programming - hellishly real time with copious amounts of instruction cycle counting.
Karen O is offline