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