poceo uciti assembler, i napredovao sam, ali i dalje imam pocetnickih problema
Pravim program koji ce citati broj ulaza (pritiska na dugme) na RB0 i prikazivati izlaze na RB7,6,5 i 4
Htio sam kad se npr 100 puta pritisne da se upali RB7, pa nakon 500 RB6, 1000 RB5, 2000 RB4 i nakon 3000 da se sve ugase i ponovo.
E sada, nasao sam prog, ali pisan za 16c84, a u mene 16f628, kazem ja sebi, nema problema, prebacit cu ga ja, ali

LIST p=16f628
#include c:\mplab\p16f628.inc
__CONFIG 11H
CONSTANT BASE_VAR=0CH ; pocetna adresa registara opce namjene
COUNTER EQU BASE_VAR+0 ;zasto +0???
ORG 000H
GOTO MAIN
ORG 004H
GOTO INT_SERV
MAIN:
BCF STATUS, RP1 ;
BSF STATUS, RP0 ; bank 1
MOVLW 1
MOVWF TRISB ;ovdje mi javlja gresku da to nije u bank 0??? a prebacih ga u bank1, jos sam i dodao ovaj RP1=0 da budem siguran
BCF STATUS, RP0 ; back to bank 0
CLRF COUNTER ; zero the counter
BCF PORTB, 4 ; zero the LEDs
BCF PORTB, 5
BCF PORTB, 6
BCF PORTB, 7
BSF STATUS, RP0 ; bank 1
BSF OPTION_REG, INTEDG ; interrupt on positive, i ovdje javlja gresku da u bank 0 nema takvog
BCF STATUS, RP0 ; back to bank 0
BCF INTCON, INTF ; clear interrupt flag
BSF INTCON, INTE ; mask for external interrupts
BSF INTCON, GIE ; enable interrupts
PT1: SLEEP
GOTO PT1
INT_SERV:
INCF COUNTER, F ; inkrementira counter, zasto je F ovdje? kakva razlika da nije samo 1
BTFSS COUNTER, 0 ; e ovdje bi mi trebala procedura za brojanje 100, 500, 1000, 2000, 3000... ali nisam siguran kako
BCF PORTB, 4
BTFSC COUNTER, 0
BSF PORTB, 4
BTFSS COUNTER, 1
BCF PORTB, 5
BTFSC COUNTER, 1
BSF PORTB, 5
BTFSS COUNTER, 2
BCF PORTB, 6
BTFSC COUNTER, 2
BSF PORTB, 6
BTFSS COUNTER, 3
BCF PORTB, 7
BTFSC COUNTER, 3
BSF PORTB, 7
BCF INTCON, INTF ; clear the appropriate flag
RETFIE ; this also set global interrupt enable
END
E ako neko ima vremena ovo malo pogledati. Trax, Buco, Sinner i ostali strucnjaci pa da me malo uputi. U komentarima su problemi...