.


:




:

































 

 

 

 





20 , 0,05 . , 0,2 . 1.

2 , .. 4 . 255 ( , 8- ). 255- 0. DECF , .. . :

255*4*0,2 + 2 *0,2=204,4

, .. 4 + :

4*0,2 + 204,4 = 205,2

, , , .

3 ˻ Assembler PIC16F877A

: , :

- 0,1 ;

- 3- PORTC;

- 2-

PORTD;

- , -

200 Timer1.

. , .

N = 100000/205,2=487

255. :

255*205 = 52275

 

:

100000/52275 = 2

. -, 1,14 . :

1140/ 52=22

 

1

include "p16f877A.inc"

Sch_in EQU H'22'; .

Sch_out equ H'23'; .

Sch3 equ H'24'; .

org h'00'

nop

nop

nop

org h'05'

Nach

clrf STATUS

clrf PORTC;

bsf STATUS,5

movlw B'00001111'

movwf TRISB; 0-3 PORTB

clrf TRISC; PORTC

clrf TRISD; PORTD

bcf STATUS,5

WaitPush

btfss PORTB,0; 1 RB0-

;

goto WaitPush

call Timer2;

bsf PORTC,3;

;

call Timer1; ,

goto Nach

goto $

Timer1

movlw D'200'; 2

movwf Sch_in; .

N_in

decf Sch_in,F; Sch_in 1.

btfss STATUS,Z; Sch_in , GOTO.

goto N_in; Z=0

return

Timer2

MOVLW d'2';

MOVWF Sch3; W .

N3

MOVLW D'255'; D'2'

MOVWF Sch_out; .

N_out; .

MOVLW D'255'; D'2'

MOVWF Sch_in; .

N_in; .

DECF Sch_in,F; Sch_in 1.

BTFSS STATUS,Z; Sch_in , GOTO.

GOTO N_in; Z=0.

DECF Sch_out,F; Sch_out 1.

BTFSS STATUS,Z; , GOTO.

GOTO N_out; Z=0.

DECF Sch3,F; Sch3 1,

BTFSS STATUS,Z; (Z=1), GOTO.

GOTO N3; Z=0.

RETURN; Timer2.

End

2 -7.

2 -7 1

3 4 PrtSc .

3 0 PORTC

4 0 PORTC ,





:


: 2017-01-28; !; : 454 |


:

:

, .
==> ...

1715 - | 1583 -


© 2015-2024 lektsii.org - -

: 0.008 .