Table of Contents
Microbe compiles programs written in the custom language for PICs, as a companion program to KTechlab. The syntax has been designed to suit a FlowCode program. The syntax for running microbe from the command line is:
microbe [options] [input.microbe] [output.asm]
where options are:
--show-source
- Puts each line of Microbe source code as a comment in the assembly output before the assembly instructions themselves for that line.--no-optimize
- Prevent optimization of the instructions generated from the source. Optimization is usually safe, and so this option is mainly used for debugging.
The .microbe input file must identify the target PIC by inserting the PIC name at the top of the .microbe file; e.g. the name of a PIC16F84 is "P16F84".
Example 5.1. Simple complete Microbe program
P16F84 a = 0 repeat { PORTA = a a = a + 1 } until a == 5 end
The following rules apply to variable names and labels:
They can only contain alphanumerical characters [a..z][A..Z][0..9] and the underscore "_".
They are case-sensitive.
They cannot start with a number.
They should not start with “__” (double underscore), as this is reserved for use by the compiler.
Curly braces, {}, indicate the start and end of a code block. They can appear anywhere before the start and after the end of the code block. Examples of acceptable code blocks:
statement1 { some code }
statement2 { other code }
statement3 { other code }
statement5 { code block } statement6
Commenting is similar to C. // comments out the rest of the line. /* and */ denote a multiline comment.
// This is a comment x = 2 /* As is this multiline comment */
The PIC id must be inserted at the top of the program. The end of the main program is denoted with “end”. Subroutines must placed after “end”.