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:
a GUI called Icon Builder (aka IB) that consists of the icon frame and Icon Elements (aka IEs) for the user interface with and connect to other icons and variables
a GUI called Code Builder (aka CB) the user places and connects Icons (no acronym necessary) and variables to create compatible microcontroller code
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.
IEs are visible components of an Icon can be interacted with by the user in the IC GUI. In the IC GUI, the IEs are inside the Icon Frame (aka IcF). IEs are highlighted yellow when the mouse is over an IE and highlighted blue to indicate the last IE that the mouse was over. There are four fields located below the IDS to modify the properties of the last IE that the mouse was over (as highlighted in blue):
Element name: Name given by the Icon Developer to an IE for use in the CDS that is not visible in the IDS.
Text: Element Label (aka EL) given by the Icon Developer to an IE for identification that is visible in the IDS.
Group: Applicable to Radio Buttons (aka RBs) only, the name given by the Icon Developer to the group of RBs for use in the CDS.
Variable link properties: Applicable to Variable Links (aka VLs) only, the property set by Icon Developer to make the VL for use only with a certain datatype: Arrays (including specific size), Bytes, and Bits.
There are two buttons located below the IDS to interact with IEs:
Changes to the above four fields can be saved clicking on the button “Save Change(s)”.
The last IE that the was over (as highlighted in blue) can be deleted by clicking the “Delete Element” button.
There are six IEs.
Icon Link (aka IL)
Icons in the CB GUI are wired together for the purpose of establishing the order the code in the Icons is organized when the “Generate Code” button is pressed in the CB GUI.
In both the IB GUI and the CB GUI, an IL is composed of two parts: the link and the Element Label (aka EL). The link is a vertical rectangle that can be colored either green or red – depending on its creation in the IB GUI. A green colored link is a Start Link (aka StL) and a red link is an End Link (aka EnL) for the purpose of wiring Icons, not Variable Icons (aka VIs), together in the CB GUI. The EL is the assignment of the IL given to it in the IB GUI Text field.
To create an IL the IB GUI, click the “Icon Link” radio button above the IDS. Note that this radio button is selected by default. Click anywhere on a blank space in the IDS. The new IL will appear in the IDS as a StL by default and with the default EL name “iconlink” followed by the incremented number in the order that the IL was created beginning with 0.
Variable Link (aka VL)
VLs are the counterpart to ILs for Variable Icons (aka VI). VIs in the CB GUI are wired together for the purpose of establishing which VB is used in the code for the Icon when the “Generate Code” button is pressed in the CB GUI.
In both the IB GUI and the CB GUI, a VL is composed of two parts: the link and the EL. The link is a horizontal rectangle that can be colored either green or red – depending on its creation in the IB GUI. A green colored link is a Start Link (aka StL) and a red link is an End Link (aka EnL) for the purpose of wiring Variables into Icons in the CB GUI. The EL is the assignment of the VL given to it in the IB GUI Text field.
To create a VL the IB GUI, click the “Variable Link” radio button above the IDS. Click anywhere on a blank space in the IDS. The new VL will appear in the IDS as a StL by default and with the default EL name “variablelink” followed by the incremented number in the order that the VL was created beginning with 0.
Wiring one VL of a VI to a VL or an Icon in the CB GUI is accomplished by left clicking on the StL of the VI VL while keeping the left mouse button down, dragging the end of the Wire over to the EnL of the Icon VL, and releasing the left mouse button. Note that Wires for wiring Vls together have both StLs and EnLs that diamonds orientated length-wise side-to-side. Rules for wiring:
A Wire can only begin at on StL of a VL and end at the EnL of an Icon.
StLs of a VL cannot wire into other StLs.
VIs cannot wire into other VIs.
Radio Button (aka RB)
Conditions set by the Icon Developer for creating compatible code based on one selection of multiple choices as chosen by the User in the CB GUI can be performed by using a placing a RB into the Icon in the IB GUI. The RB selected in the IDS will be selected by in the CB GUI. Selecting a RB is performed by clicking on either the Button or the RB label.
RBs are grouped so that only one RB is selected from multiple choices by assigning a group name and entering this into the Group field located below the IDS. After clicking the “Save Change(s)” button, groups in which there are none or more than one radio buttons selected will regroup so that the first RB in the group will be selected.
Check Box (aka ChB)
Conditions set by the Icon Developer for creating compatible code base on the User selecting one choice as either true or false in the CB GUI can be performed by using a CbB. An “X” in the ChB indicates at true selection. The default for a new ChB is true. Toggling the CbB is performed by clicking on either the check box or the label.
Label (aka Lb)
For the purpose of adding notes or titles to an Icon in addition to the labels that are provided with other IEs, LBs can be used. LBs are not used in the CDS. Therefore, the “Element name” field is disabled and “NA”.
Menu (aka Mn)
Conditions set by the Icon Developer for creating compatible code based on one selection of multiple choices as chosen by the User in the CB GUI but when space needs saved compared to using a RB can be performed by using a placing a Mn into the Icon in the IB GUI. The Mn name is displayed on the Mn in the IDS. The options in the menu can be entered in the Text field separating the options by a “,”.
The IcF is not visible in the IB GUI but is sized to fit around the IEs when the Icon is created.
The CDS is intended to resemble a cork board with index cards place on it in which the index cards are connected by wires that indicate progression through instructions written on the lines of the index cards. The entire object that is intended to resemble an index card is referred to in microCGL™ as a Code Block (aka CodB).
Figure 5. CDS screen shot example with Microchip PIC® code. Three CodBs exist (explained below the figure caption):
CB_START: The blue CBL in the top left corner identifies this CodB as the start CodB. The VL, with IDS text “Input variable”, is used at the BTFSS input through the variable INPUT. If INPUT is true or set, then the code will go to CB_TESTSLEEP as shown by the wire from the GOTO CLVL to the CBL of CB_TESTSLEEP. Otherwise, the code will go to CB_NEXTICON.
CB_TESTSLEEP: The first CodL will generate a NOP operation. The following CodL is a ComL as indicated by the red background. Left-clicking on the ComL will produce a dialog box that can be edited as shown below for the purpose of adding the comment to the code.
Figure 6. Following the ComL is a ConL that tests the RB with text of the RB “Next icon” to determine if it's true as selected by the user. The GOTO operation below the ConL is indented once to the right, indicating that if the ConL above it is true, then it will generated to the final code. Otherwise, it will be ignored when code is generated. The CLVL goes to the code of CB_NEXTICON, which will generate code to go to that routine. If the user selects the RB with the text “Next icon”, then CDS will generate a SLEEP operation in the final code.
CB_NEXTICON: The first CodL is a NOP operation. The second CodL is an operation to go to the routine that will be the generated based on the next icon that this icon is wired into.
Code Blocks (aka CodB)
The CodB is divided into three sections. The upper margin consists of two of the sections. The left corner of the upper margin is the Code Block Link (aka CBL) to the CodB used for wiring. Most CBLs will be red, indicating that the Wire into the red CBL ends that CBL. However, every Icon will have one blue CBLwhich will indicate at which CBL the code for that Icon begins. Right of the CBL is the name given to the CodB. The default name is always “CODEBLOCK” followed by an incremented number indicating in order when the CodB was created beginning with zero. Below the upper margin will be at least on Code Line (aka CodL). The CodB name will be shown in the field below the CDS and can be edited there. The two perpendicular index card lines that seperate the CBL and the CodB name and run vertically through the CodLs are typically pink except when a CodB is highlighted yellow when the mouse is directly over a CodB or highlighted green to indicate the last CodB that the mouse was over when the mouse is not over a CodB.
Code Lines (aka CodL)
The final code for the compatible microcontroller and the instructions for organizing the code based on the User input is based on the CodLs on the CodB. A CodL has five CodL Buttons that can either delete or move a CodL:
Clicking the red square of a CodL deletes a CodL. Note that a CodB must have at least one CodL. Attempting to delete the only CodL of a CodB will result in an error message “The number of Code Lines can't be zero”.
Clicking the up arrow of a CodL moves that CodL vertically to the CodL above it. Note that a the top CodL cannot move vertically. Attempting to move the top CodL vertically will result in an error message “The top Code Line can't be moved up”.
Clicking the left arrow of a CodL moves the indention of that CodL left. Indention indicates which, if any, Condition a CodL will be included in. No CodL can be moved left of the default indentation.
Clicking the left arrow of a CodL moves the indention of that CodL left. Indention indicates which, if any, condition a CodL will be included in.
Right of the CodL Buttons is the Code Line Columns (aka CLCs). These are used to place CLC Items from a menu into that CodL. A CLC with a “?” indicates that no selection has been made for that CLC. Making a selection for a CLC is accomplished by clicking the ? located there or the already existing CLC Item which will produce a menu with options. The CLC Items will depend on the CLC Type and the compatbile microcontroller being used.
There are four CodL types:
Operation Line (aka OpL)
The actual code that a compatible microcontroller will use is entered in a CodB in a CodL that is an OpL. The CLC Items for an OpL are dependent on the compatible microcontroller being used. An OpL is white with with other configurations according to the compatible microcontroller.
For compatible PIC® 8 bit microcontrollers, there are two links called Operation Line Box 1, 2, and 3 (aka OLB1, OLB2, and OLB3). As a rule:
OLBs are always StLs (indicated as red) and wire into CBLs or ILs, which in the CB GUI are EnLs even though they are shown in the IB GUI as StLs.
OLBs are always EnLs (indicated as red) when a VI is wired into them.
OLBs that are shown as a “?” and produce a dropdown menu when used with compatible 8 bit PIC® microcontrollers for d, a, and s.
Compatible with the PIC® 18F452, OLBs correspond to operations as follows:
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
Condition Line (aka ConL)
The IEs RBs, CbBs, and Mns are conditions that determine how code is organized in the CB GUI depending on the User selection. Conditions are all true or false. A ConL is gray with CLC Items being red in text. Only two comparisons can be made, == indicating that the selection by the User in the CB GUI is equal to the condition in the ConL or =! indicating that the selection by the User in the CB GUI is not equal to the condition in the ConL.
Comment Line (aka ComL)
Comments that will appear in the code generated by the User originate in Comment lines.
None Line (aka NonL)
To create a blank CodL for the purpose of visual organization in the CDS, use a NonL CodL. No effect will result on any code. NonLs are black with no text.
Variables are provided in four types in the CDS that will be slightly different by compatible microcontroller:
Bits: bit of an Address that are used only in a CodB
Address: locations of a byte or register that are used only in a CodB
Arrays: multiple Address or bytes that are used only in a CodB
Variable Links: locations of a Bit, Address, or Array from a Variable in the CB GUI wired into an Icon
Depending on the compatible microcontroller function, a register (or byte) may be used and only accepted and wiring a Variable that is a different type than in a VL that is a different type will be prevented. Dropdown menus exist for selecting the byte or bit of a register for use in that line of code if the user wants to use
a bit of byte
a byte of an array
a bit of a byte of an array
If the entire byte or bit of a Variable is to be used, then select ALL from the dropdown menu where appropriate.
CBLs do not wire into other CBLs. The microCGL™ strategy of developing code in the CDS is to place a series of CodLs until reaching a line that has code that performs the operation of a goto statement that will contain a Code Line Start Link (aka CLStL). The CLStL begins wiring into a CodB of another. A CodB can have multiple CLStLs wired into it. The ability to add microcontroller compatible conditions prior to a GOTO operation that may either be wired back into the same CodB in which the goto operation exists a following goto operation allows creating loops.
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.
Creating an icon
To create an icon for use in the CB GUI, left-click on the button left of the screen under the IDS. microCGL™ will place a border around the IEs and verify that all the CLStLs. The icon will be saved to the user's profile.
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:
A box will appear to prompt the user to:
enter a name for the graphical code that must be unique in the user's profile and
give the code a brief description
The MSB will appear and prompt the user to select which microcontroller or board to develop compatible code for in order to populate a list of code options and properties compatible with the microcontroller. Once a selection is confirmed, it can't be undone without restarting.
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.
Start Icon (aka SI)
The point at which the icon-based code begins is the SI. There can be only one SI in code.
End Icon (aka EI)
To end in an infinite loop, the EI is provided. Multiple EIs can be used in the CB GUI. EIs are named “End icon” followed by a number that indicates which order it was added into the CB GUI beginning with zero.
Routine Icon (aka RI)
Multiple Icons can be wired into a RI to perform the operation of a goto statement. Although multiple Wires can end in a RI, only one Wire start at a RI. Multiple RIs can be used in the CB GUI. RIs are named “Routine icon” followed by a number that indicates which order it was added into the CB GUI beginning with zero.
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.
Bit Icon (aka BI)
BIs serve the purpose of being a Boolean value.
Register Icon (aka RegI)
RegIs are available to access one register (or byte).
Array Icon (aka AI)
AIs are available to access one register (or byte) in a series of registers (or bytes). The individual byte (or register) is determined according to the icon IB.
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:
A Wire can only begin at on StL of an Icon and end at the EnL of another Icon.
StLs of any IL cannot wire into other StLs of any IL.
EnLs cannot begin a wire.
A Wire cannot wire an Icon into itself.
ILs cannot wire into VLs.
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:
18F452 → 18F45K20
Icons that are created in the IB GUI have routine and variable names generated into assembly code as follows:
Routine names: program name + _ + icon name
Variable names: program name + _ + icon name (if applicable) + _ + variable name
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 microcgl.com 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
; ********** VARIABLES **********
; Reset vector
; ********** VECTORS **********
; High priority interrupt
; Low priority interrupt
; 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
MSB: Microcontroller Selection Box
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.