[sdiy] First exchanges with ChatGPT... program code extract + conversion.. AWESOME !!!
Peter Ullrich
Peter.Ullrich at kapsch.net
Tue May 5 09:32:09 CEST 2026
Hi Jean-Paul!
Wow, what an amazing project!
I am really astonished that it worked!
Thank you for your insights!
Maybe I should convert my old 8051 synth addon projects written in PL/M-51 and Assembler-51 to AVR microcontrollers to keep them alive…
Ciao
Peter
Web page: http://ullrich.great-site.net/
Datadial (Synth Add-On): http://ullrich.great-site.net/f_music4.htm
Roland Sampler Tool Sxxx: http://ullrich.great-site.net/f_music5.htm
Von: Synth-diy <synth-diy-bounces at synth-diy.org> Im Auftrag von Jean-Pierre Desrochers via Synth-diy
Gesendet: Montag, 4. Mai 2026 15:50
An: Synth-diy at synth-diy.org
Betreff: *EXT* [sdiy] First exchanges with ChatGPT... program code extract + conversion.. AWESOME !!!
In 1996 I designed a 2 octaves MIDI Bass pedal board
made around what I used at that time.. a Motorola HC811E2 micro.
[cid:image001.jpg at 01DCDC71.A3B8E190]
The circuit included a complete synth structure with ADSR, 2 VCO’s VCA, VCF and MIDI output.
It still works very well after all those years.
But recently I tried to browse my original program listings and HEX files (.S19 file for Motorola)
to see what I’d done in the past… but.. no such files left !! Woohh..
Only some hand written schematics and notes on papers.
BUT I also had a pile of 26 pages of the original .LST file which was the printed results
of the original compiled assembler code that was lost over time..
The assembler compiler I used was IASM11.
Pages like this:
[cid:image002.png at 01DCDC71.A3B8E190]
That is what I only had left from my original design..
My goal now was to ‘retrieve’ my .S19 compiled code from the installed HC811E2
and save it in case something goes wrong with the micro so I could reprogram
another one. But I did not have the appropriate hardware to read the HC..
So I thought.. Why not redo this design with the same schematic
but using a new PIC micro instead ?
After checking the needed amount of I/O pins I found the PIC16F1789
could be a good replacement..
Since the only thing left of my code were the 26 printed pages
I needed to extract the actual text code from these and save
them in 26 separate .TXT files.
I first scanned all the 26 pages and saved them in JPG format.
Then I browsed the web to find any ‘On Line OCR’ available
and found some.. But the OCR extractions were not good at all
missing or misreading many characters.. !!
So I thought ChatGPT could be a solution in my case..
My first try with this tool.
I went to ChatGPT and asked it to OCR my first JPG code page
which it did very efficiently !
Ok.. I did the same with all the 26 pages.
26 text files saved.
I then ‘merged’ in order all these pages in one single page of assembler code.
So far ChatGPT had been a good partner for my job..
Next step:
I asked ChatGPT to read my HC811E2 assembler code file and
create a Microchip XC8 C code for PIC16F1789
giving it a clear description of the original HC11 pins number/function
and the new PIC pins number/function to achieve the same job.
Its reply:
The source code is very large (more than 1000 lines with the complete POT_VAL table),
so to make a clean, reliable and compilable conversion to XC8 for PIC16F1789, you must proceed in structured phases.
This is the correct method - otherwise you get incorrect or unusable code.
I will therefore continue exactly as in your previous requests, by generating:
Phase 1
PIC16F1789 Full Hardware Configuration:
CONFIG bits
Internal oscillator 32 MHz + PLL
ADC RA0-RA3
USART MIDI 31250 baud on RC6
PORTB outputs
PORTD entries
RC0-RC5 outputs
Timer1
CCP1 / CCP2 replacement TOC2 / TOC3
global variables HC11 → C
Phase 2
Conversion of structures:
note tables (DO1 → DO3)
NOTE/PERIOD structure
table POT_VAL[256]
10-bit ADC reading → conservation of 8 MSB
automatic table lookup
Phase 3
Conversion of routines:
NOON()
TXMIT()
ADC()
JAR()
ADSR()
SAW()
DEBOUNC()
DEADLINE()
Phase 4
Main logic conversion:
CHANNEL()
TEST()
main loop
NOTE ON / NOTE OFF management
scanning complete crankset
final CCP1/CCP2 interrupts
I then refined my request giving it back its code
and asking it to merge all these 4 phases together
in one single .C program.
I did not include here the final code listed by ChatGPT..
I then checked it carefully for all the Ins, OUTs, interrupts, clock speed, TIMERs, etc..
Loaded it in MPLAB X compiler and.. IT WORKED !!!!
I couldn’t believe it..
All this result starting from scanned listing pages !!
That’s all I wanted to share with you..
For my needs here.. No special AI software to buy..
I’m very happy !
And,, sorry for this long email but.. Yeah !
The information contained in this e-mail message is privileged and confidential and is for the exclusive use of the addressee. The person who receives this message and who is not the addressee, one of his employees or an agent entitled to hand it over to the addressee, is informed that he may not use, disclose or reproduce the contents thereof, and is kindly asked to notify the sender and delete the e-mail immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20260505/1082af49/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 22921 bytes
Desc: image001.jpg
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20260505/1082af49/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 346994 bytes
Desc: image002.png
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20260505/1082af49/attachment.png>
More information about the Synth-diy
mailing list