Note that the instructions may not match actual page content because the site is under development.

Background and purpose of microCGL™

microCGL™ is a work in progress with a goal of developing GUIs that use a graphical programming language to generate microcontroller code that is compatible with OEM development softwares (such as Microchip MPLAB®) and a GUI for microcontroller interaction (this is undeveloped as of now). Therefore, the name microCGL™ (microController Graphical Language) is appropriate. There are two primary code development GUIs:

Icons built in the IB perform a purpose stated by the developer and can contain compatible code for multiple microcontrollers (this is in development).


The GUI in which the Icon for use in the CB is developed is called the IB. Prior to interacting with the IB GUI, a separate page will appear with the Microcontroller Selection Box (aka MSB) to prompt the user to select the brand of the microcontroller or board and the model. The lists will only contain microcontrollers or boards that are compatible with microCGL. Once a selection is confirmed, it can't be undone without restarting.

Figure 0. MSB. Note that other brands and their compatible controllers will eventually be able to selected from.

The IB consists of two screens that are placed side-by-side, the Icon Developer Screen (aka IDS) on the left and the Code Developer Screen (aka CDS).

Figure 1. IB GUI. Note that the IDS grid lines do not appear as they normally would due to picture resizing.

The background of the IDS resembles engineering notepad paper. The intersections of the lines are also grid points where IEs snap to when the IEs are placed onto the IDS or moved.

Figure 2. IDS screen in which an example of all the IEs are shown with default names. The IE in which the mouse was last over is blue. The IE in which the mouse is currently over is yellow.

Figure 3. IDS fields for IEs.

Figure 4. IDS radio buttons for selecting which IEs will be placed on the IDS.

Figure 5. CDS screen shot example with Microchip PIC® code. Three CodBs exist (explained below the figure caption):

Operation OLB1 OLB2 OLB3

ADDLW Byte in None None

ADDWF Byte in W or f 0 or 1

ANDLW Byte in W or f 0 or 1

ANDWF Byte in W or f 0 or 1

BC Link out None None

BCF Byte in Bit in 0 or 1

BN Link out None None

BNC Link out None None

BNN Link out None None

BNOV Link out None None

BNZ Link out None None

BRA Link out None None

BSF Byte in W or f 0 or 1

BTFSC Bit in W or f 0 or 1

BTFSS Bit in W or f 0 or 1

BTG Byte in W or f 0 or 1

BOV Link out None None

BZ Link out None None

CALL Link out 0 or 1 None

CLRF Byte in 0 or 1 None

CLRWDT None None None

COMF Byte in None None

CPFSEQ Byte in 0 or 1 None

CPFSGT Byte in 0 or 1 None

CPFSLT Byte in 0 or 1 None

DAW None None None

DECF Byte in W or f 0 or 1

DECFSZ Byte in W or f 0 or 1

DCFSNZ Byte in W or f 0 or 1

GOTO Link out None None

INCF Byte in W or f 0 or 1

INCFSZ Byte in W or f 0 or 1

INFSNZ Byte in W or f 0 or 1

IORLW Byte in None None

IORWF Byte in W or f 0 or 1

LFSR Byte in Byte in None

MOVF Byte in W or f 0 or 1

MOVFF Byte in Byte in None

MOVLB Byte in None None

MOVLW Byte in None None

MOVWF Byte in None None

MULLW Byte in None None

MULWF Byte in 0 or 1 None

NEGF Byte in 0 or 1 None

NOP None None None

POP None None None

PUSH None None None

RCALL Link out None None

RESET None None None

RETFIE 0 or 1 None None

RETLW Byte in None None

RETURN 0 or 1 None None

RLCF Byte in W or f 0 or 1

RLNCF Byte in W or f 0 or 1

RRCF Byte in W or f 0 or 1

RRNCF Byte in W or f 0 or 1

SETF Byte in 0 or 1 None

SLEEP None None None

SUBFWB Byte in W or f 0 or 1

SUBLW Byte in None None

SUBWF Byte in W or f 0 or 1

SUBWFB Byte in W or f 0 or 1

SWAPF Byte in W or f 0 or 1

TBLRD None None None

TBLWT None None None

TSTFSZ Byte in 0 or 1 None

XORLW Byte in None None

XORWF Byte in W or f 0 or 1

