.


:




:

































 

 

 

 


mikroC PIC-: , , .




 

 

(), PIC16F877 , () RC0 C. ( Proteus) , 1. ( 1) RC0 , ( 0) RC0 .

, 0,5 , 1 .

/****************************************************************

led.c

****************************************************************/

void main()

{

TRISC = 0; //

PORTC = 0; //

while(1) //

{

PORTC.B0 = 1; // D1

Delay_ms(500); // 500

PORTC.B0 = 0; // D1

Delay_ms(500); // 500

}

}

 

 

1 -

 

 

 

, t t:

t = t = T / 2,

, ƒ = 1 / .

. .

, , RC1 C 10 ( 100 ). ( Proteus) 2.

mikroC .

 

/**************************************************************

meandr.c 10

**************************************************************/

void main()

{

TRISC = 0;

while(1)

{

PORTC.B1 = 1;

Delay_ms(50);

PORTC.B1 = 0;

Delay_ms(50);

}

}

 

 

2

 

 

 

, mikroC (). 3 ( Proteus), D1 () SB1 . SB1 , D1 , SB1 , D1 . D1 SB1. , SB1 .

, while().

/****************************************************************

led_but_1.c

****************************************************************/

void main()

{

TRISB = 0xFF; //

TRISC = 0; //

PORTC = 0; //

while(1) //

{

while(PORTB.B1 == 1); // SB1

PORTC.B0 = 1; //

while(PORTB.B1 == 0); // SB1

PORTC.B0 = 0; //

}

}

 

 

3

 

 

, SB1 if else.

/*************************************************************

led_but_2.c -

************************************************************* */

void main()

{

TRISB = 0xFF; //

TRISC = 0; //

PORTC = 0; //

while(1) //

{

if(PORTB.B1 ==0) // SB1 ,

PORTC.B0 = 1; //

else //

PORTC.B0 = 0; //

}

}

 





:


: 2017-02-25; !; : 1580 |


:

:

.
==> ...

1705 - | 1493 -


© 2015-2024 lektsii.org - -

: 0.009 .