C Program Micro
C Program Micro
html
output_low(pin_C1);
output_high(pin_C1);
}
This program has many common features of C programs. The first line is a comment that
is ignored by the compiler. It is simply there to document what the program code does.
A comment is anything that occurs between a "/*" and the subsequent "*/". The next line
is a "directive". All directives begin with a "#" and are used to convey information to the
compiler. The directive in this program tells the compiler to include a header file
("16F873.h") which is necessary when using the microcontroller’s input and output
capabilities. The next two directives tell it how to configure the device, and how fast it
goes. The next line tells the compiler that this is the "main" program, and that everything
between the opening brace, {, and the matching closing brace, , constitutes the main
program. The main program itself is only two lines. The first line (not a comment) is a
call to the "output_low" function, which sets output pin pin_C1 low, and a call to
output_high, which sets it high. . Note that after every program statement there is a semi-
colon. This is very important.