It is currently Sun Sep 24, 2017 1:14 pm

PIC 405 line pattern generator

Valves, Transistors, IC's and Components. Bench test techniques, Test Gear - Valve Testers, Scopes, CRT Testers, Bridges, Sig Gens, Pattern Gens, Workshop tours etc
 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

PIC 405 line pattern generator

Post by FRANK.C » Sun Dec 06, 2015 2:51 pm

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.

Frank
Attachments
card1.jpg
card2.jpg
stripboard.jpg

 
Posts: 5926
Joined: Sat Jul 23, 2011 8:19 pm

Re: PIC 405 line pattern generator

Post by CTV » Sun Dec 06, 2015 9:21 pm

Hi Frank,

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.

 
Posts: 3781
Joined: Sun Feb 12, 2012 7:43 pm
Location: North Hykeham, Lincolnshire and Ilford, Essex (but not for much longer ...!)

Re: PIC 405 line pattern generator

Post by Terrykc » Sun Dec 06, 2015 11:29 pm

CrustyTV wrote: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!

Image 

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 ...

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Mon Dec 07, 2015 12:17 am

Hi Chris
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.

Frank

 
Posts: 475
Joined: Mon Sep 12, 2011 7:22 pm
Location: Blyth, Northumberland

Re: PIC 405 line pattern generator

Post by davegsm82 » Tue Dec 08, 2015 12:48 pm

Hi Frank,

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?

Dave.

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Tue Dec 08, 2015 9:21 pm

Hi Dave
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.

Frank

 
Posts: 74
Joined: Mon Jul 25, 2011 10:28 pm
Location: Gateshead

Re: PIC 405 line pattern generator

Post by Electrical » Wed Dec 09, 2015 12:14 pm

Hello Frank
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.
Regards Stan.

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Wed Dec 09, 2015 8:41 pm

Hi Stan
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.

Frank

 
Posts: 3781
Joined: Sun Feb 12, 2012 7:43 pm
Location: North Hykeham, Lincolnshire and Ilford, Essex (but not for much longer ...!)

Re: PIC 405 line pattern generator

Post by Terrykc » Thu Dec 10, 2015 4:37 pm

Electrical wrote:... 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.

Circle-gen.png
Circle-gen.png (11.4 KiB) Viewed 2904 times

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.

 
Posts: 4203
Joined: Wed May 02, 2012 3:35 pm
Location: Worksop

Re: PIC 405 line pattern generator

Post by Refugee » Thu Dec 10, 2015 7:00 pm

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.

 
Posts: 74
Joined: Mon Jul 25, 2011 10:28 pm
Location: Gateshead

Re: PIC 405 line pattern generator

Post by Electrical » Thu Dec 10, 2015 7:49 pm

Hello Terry
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.
Refugee wrote: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.
Regards Stan.

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Fri Dec 11, 2015 11:07 pm

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

Frank

 
Posts: 2714
Joined: Sun Sep 01, 2013 6:19 pm
Location: Behind the sofa

Re: PIC 405 line pattern generator

Post by Cathovisor » Sun Dec 13, 2015 3:15 pm

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...

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Mon Dec 14, 2015 11:13 pm

Hi Cathovisor
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.

Frank
Attachments
testcard1.jpg
testcard2.jpg

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Wed Dec 23, 2015 7:04 pm

well we have a circle, it is a bit raggedy as only one field is done yet.
The gratings will have to be moved inside of it.

Frank
Attachments
testcard3.jpg

 
Posts: 848
Joined: Wed Nov 16, 2011 8:11 pm
Location: Cheltenham

Re: PIC 405 line pattern generator

Post by Doz » Wed Dec 23, 2015 7:49 pm

Looks fantastic. I've got an ATMEGA328 to produce a blank raster with a mixture of Arduino C and assembler. Like your BASIC, the Arduino IDE allows use of both. Must crack on with it in the new year. The idea was to produce a text generator, similar to the TV-OUT library.

 
Posts: 3781
Joined: Sun Feb 12, 2012 7:43 pm
Location: North Hykeham, Lincolnshire and Ilford, Essex (but not for much longer ...!)

Re: PIC 405 line pattern generator

Post by Terrykc » Wed Dec 23, 2015 8:18 pm

Excellent, Frank, except that you seem to have got the aspect ratio wrong.

To eliminate monitor set up, I copied the image into Paint and took narrow sections in both horizontal and vertical directions. I then moved these so that the outer edge of the white circle was aligned with the grid.

The vertical sample fitted neatly inside a four square grid but the horizontal sample was more than a third of a grid square over that.

TC_Circle.jpg
TC_Circle.jpg (32.52 KiB) Viewed 2644 times

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Wed Dec 23, 2015 9:19 pm

Hi Andy
Getting a blank raster is a good start, you have the timebases working.
Keep us posted on your progress