If the entire byte or bit of a Variable is to be used, then select ALL from the dropdown menu where appropriate.

CLs do not wire into other CLs. Only VLs can wire into Code Line Variable Links (CLVLs), which are red to indicate that they are wired into to accept information from the VI.


The CB GUI uses Icons created in the IB GUI for creating code compatible to OEM development software based on arranging icons that may be otherwise be extremely complicated (such as assembly code). In addition to icons created in the IB GUI by a Developer (aka DCI), there are three standard icons used in the CB GUI, although other Icons may exist that are compatible with compatible microcontrollers, such as for interrupts. Prior to interacting with the IB GUI:

Figure 7. CB screenshot in which the icon created in the previous example is used along with icons common to the CB. See the information below this caption for more information.

VIs are available to manipulate data. VIs can only be wired from the VI to the a VL in an Icon. Three types of variables are exist in the CB GUI. Multiple VIs for the same VI can exist for the same data as long as the name is the same. Multiple wires can begin from one VI.

The type of Icon VL will depend on which VI can be wired into it.

Wiring one IL to another IL in the CB GUI is accomplished by left clicking on a StL while keeping the left mouse button down, dragging the end of the Wire (no acronym necessary) over to the EnL, and releasing the left mouse button. Note that Wires for wiring Icons together have both StLs and EnLs that diamonds orientated length-wise top-to-bottom. Rules for wiring:

The Properties button opens the PB the same box that is used for the IB GUI. The Check for Conflicts button will compare the properties of all the icons used at that time and create a list of conflicts if any exist or state that no conflicts exist.

Once the graphical code is added to the CB GUI by the user and is ready to be translated into microcontroller compatible language, pressing the “Generate Code” button will generate the microcontroller compatible code into text box that will appear in a text box for the user to review and either save to their profile or cancel.

Microchip PIC® 8-bit assembly code format

microCGL™ is compatible with the following Microchip PIC® microcontrollers and MPLAB® (where a “→” indicates that an upgrade exists:

Icons that are created in the IB GUI have routine and variable names generated into assembly code as follows:

In initial code compatible with the PIC® 18F452, variables, main routine, high priority interrupt routine, and low priority interrupt routine are ordered as follows:


; Assembly code generated through is distributed "as is" without any warranty of any kind expressed

; or otherwise implied and may contain errors and other unintended problems in both the program itself and the

; generated assembly code. Neither Zachary Montgomery nor users will be liable for damages that result from

; the use, misuse, or lack of use of this program. Use this code at your own risk.

LIST P = 18F452, F = INHX32

#include <P18F452.INC>

; ********** VARIABLES **********

cblock 0x009


; Reset vector

ORG 0x0000

goto Main

; ********** VECTORS **********

; High priority interrupt

ORG 0x0008

goto HiPriorityInt

; Low priority interrupt

ORG 0x0018

goto LoPriorityInt

; High priority interrupt routine


; Low priority interrupt routine


; Main routine



AI: Array Icon

BI: Bit Icon

CB: Code Builder

CBL: Code Block Link

CC: Code Line Column

CDS: Code Developer Screen

ChB: Check Box

CLStL: Code Line Start Link

CLVL: Code Line Variable Link

CodB: Code Block

CodL: Code Line

ComL: Comment Line

ConL: Condition Line

DCI: Developer Created Icon

EI: End Icon

EL: Element Label

EnL: End Link

IB: Icon Builder

IDS: Icon Developer Screen

IE: Icon Element

IcF: Icon Frame

IL: Icon Link

Lb: Label

MSB: Microcontroller Selection Box

Mn: Menu

NonL: None Line

OLB1: Operation Line Box 1

OLB2: Operation Line Box 2

OLB3: Operation Line Box 3

OpL: Operation Line

PB: Properties Box

RB: Radio Button

RegI: Register Icon

RI: Routine Icon

SI: Start Icon

StL: Start Link

VI: Variable Icon

VL: Variable Link

microCGL™ software is compatible with Microchip Technology Incorporated microcontrollers and software. MPLAB® and PIC® are the registered trademarks of Microchip Technology Incorporated. Microchip is a trademark of Microchip Technology Incorporated in the United States and other countries. This website is not associated with Microchip Technology Incorporated.

Zachary Montgomery © 2017