<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:PMingLiU;
        panose-1:2 1 6 1 0 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
@font-face
        {font-family:"\@PMingLiU";
        panose-1:2 1 6 1 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;
        mso-fareast-language:EN-US;}
span.E-MailFormatvorlage20
        {mso-style-type:personal-compose;
        font-family:"Aptos",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE-AT" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="FR" style="font-size:11.0pt;font-family:"Aptos",sans-serif">Hi Jean-Paul!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Aptos",sans-serif">Wow, what an amazing project!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Aptos",sans-serif">I am really astonished that it worked!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Aptos",sans-serif">Thank you for your insights!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Aptos",sans-serif">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$B!D(B<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Aptos",sans-serif">Ciao<br>
Peter<o:p></o:p></span></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div style="mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.0pt;padding:0cm 0cm 1.0pt 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;border:none;padding:0cm">
<span lang="EN-US" style="font-family:"Aptos",sans-serif;mso-fareast-language:DE-AT"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Aptos",sans-serif;mso-fareast-language:DE-AT">Web page:
</span><span style="font-family:"Aptos",sans-serif;mso-fareast-language:DE-AT"><a href="http://ullrich.great-site.net/"><span lang="EN-US" style="color:blue">http://ullrich.great-site.net/</span></a></span><span lang="EN-US" style="font-family:"Aptos",sans-serif;mso-fareast-language:DE-AT"><br>
Datadial (Synth Add-On): </span><span style="font-family:"Aptos",sans-serif;mso-fareast-language:DE-AT"><a href="http://ullrich.great-site.net/f_music4.htm"><span lang="EN-US" style="color:blue">http://ullrich.great-site.net/f_music4.htm</span></a></span><span lang="EN-US" style="font-family:"Aptos",sans-serif;mso-fareast-language:DE-AT"><br>
Roland Sampler Tool Sxxx: </span><span style="font-family:"Aptos",sans-serif;mso-fareast-language:DE-AT"><a href="http://ullrich.great-site.net/f_music5.htm"><span lang="EN-US" style="color:blue">http://ullrich.great-site.net/f_music5.htm</span></a></span><span lang="EN-US" style="font-family:"Aptos",sans-serif;mso-fareast-language:DE-AT"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="DE" style="font-size:11.0pt;mso-ligatures:none;mso-fareast-language:ZH-TW">Von:</span></b><span lang="DE" style="font-size:11.0pt;mso-ligatures:none;mso-fareast-language:ZH-TW"> Synth-diy <synth-diy-bounces@synth-diy.org>
<b>Im Auftrag von </b>Jean-Pierre Desrochers via Synth-diy<br>
<b>Gesendet:</b> Montag, 4. Mai 2026 15:50<br>
<b>An:</b> Synth-diy@synth-diy.org<br>
<b>Betreff:</b> *EXT* [sdiy] First exchanges with ChatGPT... program code extract + conversion.. AWESOME !!!<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-CA">In 1996 I designed a 2 octaves MIDI Bass pedal board<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">made around what I used at that time.. </span>
<span lang="FR-CA">a Motorola HC811E2 micro.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA" style="mso-ligatures:none"><img border="0" width="621" height="348" style="width:6.4687in;height:3.625in" id="Bild_x0020_1" src="cid:image001.jpg@01DCDC71.A3B8E190"></span><span lang="FR-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">The circuit included a complete synth structure with ADSR, 2 VCO$B!G(Bs VCA, VCF and MIDI output.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">It still works very well after all those years.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">But recently I tried to browse my original program listings and HEX files (.S19 file for Motorola)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">to see what I$B!G(Bd done in the past$B!D(B but.. no such files left !! Woohh..
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Only some hand written schematics and notes on papers.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">BUT I also had a pile of 26 pages of the original .LST file which was the printed results<br>
of the original compiled assembler code that was lost over time..<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">The assembler compiler I used was IASM11.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Pages like this:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="mso-ligatures:none"><img border="0" width="609" height="465" style="width:6.3437in;height:4.8437in" id="Image_x0020_1" src="cid:image002.png@01DCDC71.A3B8E190"></span><span lang="EN-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">That is what I only had left from my original design..<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">My goal now was to $B!F(Bretrieve$B!G(B my .S19 compiled code from the installed HC811E2<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">and save it in case something goes wrong with the micro so I could reprogram<br>
another one. But I did not have the appropriate hardware to read the HC..<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">So I thought.. Why not redo this design with the same schematic<br>
but using a new PIC micro instead ?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">After checking the needed amount of I/O pins I found the PIC16F1789<br>
could be a good replacement..<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Since the only thing left of my code were the 26 printed pages<br>
I needed to extract the actual text code from these and save<br>
them in 26 separate .TXT files.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I first scanned all the 26 pages and saved them in JPG format.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Then I browsed the web to find any $B!F(BOn Line OCR$B!G(B available<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">and found some.. But the OCR extractions were not good at all<br>
missing or misreading many characters.. !!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">So I thought ChatGPT could be a solution in my case..<br>
My first try with this tool.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I went to ChatGPT and asked it to OCR my first JPG code page<br>
which it did very efficiently !<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Ok.. I did the same with all the 26 pages.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">26 text files saved.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I then $B!F(Bmerged$B!G(B in order all these pages in one single page of assembler code.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">So far ChatGPT had been a good partner for my job..<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Next step:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I asked ChatGPT to read my  HC811E2 assembler code file and<br>
create a Microchip XC8 C code for PIC16F1789<br>
giving it a clear description of the original HC11 pins number/function<br>
and the new PIC pins number/function to achieve the same job.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Its reply:<o:p></o:p></span></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">The source code is very large (more than 1000 lines with the complete POT_VAL table),
<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">so to make a clean, reliable and compilable conversion to XC8 for PIC16F1789, you must proceed in structured phases.<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">This is the correct method — otherwise you get incorrect or unusable code.<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">I will therefore continue exactly as in your previous requests, by generating:</span></i><i><span lang="EN-CA" style="color:#7030A0"><o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-CA" style="color:#7030A0"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><b><i><span lang="EN" style="font-size:18.0pt;color:#7030A0">Phase 1<o:p></o:p></span></i></b></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">PIC16F1789 Full Hardware Configuration:<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><b><i><span lang="EN" style="color:#7030A0">CONFIG bits<o:p></o:p></span></i></b></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">Internal oscillator 32 MHz + PLL<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0">ADC RA0–RA3<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0">USART MIDI 31250 baud on RC6<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0">PORTB outputs<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0">PORTD entries<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0">RC0–RC5 outputs<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0">Timer1<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0">CCP1 / CCP2 replacement TOC2 / TOC3<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0">global variables HC11 $B"*(B C<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><b><i><span lang="EN" style="font-size:18.0pt;color:#7030A0">Phase 2<o:p></o:p></span></i></b></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0">Conversion of structures:<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-CA" style="color:#7030A0"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">note tables (DO1 $B"*(B DO3)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">NOTE/PERIOD structure<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">table POT_VAL[256]<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">10-bit ADC reading $B"*(B conservation of 8 MSB<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">automatic table lookup<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><b><i><span lang="EN" style="font-size:18.0pt;color:#7030A0">Phase 3<o:p></o:p></span></i></b></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">Conversion of routines:<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">NOON()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">TXMIT()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">ADC()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">JAR()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">ADSR()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">SAW()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">DEBOUNC()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">DEADLINE()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><b><i><span lang="EN" style="font-size:18.0pt;color:#7030A0">Phase 4<o:p></o:p></span></i></b></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">Main logic conversion:<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">CHANNEL()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">TEST()<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">main loop<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">NOTE ON / NOTE OFF management<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">scanning complete crankset<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN" style="color:#7030A0">final CCP1/CCP2 interrupts</span></i><i><span lang="EN-CA" style="color:#7030A0"><o:p></o:p></span></i></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I then refined my request giving it back its code<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">and asking it to merge all these 4 phases together<br>
in one single .C program.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I did not include here the final code listed by ChatGPT..<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I then checked it carefully for all the Ins, OUTs, interrupts, clock speed, TIMERs, etc..<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Loaded it in MPLAB X compiler and.. IT WORKED !!!!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I couldn$B!G(Bt believe it.. <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">All this result starting from scanned listing pages !!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">That$B!G(Bs all I wanted to share with you..<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">For my needs here.. No special AI software to buy..<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I$B!G(Bm very happy !<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">And,, sorry for this long email but.. Yeah !<o:p></o:p></span></p>
</div>
<span style="font-size: 9px;"><br>
<br>
<br>
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
<span style="font-size: 11px;"></span>immediately.<br>
<br>
</span>
</body>
</html>