I
imisendo_4036
Guest
hello frenz ...
jeg rent faktisk gør dc motorens hastighed controller lige nu ... til at opretholde hastighed endda belastning forandring .... projekt fra internettet
men problemet er, når jeg køre projektet i simulator ..
resultatet ikke er som forventet ... alle LED er den ... ikke kan fastholde den hastighed
kan man foreslå, hvad skal jeg gøre .... plzzz
[/ img]Code:; PROGRAM TIL KONTROL DC MOTORDREVNE SPEED;***** ERKLÆRING *****PROCESSOR 16F873
# include "p16F873.INC"
__CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF
errorlevel -302;***** ERKLAERE ****hastighed EQU d'256 '
ændre EQU d'1 '
førte EQU h'20 ';**** Programstart *****org 0
goto vigtigste
org 4
goto int;***** Initialization PROCESS ******hoved -;***** PORT ****
BSF 03h, 5
movlw b'00000001 '
movwf 85h; sæt havn Lidt 0 som input (AN0)
clrf 86h; havn b som output
clrf 87h; havn c som output
BCF 03h, 5;**** A / D CONVERTER *****movlw b'10000001 '
movwf 1Fh; adcon0
BSF 03h, 5
movlw b'00001110 '
movwf 9Fh; adcon1
BCF 03h, 5;***** PWM *****clrf 11h; tmr2
movlw d'127 '
movwf 15h; ccpr1L
BSF 03h, 5
movlw d'255 '
movwf 92h; pr2
BCF 03h, 5
movlw b'00000110 '
movwf 12h; t2con
movlw b'00001100 '
movwf 17h; ccp1con;***** SAMMENLIGNE MODE *****clrf 0Fh; tmr1h
clrf 0Eh; tmr1L
movlw h'61 '
movwf 1Ch; ccpr2h
movlw h'A8 '
movwf 1Bh; ccpr2L
movlw b'00000001 '
movwf 10h; t1con
movlw b'00001011 '
movwf 1DH; ccp2con;**** AFBRYDELSE CONTROL ******BSF 03h, 5
movlw b'00000001 '; ccp2ie muliggøre
movwf 8Dh; pie2
BCF 03h, 5
movlw b'11000000 '; GIE på & peie på
movwf 0Bh; intconvente
goto $;***** AFBRYDELSE PROCESS *****int
clrf 0Dh; pir2kontrollerebtfsc 1Fh, 2; cek A / D handlingsplanen x?
goto check
movlw 1Eh; adresh, A / D resultat høje register
sublw hastighed
btfsc 03h, 0; bit test, springe næste instruktion, hvis klar
goto check1;**** LOW SPEED *****
movlw 15h; ccpr1L
addlw ændre
btfss 03h, 0
movwf 15h; ccpr1L
goto led_contcheck1
btfsc 03h, 2
goto led_cont;**** FAST HASTIGHED ******
movlw ændre
SUBWF 15h, 1; ccpr1L-1
btfsc 03h, 0
goto led_cont
clrf 15h;****** LED CONTROL ******led_contcomf 15h, 0
movwf ført
movlw b'00010000
SUBWF medført, 0
btfsc 03h, 0
goto led1
movlw b'00000000 '
movwf 06h
goto int_endled1
movlw b'00100000 '
SUBWF medført, 0
btfsc 03h, 0
goto led2
movlw b'00000001 '
movwf 06h
goto int_endled2
movlw b'01000000 '
SUBWF medført, 0
btfsc 03h, 0
goto led3
movlw b'00000011 '
movwf 06h
goto int_endled3
movlw b'01100000 '
SUBWF medført, 0
btfsc 03h, 0
goto led4
movlw b'00000111 '
movwf 06h
goto int_endled4
movlw b'10000000 '
SUBWF medført, 0
btfsc 03h, 0
goto led5
movlw b'00001111 '
movwf 06h
goto int_endled5
movlw b'10100000 '
SUBWF medført, 0
btfsc 03h, 0
goto led6
movlw b'00011111 '
movwf 06h
goto int_endled6
movlw b'11000000 '
SUBWF medført, 0
btfsc 03h, 0
goto led7
movlw b'00111111 '
movwf 06h
goto int_endled7
movlw b'11100000 '
SUBWF medført, 0
btfsc 03h, 0
goto led8
movlw b'01111111 '
movwf 06h
goto int_endled8
movlw b'11111111 '
movwf 06h
;****** SLUT AFBRYDELSE ******
int_endretfie;********** SLUT DC MOTOTR SPEED ANSVAR *******SLUTende
jeg rent faktisk gør dc motorens hastighed controller lige nu ... til at opretholde hastighed endda belastning forandring .... projekt fra internettet
men problemet er, når jeg køre projektet i simulator ..
resultatet ikke er som forventet ... alle LED er den ... ikke kan fastholde den hastighed
kan man foreslå, hvad skal jeg gøre .... plzzz
[/ img]Code:; PROGRAM TIL KONTROL DC MOTORDREVNE SPEED;***** ERKLÆRING *****PROCESSOR 16F873
# include "p16F873.INC"
__CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF
errorlevel -302;***** ERKLAERE ****hastighed EQU d'256 '
ændre EQU d'1 '
førte EQU h'20 ';**** Programstart *****org 0
goto vigtigste
org 4
goto int;***** Initialization PROCESS ******hoved -;***** PORT ****
BSF 03h, 5
movlw b'00000001 '
movwf 85h; sæt havn Lidt 0 som input (AN0)
clrf 86h; havn b som output
clrf 87h; havn c som output
BCF 03h, 5;**** A / D CONVERTER *****movlw b'10000001 '
movwf 1Fh; adcon0
BSF 03h, 5
movlw b'00001110 '
movwf 9Fh; adcon1
BCF 03h, 5;***** PWM *****clrf 11h; tmr2
movlw d'127 '
movwf 15h; ccpr1L
BSF 03h, 5
movlw d'255 '
movwf 92h; pr2
BCF 03h, 5
movlw b'00000110 '
movwf 12h; t2con
movlw b'00001100 '
movwf 17h; ccp1con;***** SAMMENLIGNE MODE *****clrf 0Fh; tmr1h
clrf 0Eh; tmr1L
movlw h'61 '
movwf 1Ch; ccpr2h
movlw h'A8 '
movwf 1Bh; ccpr2L
movlw b'00000001 '
movwf 10h; t1con
movlw b'00001011 '
movwf 1DH; ccp2con;**** AFBRYDELSE CONTROL ******BSF 03h, 5
movlw b'00000001 '; ccp2ie muliggøre
movwf 8Dh; pie2
BCF 03h, 5
movlw b'11000000 '; GIE på & peie på
movwf 0Bh; intconvente
goto $;***** AFBRYDELSE PROCESS *****int
clrf 0Dh; pir2kontrollerebtfsc 1Fh, 2; cek A / D handlingsplanen x?
goto check
movlw 1Eh; adresh, A / D resultat høje register
sublw hastighed
btfsc 03h, 0; bit test, springe næste instruktion, hvis klar
goto check1;**** LOW SPEED *****
movlw 15h; ccpr1L
addlw ændre
btfss 03h, 0
movwf 15h; ccpr1L
goto led_contcheck1
btfsc 03h, 2
goto led_cont;**** FAST HASTIGHED ******
movlw ændre
SUBWF 15h, 1; ccpr1L-1
btfsc 03h, 0
goto led_cont
clrf 15h;****** LED CONTROL ******led_contcomf 15h, 0
movwf ført
movlw b'00010000
SUBWF medført, 0
btfsc 03h, 0
goto led1
movlw b'00000000 '
movwf 06h
goto int_endled1
movlw b'00100000 '
SUBWF medført, 0
btfsc 03h, 0
goto led2
movlw b'00000001 '
movwf 06h
goto int_endled2
movlw b'01000000 '
SUBWF medført, 0
btfsc 03h, 0
goto led3
movlw b'00000011 '
movwf 06h
goto int_endled3
movlw b'01100000 '
SUBWF medført, 0
btfsc 03h, 0
goto led4
movlw b'00000111 '
movwf 06h
goto int_endled4
movlw b'10000000 '
SUBWF medført, 0
btfsc 03h, 0
goto led5
movlw b'00001111 '
movwf 06h
goto int_endled5
movlw b'10100000 '
SUBWF medført, 0
btfsc 03h, 0
goto led6
movlw b'00011111 '
movwf 06h
goto int_endled6
movlw b'11000000 '
SUBWF medført, 0
btfsc 03h, 0
goto led7
movlw b'00111111 '
movwf 06h
goto int_endled7
movlw b'11100000 '
SUBWF medført, 0
btfsc 03h, 0
goto led8
movlw b'01111111 '
movwf 06h
goto int_endled8
movlw b'11111111 '
movwf 06h
;****** SLUT AFBRYDELSE ******
int_endretfie;********** SLUT DC MOTOTR SPEED ANSVAR *******SLUTende