Featured
Latest
PIC 405 line patter...
 
Share:
Notifications
Clear all

Forum 141

PIC 405 line pattern generator

138 Posts
19 Users
0 Likes
39.6 K Views
FRANK.C
(@frank-c)
Posts: 252
Reputable Member Registered
Topic starter
 

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

www.electronics.frankcuffe.ovh

 
Posted : 06/12/2015 2:51 pm
crustytv
(@crustytv)
Posts: 11869
Vrat Founder Admin
 

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.

CrustyTV Television Shop: Take a virtual tour
Crusty's TV/VCR Collection: View my collection
Crustys Youtube Channel: My stuff
Crusty's 70s Lounge: Take a peek

 
Posted : 06/12/2015 9:21 pm
Terrykc
(@terrykc)
Posts: 4005
Member Rest in Peace
 

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!

Forum 145 

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

 
Posted : 06/12/2015 11:29 pm
FRANK.C
(@frank-c)
Posts: 252
Reputable Member Registered
Topic starter
 

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

www.electronics.frankcuffe.ovh

 
Posted : 07/12/2015 12:17 am
davegsm82
(@davegsm82)
Posts: 450
Honorable Member Registered
 

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.

https://sites.google.com/site/davegsm82/projects/radioputer - A BC5441 Turned into a Media Centre PC.

 
Posted : 08/12/2015 12:48 pm
FRANK.C
(@frank-c)
Posts: 252
Reputable Member Registered
Topic starter
 

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

www.electronics.frankcuffe.ovh

 
Posted : 08/12/2015 9:21 pm
Electrical
(@electrical)
Posts: 87
Trusted Member Registered
 

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.

 
Posted : 09/12/2015 12:14 pm
FRANK.C
(@frank-c)
Posts: 252
Reputable Member Registered
Topic starter
 

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

www.electronics.frankcuffe.ovh

 
Posted : 09/12/2015 8:41 pm
Terrykc
(@terrykc)
Posts: 4005
Member Rest in Peace
 

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

 
Posted : 10/12/2015 4:37 pm
Refugee
(@refugee)
Posts: 4055
Noble Member Registered
 

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.

 
Posted : 10/12/2015 7:00 pm
Electrical
(@electrical)
Posts: 87
Trusted Member Registered
 

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.

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.

 
Posted : 10/12/2015 7:49 pm
FRANK.C
(@frank-c)
Posts: 252
Reputable Member Registered
Topic starter
 

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

www.electronics.frankcuffe.ovh

 
Posted : 11/12/2015 11:07 pm
Cathovisor
(@cathovisor)
Posts: 6390
Famed Member Registered
 

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

 
Posted : 13/12/2015 3:15 pm
FRANK.C
(@frank-c)
Posts: 252
Reputable Member Registered
Topic starter
 

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

www.electronics.frankcuffe.ovh

 
Posted : 14/12/2015 11:13 pm
FRANK.C
(@frank-c)
Posts: 252
Reputable Member Registered
Topic starter
 

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

www.electronics.frankcuffe.ovh

 
Posted : 23/12/2015 7:04 pm
Doz
 Doz
(@doz)
Posts: 1485
Prominent Member Registered
 

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.

 
Posted : 23/12/2015 7:49 pm
Terrykc
(@terrykc)
Posts: 4005
Member Rest in Peace
 

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.

When all else fails, read the instructions

 
Posted : 23/12/2015 8:18 pm
FRANK.C
(@frank-c)
Posts: 252
Reputable Member Registered
Topic starter
 

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

www.electronics.frankcuffe.ovh

 
Posted : 23/12/2015 9:19 pm
jjl
 jjl
(@jjl)
Posts: 89
Estimable Member Registered
 

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

 
Posted : 24/12/2015 11:00 am
FRANK.C
(@frank-c)
Posts: 252
Reputable Member Registered
Topic starter
 

Hi John
I don't understand your first paragraph

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

www.electronics.frankcuffe.ovh

 
Posted : 24/12/2015 2:45 pm
Page 1 / 7
Share: