On 2010.04.19 19:27, tarzan wrote: > O gal gali patarti, kaip man aprasyti tuos input1 ir output1? programeleje matau tik Input2 :-) nei output1, nei output2 niekur nefiguruoja. nebent planuoji duomenis per tuos pacius B0 ir B1 ir ivedineti, ir ishvedineti. bet ir pagal logine schema neaisku, ka pagimdyti nori :-) AMB teisingai raso... o pataisyti gan paprasta: jei gerai supratau, viskas vyksta per PortB. B0 ir B1 panaudoti kaip inputai, tai ir B2 naudok kaip Input2. koda kiek pataisiau, kompiliuokis pats... Ar siek tiek pakeitus sita koda, galima butu panaudoti kitam cipui? taip, galima. ";-------------------------------------------------------------------------- ; MadLab PIC Basic Compiler (www.madlab.org) ; Assemble using Microchip MPLab (www.microchip.com) ;-------------------------------------------------------------------------- list p=16F627 errorlevel -305 ;-------------------------------------------------------------------------- ; registers/variables ;-------------------------------------------------------------------------- INDF equ h'00' ; 8u TMR0 equ h'01' ; 8u PCL equ h'02' ; 8u STATUS equ h'03' ; 8u FSR equ h'04' ; 8u PORTA equ h'05' ; 8u PORTB equ h'06' ; 8u PORTC equ h'07' ; 8u PCLATH equ h'0A' ; 8u INTCON equ h'0B' ; 8u OPTION equ h'81' ; 8u TRISA equ h'85' ; 8u TRISB equ h'86' ; 8u TRISC equ h'87' ; 8u b0 equ h'20' ; 8u b1 equ h'21' ; 8u b2 equ h'22' ; 8u _temp1 equ h'22' ; 8u org h'0000' ;-------------------------------------------------------------------------- ; stub code ;-------------------------------------------------------------------------- ;-------------------------------------------------------------------------- ; user code ;-------------------------------------------------------------------------- ; symbol x = b0 ; symbol z = b1 ; symbol Input2 = b2 ;*** Not a constant expression in line #3 *** main clrf b0 ; let x = 0 clrf b1 ; let z = 0 clrf b2 ; let Input2 = 0 label0 ; if b2 = 1 then label1 ;*** Syntax error in line #8 *** movfw b1 ; if z <> 1 then label2 sublw 1 movlw 0 skpz movlw 1 iorlw 0 skpz goto label2 goto label0 ; goto label0 label2 tstf b0 ; if x <> 0 then label3 movlw 0 skpz movlw 1 iorlw 0 skpz goto label3 label4 clrf b0 ; let x = 0 ; low 0 goto label0 ; goto label0 label3 movfw b0 ; if x <> 6 then label5 sublw 6 movlw 0 skpz movlw 1 iorlw 0 skpz goto label5 goto label4 ; goto label4 label5 movlw 1 ; let z = 1 movwf b1 goto label0 ; goto label0 label1 ; high 0 movfw b1 ; if z = 1 then label6 sublw 1 movlw 1 skpz movlw 0 iorlw 0 skpz goto label6 movfw b0 ; if x <= 5 then label7 sublw 5 movlw 1 skpc movlw 0 iorlw 0 skpz goto label7 goto label0 ; goto label0 label7 incf b0 ; let x = x + 1 goto label0 ; goto label0 label6 clrf b1 ; let z = 0 clrf b0 ; let x = 0 label8 ; if b2 = 1 then label8 ;*** Syntax error in line #27 *** goto label0 ; goto label0 goto label8 ; goto label8 goto _end_prog ;-------------------------------------------------------------------------- ; library routines ;-------------------------------------------------------------------------- _end_prog ;-------------------------------------------------------------------------- ; EEPROM data ;-------------------------------------------------------------------------- end