Tutorial 01 — Getting Started: Why AI Gets PBP3 Wrong and How to Fix That
AI and PicBasic Pro Tutorial Series — Post 1 of 6
Content produced with AI assistance and reviewed by the forum administrator.






The Problem


If you have pasted PBP3 code into an AI tool and asked it to write, fix, or explain it, you have probably had mixed results. Sometimes it gets things right. Often it produces code that looks correct but will not compile, uses the wrong DEFINE values, or generates CONFIG bits that conflict with each other.


This is not the AI being careless. It is the AI working without the information it needs.


PicBasic Pro is a niche compiler. The amount of PBP3-specific content in any AI's training data is limited. When the AI does not have a reliable answer it approximates — and approximations on CONFIG bits, DEFINE statements, and register layouts produce code that looks plausible but fails on the compiler or the device.


The good news is that this problem has a practical solution that does not require any special technical knowledge. You give the AI the reference documents it needs rather than relying on what it already knows.






The Root Cause — What AI Actually Knows About PBP3


AI tools are trained on large amounts of publicly available text. For mainstream languages like Python or C, that training data is extensive and the AI performs well. For PBP3, the training data is thin. The AI has general PIC knowledge, some familiarity with BASIC syntax, and fragments of PBP3 examples from forum posts and documentation that made it into training.


What it does not have is a reliable, complete internal model of:

  • PBP3 DEFINE statements and which values are valid for which devices
  • Device-specific CONFIG bit names and their correct settings
  • Register layouts and bit interactions for specific PIC variants
  • The difference in peripheral behaviour between 16F and 18F families
  • PBP3-specific compiler directives and their placement rules


When you ask the AI to generate or fix code and it hits one of these gaps, it fills it from general knowledge and adjacent information. The result is code that the AI is confident about and that is wrong in ways that are not immediately obvious.






The Solution — Give the AI Its Reference Material


The solution is straightforward. Instead of asking the AI to recall PBP3 specifics from training, you give it the documents it should be working from — the compiler manual, the device datasheet, and examples of working code. The AI then works from those documents rather than from memory.


Modern AI tools support this through a feature called a persistent workspace or project. You upload documents once and every conversation you have within that workspace has access to them automatically. The AI does not need to be reminded. It does not lose the documents between sessions. They are simply there.


This single change — moving from AI memory to AI plus authoritative documents — addresses the majority of errors that AI-generated PBP3 code contains.


The following tutorials in this series cover the practical steps:

  1. Tutorial 02 — Setting up your AI workspace and uploading reference documents
  2. Tutorial 03 — Writing a profile instruction that sets the AI's baseline behaviour
  3. Tutorial 04 — A structured three-prompt workflow for debugging existing code
  4. Tutorial 05 — How AI reads complex documents and how to make them work harder
  5. Tutorial 06 — Putting it all together: a complete working setup






What to Expect


Following this series will not make AI produce perfect PBP3 code every time. That is not a realistic expectation. What it will do is significantly reduce the class of errors that come from the AI not having the right information. Configuration errors, wrong DEFINE values, invalid register references — these largely disappear when the AI has the manual and the datasheet in front of it.


What remains is the AI's responsibility to reason correctly from that material. You still need to read the output. You still need to test on hardware. You are not removing your judgement from the process — you are removing the information gap that produces the most common and most frustrating class of errors.






Next: Tutorial 02 — Setting Up Your AI Workspace
This tutorial series was produced with AI