convert two analogue pulses (5000/second) for display on HDMI or Composite Video

Started by charliecoutas, Jun 29, 2026, 01:19 PM

Previous topic - Next topic

See_Mos

I like the idea of a PIC driving VGA but If it is for text only would it not be easier to just use an old PC or laptop and write something in visual Basic?

Even a Pi might be easier if you want something small.

top204

I have adapted the VGA code using the PIC18F46K22 device, to Positron8 on a PIC18F26K22 device, but I cannot test it yet, until I get a VGA socket from somewhere, and dig out my old VGA monitor from the loft. However, the timings look OK.

The code mechanism in the original, is very cumbersome, with rotating the whole of a port for a single bit out, so when I do test it, and get it working, I will adapt the interrupt to use a hardware SPI peripheral for the data bits, and then, maybe, adapt it for colour using PWM peripherals, or USARTs, or a simple 8-bit colour mechanism, using the 3 RGB pins.

Once I know it is working, I will add the character routines to it. i.e. Print, and multiple fonts etc..

Please let me know if it is working, if anyone has a VGA monitor to try, because it may be a few days before I find what I need here.

The source codes are attached below.

Regards
Les

JonW

Les, you should get this tomorrow from Amazon  ;D   

charliecoutas

Sorry Les, your reply came while I was typing this. Please don't go to a lot of trouble as I think I have got it sorted. Using a Rasberry Pi Pico I'm afraid. I can't test your code because my VGA screen is at Bletchley. This is what I sent before I saw your post:

Yes, I thought about that but I've used a Raspberry Pi Pico before and I thought it would be easy. I was wrong! I found some code written in Micropython on Github that I have managed to get working, eventually.

I have a Pico2 which has the later version of the RP2040 chip, called RP2350. They are supposed to be backward compatible, so I assumed code written for the RP2040 would work on the RP2350. Wrong. I later bought a Pico with the RP2040 chip and it works!

The problem seems to be in the PIO section: the PIO has a number of "state machines" which you can program to generate things like the vertical and horizontal pulses for the VGA protocol. These are independent of the main cpu so they don't affect it.

Anyway, I am now well on my way to getting a large(ish) screen with lots of text and moving images, and analysis of the paper tape on Colossus. Quite a journey.

If anybody is interested I can post the code, when I have got it working. Lynda and I are away for the next couple of weeks floating down the rivers of Europe (if there is any water left in them after such a long dry spell).

Regards to all
Charlie

charliecoutas

Les, the word grateful doesn't seem enough but I can't find a better one. Thank you so much, I would much prefer to use your code on the Colossus Tape Reader display. I can't do anything for the next two weeks, we are away on a much-needed holiday and I'm not allowed to do any electronics/coding.

I owe you one, (then another then.........)

Charlie

top204

Charlie... I had such a lovely day at Bletchley, thanks to you, Tim, Ricardo, and the, 'truly', good people there, it will remain in my memory until the day I pass. You and Tim, actually made one of my dreams come true. So my thanks will always be to you and Tim.


This afternoon... I was sorting out my tools for the fence I am putting up in the front garden, when a package dropped in the door.

It was from amazon, so I automatically thought it was one of they ploys or spams or encouragements, because I do not go anywhere near amazon. So when I opened it, I found 2 of those VGA adapters Jon posted about, yesterday?

Many, many thanks Jon. I did not realise that you had purchased 2 of them for me. I had thought you meant: "you can get these items from amazon, and they will arrive the next day" :-)

I'll wire it up tomorrow morning, and see if my code works, and if not, correct it, then adapt it for more efficiency, and also on a PIC24 or dsPIC33 device.

We have some truly lovely people on this forum.

Very best regards
Les