kennethgalea 0 Newbie Poster

I'm very new to pic programming. I have a program which uses assembly language on a PIC16F84A microcontroller. This program does a simple approximation ADC. I know what it should do as a program but assembly is a new language for me!!!! Are there VERY GOOD tutorials and manuals on this microcontroller's instruction sets.....such as simple programs using this type of microcontroller?? I found its datasheet but it's still difficult for me to learn the instructions without seeing any basic programming with step by step comments!!! Please give me links 10q!!! Down here is my HUGE program lol :) if somebody is intrested to give some comments it's greatly appreciated.

processor 16F84A
    #include <P16F84A.INC>
    __config _CP_OFF & _PWRTE_ON & _WDT_OFF & _HS_OSC ; 0x3FF2

; RAM-Variable
LRAM_0x10 equ 0x10
LRAM_0x11 equ 0x11
LRAM_0x12 equ 0x12
LRAM_0x13 equ 0x13
LRAM_0x14 equ 0x14
LRAM_0x15 equ 0x15
LRAM_0x16 equ 0x16
LRAM_0x17 equ 0x17
LRAM_0x18 equ 0x18

; Program

    Org 0x0000

;   Reset-Vector
    GOTO LADR_0x0005

    Org 0x0004

;   Interrupt-Vector
    GOTO LADR_0x0005
LADR_0x0005
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    CLRF PORTB           ; !!Bank!! PORTB - TRISB
    CLRF PORTA           ; !!Bank!! PORTA - TRISA
    CLRF INTCON
    BSF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    CLRF PORTB           ; !!Bank!! PORTB - TRISB
    MOVLW 0x15
    MOVWF PORTA          ; !!Bank!! PORTA - TRISA
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BSF PORTA,1          ; !!Bank!! PORTA - TRISA
    BCF PORTA,3          ; !!Bank!! PORTA - TRISA
    MOVLW 0x01
    MOVWF LRAM_0x18
LADR_0x0012
    BTFSC PORTA,0        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x0012
    CALL LADR_0x0031
    BTFSC PORTA,0        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x0012
    CALL LADR_0x0039
    CALL LADR_0x003F
    MOVLW 0x43
    XORWF LRAM_0x11,W
    BTFSS STATUS,Z
    GOTO LADR_0x0012
LADR_0x001D
    BTFSC PORTA,0        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x001D
    CALL LADR_0x0031
    BTFSC PORTA,0        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x001D
    CALL LADR_0x0039
    CALL LADR_0x003F
    CALL LADR_0x004E
    MOVLW 0x40
    MOVWF LRAM_0x14
LADR_0x0027
    MOVLW 0x80
    MOVWF LRAM_0x15
LADR_0x0029
    CALL LADR_0x0062
    CALL LADR_0x008F
    CALL LADR_0x00C9
    DECFSZ LRAM_0x15,F
    GOTO LADR_0x0029
    DECFSZ LRAM_0x14,F
    GOTO LADR_0x0027
    GOTO LADR_0x0012
LADR_0x0031
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    RETURN
LADR_0x0039
    MOVLW 0x04
    MOVWF LRAM_0x13
LADR_0x003B
    DECFSZ LRAM_0x13,F
    GOTO LADR_0x003B
    NOP
    RETURN
LADR_0x003F
    CLRW
    CLRF LRAM_0x11
    CLRF STATUS
    MOVLW 0x08
    MOVWF LRAM_0x12
LADR_0x0044
    BTFSS PORTA,0        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x0048
    BSF STATUS,C
    GOTO LADR_0x0049
LADR_0x0048
    BCF STATUS,C
LADR_0x0049
    RRF LRAM_0x11,F
    CALL LADR_0x0039
    DECFSZ LRAM_0x12,F
    GOTO LADR_0x0044
    RETURN
LADR_0x004E
    MOVLW 0x31
    XORWF LRAM_0x11,W
    BTFSS STATUS,Z
    GOTO LADR_0x0055
    MOVLW 0x01
    MOVWF LRAM_0x18
    RETURN
LADR_0x0055
    MOVLW 0x32
    XORWF LRAM_0x11,W
    BTFSS STATUS,Z
    GOTO LADR_0x005B
    CLRF LRAM_0x18
    RETURN
LADR_0x005B
    MOVLW 0x35
    XORWF LRAM_0x11,W
    BTFSS STATUS,Z
    GOTO LADR_0x0061
    MOVLW 0x03
    MOVWF LRAM_0x18
LADR_0x0061
    RETURN
LADR_0x0062
    CLRF PORTB           ; !!Bank!! PORTB - TRISB
    BSF PORTB,7          ; !!Bank!! PORTB - TRISB
    NOP
    BTFSS PORTA,4        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x0068
    BCF PORTB,7          ; !!Bank!! PORTB - TRISB
LADR_0x0068
    BSF PORTB,6          ; !!Bank!! PORTB - TRISB
    NOP
    BTFSS PORTA,4        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x006D
    BCF PORTB,6          ; !!Bank!! PORTB - TRISB