Hi Terry
The "squares" are not square. I was going for a 5/4 aspect ratio and I think I have it fairly close unless I got my maths wrong.
There are 480 pixels of video in each line 480 / 5 = 96
and there are 376 active lines 376 / 4 = 94
I used a ratio of 1 pixel = 1 line which although is not exactly 5/4 should be within 3%
The outer circumference of the circle is 200 lines high by 200 pixels wide.

Frank

 
Posts: 63
Joined: Sun Dec 18, 2011 1:46 pm
Location: Hertford

Re: PIC 405 line pattern generator

Post by jjl » Thu Dec 24, 2015 11:00 am

Frank

I think that the cause of the funny looking circle is that your pixels are not square. Hence, fitting the circle into a 200 by 200 rectangle doesn't give the desired result.

I'm not clear on why you are using a 5:4 aspect ratio. It's true that the BBC broadcast using this ratio up to around 1950, but then changed to 4:3. Sets made from that point onwards would be designed for and set up to expect a 4:3 ratio.

John

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Thu Dec 24, 2015 2:45 pm

Hi John
I don't understand your first paragraph

jjl wrote:I'm not clear on why you are using a 5:4 aspect ratio.
John


I am using a 5/4 aspect ratio simply because it was the easiest as it works at 1 pixel = 1 line.
I have never done his before so the most important thing was to get a circle up on screen to prove that it looks reasonable, the dimensions can be tweaked at a later stage to suit what ever aspect ratio is required.
I am doing the calculations for the circle old school compass and graph paper hence a 1 pixel to 1 line ratio makes it easier to start with, later lines or pixels can be inserted or removed to get the geometry correct for the required aspect ratio. Well that's the plan anyways, we'll see what happens.
This is not a finished project just part way along its journey whether I get to the end or not will depend on how long my enthusiasm in it holds out, there is much more to be done.

Frank

 
Posts: 3781
Joined: Sun Feb 12, 2012 7:43 pm
Location: North Hykeham, Lincolnshire and Ilford, Essex (but not for much longer ...!)

Re: PIC 405 line pattern generator

Post by Terrykc » Thu Dec 24, 2015 10:27 pm

FRANK.C wrote:I am doing the calculations for the circle old school compass and graph paper hence a 1 pixel to 1 line ratio makes it easier to start with ...

Now that you've explained the logic behind what you are doing, the simplicity of it makes sense, especially as you weren't originally contemplating a circle.

However, the resulting card will always be displayed in 4:3 ratio because that it will be how the monitor/TV would normally be set up.

If you really are using graph paper and compass - and I see no reason why not, again: simplicity - have you considered scanning a sheet of graph paper and compressing it it slightly in the horizontal direction so that 120 squares occupies the same horizontal measurement as 125.3 (I think you could ignore the 0.3!) in the vertical direction.

You would then get the right answer for everything on the card without any scaling at a later date.

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Fri Dec 25, 2015 12:09 pm

Terrykc wrote: have you considered scanning a sheet of graph paper and compressing it it slightly in the horizontal direction so that 120 squares occupies the same horizontal measurement as 125.3 (I think you could ignore the 0.3!) in the vertical direction.


Hi Terry
Now that's something I hadn't thought of, what a brilliantly simple solution to scaling and one I will try.

Frank

 
Posts: 1931
Joined: Mon Jul 25, 2011 12:12 pm
Location: Burghfield, Reading, UK

Re: PIC 405 line pattern generator

Post by Brianc » Fri Dec 25, 2015 1:10 pm

Terrykc wrote:However, the resulting card will always be displayed in 4:3 ratio because that it will be how the monitor/TV would normally be set up.
A testcard generator with a 5x4 aspect ration could be useful with very early sets - although the normal input to a standards converter is, of course, 3x4. To that end, has anyone contemplated an aspect ratio converter from 3x4 to 5x4? The broadcast industry used ARCs all over the place but nothing to 5x4!

 
Posts: 2714
Joined: Sun Sep 01, 2013 6:19 pm
Location: Behind the sofa

Re: PIC 405 line pattern generator

Post by Cathovisor » Fri Dec 25, 2015 1:19 pm

I once suggested an option of producing 5:4 to Dave.

I think the answer translated as 'no' :aaj

Maybe when the next generation comes along that takes HDMI in from an 1125 line source...?

It's at times like these I wished I'd bought one of those lovely Snell ARC150s out of my studio when I had the chance - they were quite capable of doing this under BNCS control :aaf Certainly a TVOne converter would do it, if it had the option for analogue video fitted.

 
Posts: 185
Joined: Sat Jul 23, 2011 10:40 pm
Location: Roscommon Ireland

Re: PIC 405 line pattern generator

Post by FRANK.C » Sat Dec 26, 2015 1:30 pm

If it was thought to be of any use I could make the circle switchable between 5:4 and 4:3. It would mean a separate set of lines for each circle but as much of each set of lines are the same there should be enough memory left on the PIC to do it.

Frank

Next

Return to In The Workshop



Who is online

Users browsing this forum: No registered users and 2 guests