Programming PIC Microcontrollers in BASIC

Programming PIC Microcontrollers in BASIC - Examples with PIC Integrated Peripherals

Reading time: <1 minut

Author: microElectronics
Year of publication: 2004

What it is?

Some of the main advantages of the compiler microBasic PIC it is the ease of use and the ability to make a project work in a few hours, instead of days or weeks.

The ability to program a microcontroller in BASIC is a "dream come true." Moreover, when the BASIC language is in the form of a compiler, combining both speed and ease of use.

PicBasic Pro compiler (PIC mikroBasic) allows total control over the range of PICs 14 bits and 16 bits.

The structure of the paper

CHAPTER 1. The Basics

1.1 Why BASIC?
1.2 Choosing the right PIC for the task
1.3 A word about code writing
1.4 Writing and compiling your program
1.5 Loading program to microcontroller
1.6 Running the program
1.7 Troubleshooting

CHAPTER 2. Elements of BASIC Language

2.1 Identifiers
2.2 Operators
2.3 Expressions
2.4 Instructions
2.5 Data Types
2.6 Constants
2.7 Variables
2.8 symbols
2.9 Directives
2.11 Labels
2.12 Procedures and Functions
2.13 Modules

CHAPTER 3. Operators

3.1 Arithmetic Operators
3.2 Boolean Operators
3.3 Logical (Bitwise) Operators
3.4 Relation Operators (Comparison Operators)

CHAPTER 4. Control Structures

4.1 Conditional Statements
4.1.1 IF..THEN Statement
4.1.2 SELECT..CASE Statement
4.1.3 GOTO Statement
4.2 Loops
4.2.1 FOR statement
4.2.2 DO..LOOP Statement
4.2.3 WHILE Statement
4.3 ASM Statement

CHAPTER 5. Built-in and Library Routines

5.1 Built-in Routines
5.2 Library Routines

CHAPTER 6. Examples with PIC Integrated Peripherals

6.1 Interrupt Mechanism
6.2 Internal AD Converter
6.3 TMR0 Timer
6.4 TMR1 Timer
6.5 PWM Modules
6.6 Hardware UART modules (RS-232 Communication)

CHAPTER 7. Examples with Displaying Data

7.1 LED Diodes
7.2 Seven-Segment Display
7.3 LCD Display, 4-bit and 8-bit Interface
7.4 Graphical LCD
7.5 Sound Signaling

CHAPTER 8. Examples with Memory and Storage Media

8.1 EEPROM Memory
8.2 Flash Memory
8.3 Compact Flash



  1. Before Arduino appeared with all the boards, I also programmed PICs. For "home" or hobbyist users, the battle has been lost by PIC.

        1. For any type of microcontroller there are compilers in both C and Basic. I program in basic ESP32, Atmel and PIC. I say that many run away from PICs because they have libraries and examples at hand for Arduino, it's more "black and white", but they are outdated. In automotive, I did not see Atmel (possibly something, but rarely) but only PICs. With the current crisis at Microchip, cars have turned right. The vast majority of electronic boards of household appliances have PIC. The electricity meters currently being manufactured have PICs. I haven't studied it carefully, so I can't argue, but I don't think STM32 has anything over DSPIC33CK. I see something like this: why work with 16 bits when you don't even master 8 bits?

  2. I program / program it in mikroPascal. That's how we started in 2005. MikroPascal, mikroBasic are much friendlier languages, but they are only used in very rare cases. C was and still is a very popular language. The future begins to sound through Python, a language I've noticed that borrows some of the latter 2 combined with C.

    1. microPython on Rpi Pico is not bad at all, in terms of ease of use, you can write code directly in the editor and upload it to uC.

Add a comment

Your email address will not be published. Required fields are marked with *

The maximum upload file size: 2 MB. you can upload: image, audio, video, document, spreadsheet, Interactive, text, archive, queues, Other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop files here