LADR_0x006D
    BSF PORTB,5          ; !!Bank!! PORTB - TRISB
    NOP
    BTFSS PORTA,4        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x0072
    BCF PORTB,5          ; !!Bank!! PORTB - TRISB
LADR_0x0072
    BSF PORTB,4          ; !!Bank!! PORTB - TRISB
    NOP
    BTFSS PORTA,4        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x0077
    BCF PORTB,4          ; !!Bank!! PORTB - TRISB
LADR_0x0077
    BSF PORTB,3          ; !!Bank!! PORTB - TRISB
    NOP
    BTFSS PORTA,4        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x007C
    BCF PORTB,3          ; !!Bank!! PORTB - TRISB
LADR_0x007C
    BSF PORTB,2          ; !!Bank!! PORTB - TRISB
    NOP
    BTFSS PORTA,4        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x0081
    BCF PORTB,2          ; !!Bank!! PORTB - TRISB
LADR_0x0081
    BSF PORTB,1          ; !!Bank!! PORTB - TRISB
    NOP
    BTFSS PORTA,4        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x0086
    BCF PORTB,1          ; !!Bank!! PORTB - TRISB
LADR_0x0086
    BSF PORTB,0          ; !!Bank!! PORTB - TRISB
    NOP
    BTFSS PORTA,4        ; !!Bank!! PORTA - TRISA
    GOTO LADR_0x008B
    BCF PORTB,0          ; !!Bank!! PORTB - TRISB
LADR_0x008B
    MOVF PORTB,W         ; !!Bank!! PORTB - TRISB
    MOVWF LRAM_0x10
    CLRF PORTB           ; !!Bank!! PORTB - TRISB
    RETURN
LADR_0x008F
    CALL LADR_0x00C3
    NOP
    BTFSS LRAM_0x10,0
    GOTO LADR_0x0095
    CALL LADR_0x00C6
    GOTO LADR_0x0097
LADR_0x0095
    CALL LADR_0x00C3
    NOP
LADR_0x0097
    BTFSS LRAM_0x10,1
    GOTO LADR_0x009B
    CALL LADR_0x00C6
    GOTO LADR_0x009D
LADR_0x009B
    CALL LADR_0x00C3
    NOP
LADR_0x009D
    BTFSS LRAM_0x10,2
    GOTO LADR_0x00A1
    CALL LADR_0x00C6
    GOTO LADR_0x00A3
LADR_0x00A1
    CALL LADR_0x00C3
    NOP
LADR_0x00A3
    BTFSS LRAM_0x10,3
    GOTO LADR_0x00A7
    CALL LADR_0x00C6
    GOTO LADR_0x00A9
LADR_0x00A7
    CALL LADR_0x00C3
    NOP
LADR_0x00A9
    BTFSS LRAM_0x10,4
    GOTO LADR_0x00AD
    CALL LADR_0x00C6
    GOTO LADR_0x00AF
LADR_0x00AD
    CALL LADR_0x00C3
    NOP
LADR_0x00AF
    BTFSS LRAM_0x10,5
    GOTO LADR_0x00B3
    CALL LADR_0x00C6
    GOTO LADR_0x00B5
LADR_0x00B3
    CALL LADR_0x00C3
    NOP
LADR_0x00B5
    BTFSS LRAM_0x10,6
    GOTO LADR_0x00B9
    CALL LADR_0x00C6
    GOTO LADR_0x00BB
LADR_0x00B9
    CALL LADR_0x00C3
    NOP
LADR_0x00BB
    BTFSS LRAM_0x10,7
    GOTO LADR_0x00BF
    CALL LADR_0x00C6
    GOTO LADR_0x00C1
LADR_0x00BF
    CALL LADR_0x00C3
    NOP
LADR_0x00C1
    CALL LADR_0x00C6
    RETURN
LADR_0x00C3
    BCF PORTA,1          ; !!Bank!! PORTA - TRISA
    CALL LADR_0x0039
    RETURN
LADR_0x00C6
    BSF PORTA,1          ; !!Bank!! PORTA - TRISA
    CALL LADR_0x0039
    RETURN
LADR_0x00C9
    MOVLW 0x3A
    MOVWF LRAM_0x16
LADR_0x00CB
    DECFSZ LRAM_0x16,F
    GOTO LADR_0x00CB
    NOP
    MOVF LRAM_0x18,F
    BTFSC STATUS,Z
    RETURN
    MOVLW 0x01
    XORWF LRAM_0x18,W
    BTFSS STATUS,Z
    GOTO LADR_0x00D7
    MOVLW 0x01
    GOTO LADR_0x00D8
LADR_0x00D7
    MOVLW 0x04
LADR_0x00D8
    NOP
    MOVWF LRAM_0x17
    GOTO LADR_0x00DD
LADR_0x00DB
    MOVLW 0x6D
    GOTO LADR_0x00DE
LADR_0x00DD
    MOVLW 0xA1
LADR_0x00DE
    NOP
    NOP
    NOP
    MOVWF LRAM_0x16
LADR_0x00E2
    DECFSZ LRAM_0x16,F
    GOTO LADR_0x00E2
    DECFSZ LRAM_0x17,F
    GOTO LADR_0x00DB
    RETURN

    End
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.