PIC 405 line pattern generator
This is my latest project a PIC 405 line pattern generator.
The photos below is of a test card it generates. The active lines are 480 pixel/80uS, front porch 1uS, Sync 9uS and back porch 9us giving a total line length of 99uS. 376 active lines interlaced with no video information on the half lines.
The four frequency gratings are 1, 1.5, 2 and 3mHz.
The PIC I am using is a 18F26K22 but that may change.
Outstanding work and your prototype board looks so sparsely populated it belies the complexity of the task in hand.
Its very disconcerting though not to see the centre circle, is there a reason for its omission? Not that I suppose it really matters. Are you planning on any further enhancements? will you be fitting it into a project box?
All very interesting, I'm sure the likes of David B and et al will have far more to query about the logic to achieve the end result. Wish I had the nounce to take on such a project.
Its very disconcerting though not to see the centre circle ...
Chris, don't forget that the IBA produced an electronic test card without a circle for broadcast use!
I thought it was a terrible idea but, in Frank's case, it is a reasonable compromise.
Whether the the lack of a circle is down to processing power, memory space or the vast amount of programming time required for such an upgrade, no doubt Frank will be able to tell us but it is certainly an excellent result as it stands so far!
I await further developments ...
When all else fails, read the instructions
Yes the component count is quite low, that is the great thing about microcontrolers most of the work can be done internally with a minimum of external components however they have a relatively small amount of memory compared to what would usually be needed to produce a test card from a stored picture that is read out linearly.
In order to conserve memory a subroutine is made for each part of the image that reoccurs. The center of the picture where there is only horizontal and vertical lines uses little memory as many of the lines there are the same and can be reused many times, they are also the same in the odd and even fields but the lines at the top and bottom that has got diagonals in eat up memory as every line is different and the odd and even fields are different as well.
I agree it looks odd without a circle but considering the amount of work involved in working out where each pixel needs to be and the time it would take to program and as the circle is only used for aspect ratio I decided to leave it out.
When I started I thought there wouldn't be enough memory to create it but now I think there probably is. Just 36% of the available memory is used now.
I intend to add a few more screens with single aspects on like Grey scale, Frequency gratings etc.
That's good work, I'd be very interested to know more about it, I do a lot of work with PIC's, mainly the 18F2520 and it's friends as I have those laying around. Not tackled a video generator before, I imagine it requires a lot of thought going into just keeping the timings correct.
Is your line timebase controlled by a timer or discrete loops?
https://sites.google.com/site/davegsm82/projects/radioputer - A BC5441 Turned into a Media Centre PC.
When I started out I decided that I would like a 3mhz bandwidth, this would require a 6mhz pixel rate and to keep memory use low there would be a pixel produced every instruction cycle. A 6mhz resonator as well as the X4 PLL in the microcontroller is used to provide a 24mhz clock for the microcontroller which gives a 6mhz instruction cycle rate.
For programing I have tried MPLAB but find is very bloated for the simple programs that I write. I prefer to use GCB (Great Cow Basic) and as you say timing is critical in this project so to keep track of the timing Assembler is the only way to go. The great thing about GCB is that Assembler can be wrote in it and it gets passed straight to the compiler as is. This has led me to write this program in a mix of GCB and Assembler.
GCB has delays built into it but they are not accurate enough for this program. In order to get precise delays I wrote out individual delays and keep them in a include file. They go from 1 cycle to 50 cycle in 1 cycle steps and then go 100 cycle, 200 cycle etc. from these I can get any delay I need. In order to save memory I will make up a bespoke delay if it doesn't already exist .
The main loop is at Frame rate. Within the loop each line including the line sync is read off in sequence, if two or more lines in sequence are the same a loop is used to repeat a line the appropriate amount of times.
I started of with a single line and repeating it 188 times, and then worked on getting the line sync, frame sync and interlace correct. After that it was a matter of filling in the rest of the lines in the even field. In the odd field the even field lines can be reused only needing to make new lines if they are different.
I hope I have answered your questions, if there is anything else you would like to know please ask.
When I get it completed I intend to upload the Circuit and the hex file to program the microcontroller so anyone that wants to can build it.
If you are interested in adding a circle to your excellent test card generator, have a look in the Library for the manuals on the Philips PM5544 Pattern generator. Philips used a 256 word (8 bits) ROM to store part of the circle information, then flipped and inverted the memory locations to generate the circle. This was all done in TTL logic and the sequence is well described in the manual along with the timing and circuit diagrams. As this is a 405 line generator it will need fewer words to store the circle, probably less than 200.
I haven't totally ruled a circle out yet, I may try a small one.
I have heard of that Pattern generator and the way it only stores only a quarter of the circle but have not seen the manual it sounds like interesting reading. First chance I get I will pop into the library and have a look.
Thanks for letting me know about it.
... Philips used a 256 word (8 bits) ROM to store part of the circle information, then flipped and inverted the memory locations to generate the circle ...
Hi Stan, there seem to be manuals for more than one iteration of the PM5544 in the library.
I haven't opened them all but those I have looked at refer to a ferrite core memory - which was used in the earliest iterations as a suitable ROM wasn't available.
There is a reference suggesting that a solid state alternative might be used but I can't now find it!
From a quick glimpse through the details it looks as if the circle generator functions as a stand alone unit which probably won't fit in with a software solution so well.
Two counters ares pre-loaded with information from the memory regarding the the delay between the widest point of the circle (A) and the actual start point on that line - 171 in the example given. The counters are driven by a 15MHz oscillator.
The first counter strats at point A and counts down to zero which then triggers the start of the circle. After a total of 256 cycles, the second counter starts to count up so that it reaches zero after 85 counts and triggers the end of the circle on that line.
What is particularly clever is the way the vertical memory is constructed into 10 blocks which are then switched around between fields to give the correct information in a way that economises on the the memory requirement.
When all else fails, read the instructions
I am pretty sure I have seen a description of a circle generator that used two half sine waves and comparitors running at frame rate.
There were a number of revisions to the PM5544 over the years, the original unit used a core memory and the later versions used a ROM, however I have not scanned the version of the manual with the ROM board fitted. I am sure the principle of operation is the same for both versions as the core memory board could be replaced with the ROM unit.
A description of a circle generator that used two half sine waves and comparators running at frame rate
This method is described in the manuals for the Philips PM5515, 5518 and 5519, also in the Library.
It would be relatively easy to implement a similar scheme to that used in the Philips generator solely in software. The difficult part would be maintaining correct timing of the pixels while the process of creating the circle is taking place.
The Philips circuit could be built in hardware and the output mixed with the output from the PIC to produce the desired effect, but I want to keep this project to a single chip if at all possible.
I am going to have a go at creating a circle in the same way that the diagonals were produced. When I think about it, its not all that different to the way Philips created the circle in that pattern generator.
I will update as I progress
I'm following this excellent project with great interest as for most of the time, Test Card C is too 'messy' a signal and a simple staircase will often suffice for fault-finding. Frank, you are to be commended for doing this! Years ago, David Grant (of 'Dinosaur' fame) made me a simple 405-line pattern generator. I really must find it and put it into service.
Circles aren't necessary for assessing linearity, but they are very helpful as the eye is very sensitive to deviation from a circle. For much of my career we didn't have access to Test Card F (and later, J and W) in the studios unless you rang up CAR and asked for it to be sent down a tie-line or an OS line. We had two versions of "grille" though from local test signal generators; a fairly coarse one intended for convergence adjustments, and a finer one for linearity. They sometimes appeared on maintenance room jackfields as 'C#' and 'L#'.
I'm tempted to try and recreate the legendary Murphy TPG11 in discrete CMOS logic - it's just a bunch of monostables and I like 4538s...
Thanks for your comments. The finished version will have a staircase as one of it options. I haven't heard of the Murphy TPG11 but it sounds interesting. Some very clever things have been done with CMOS/TTL.
I have had a go at creating a circle and the results are promising. I have attached some photos. In the photos the middle part of the test card is displaced to the bottom, this is because when working on it I only compile the lines that I am interested in and use a block of blank lines to make up the correct number of lines. In doing so it takes less time to compile.
The first circle I tried was 134 pixels wide but was way too small so I scrapped it and started on a new one which is 200 pixels wide.
I have about half a circle on one field done so approximately a quarter way there.