Start With MikroBasic
Start With MikroBasic
For example ask for byte, the help shows you the
different types a variable can be define.
A program is created from the "main" function, which may call other procedures or functions.
- a procedure is a sub routine which execute a part of the program
- a function is like a procedure, but it returns a result.
Many years ago, people directly programmed in machine code. I let you imagine the requested
time.
In the PIC, there is already a software called "boot loader" which test, after a reset, if a PC is
connected to download.
If the computer is present, the PIC waits to be programmed, else after 1.25 s, it begins the
program download before.
To define a variable you have to specify the type. You can define a local variable (in a function or
in a procedure) or a global variable which can be used in the entire program:
sub…
Simple Types:
Simple types represent types that cannot be divided into more basic elements, and are the model
for representing elementary data on machine level.
Here is an overview of simple types in mikroBasic:
Constants
Constant is data whose value cannot be changed during the runtime. Using a constant in a
program consumes no RAM memory. Constants can be used in any expression, but cannot be
assigned a new value.
Constants are declared in the declaration part of program or routine. Declare a constant like this:
const constant_name [as type] = value
The type is optional; in the absence of type, compiler assumes the “smallest” type that can
accommodate value.
if (condition) then
condition no
Action 1
yes End if
Action
if (condition) then
condition no
Action 1
yes else
Action Action Action 2
End if
condition no
while (condition)
yes Action
Action wend
do
Action
Action
no