TP N1 Malak
TP N1 Malak
GI_1
In our first TP we used the "mikroC PRO" as a compiler , it started with establishing a new
project at the interface of the mikroC PRO than we had typed and compiled all the codes one by
one(each one has been treated apart),all was written by C .
void main(){
trisb = 0b11110000;
while(1)
{ portb = 0b00001111;}
}
︎"trisb = Ob11110000;" sets the direction of the pins of port b of the microcontroller as
inputs or outputs. In this case, the four most significant bits of port B are set as inputs (1) and the
four least significant bits are set as outputs (0).
︎"portb = 0b00001111;" sets the value of the four least significant bits of port b as high (1)
and the four most significant bits as low (0). This will turn on the intput pins of port b while
keeping the output pins at a low state.
The third code:
void main() {
trisb= 0b11110000;
while(1){
portb = 0b11110000;
delay_ms(200);
portb.f0=1;
delay_ms(200);
portb.f0=0;
porth.f1=1;
delay ms(200);
portb.f1=0;
portb.f2=1;
delay_ms(200);
portb.f2=0;
porth.f3=1;
delay_ms(200);}
}
The second code start whith adding 4 other LEDs "trisb= 0b00000000;"where the lit LED
moving from top to bottom.
The Last one is a program with a chaser from top to bottom and simultaneously from bottom to
the top .
The simulation
After the coding section we passed to the simulation part using the software ISIS PROTEUS
,where we have created a new project and establish a test circuit .
The test circuit contains one microcontroller to test it ,diode to show off the output ,a resistance
which allows to a certain electric current intensity passing through the diode, a crystal which is
an electrical components are commonly used in electronic devices to provide a stable reference
frequency for timing and synchronization.