Browsing Archive: July, 2014

Countdown program using assembly language for pic

Posted by Jed Melendres on Saturday, July 26, 2014,
; this program is countdown timer using
; assembly language for pic microcontroller
; upon setting the chosen number
; it will count down automatically 

; portB3 for tens switch
; portB2 for ones switch
; portB1 for reset switch
; portB0 for start/pause switch
; portC for the 7 segment display of tens
; portD for the 7 segment display of ones
; pic16f877a

bsf status,5
movlw 1111b
movwf trisb
clrf trisc
clrf trisd
bcf status,5

movlw 0x32
movwf 0x31

again btfsc portb,0
goto again

reset movlw 9
movwf 0x20
...

Continue reading ...
 

USING RRF AND RLF

Posted by Jed Melendres on Thursday, July 3, 2014,
; using RLF and RRF
; RRF = rotate bit to the right
; RLF = rotate bit to the left
; simulate using picsimulator ide 8xLED board
; mcu = pic16f84a

; this is a running lights

; set up pins
    bsf status,5
    movlw 0x00
    movwf trisa
    bcf status,5

    movlw 0x32
    movwf 0x21    ; store decimal value 50 to 0x21

;main program
main    movlw 0x01
    movwf porta
    call delay

    rlf porta,1    ; 1 is the destination register (porta)
                     ; for the result of operation
    call delay

    rlf ...
Continue reading ...
 

USING BTFSS AND BTFSC

Posted by Jed Melendres on Tuesday, July 1, 2014,

; program using BTFSS and BTFSC

; BTFSS = Check status of the specified bit number,

                ;skip one (1) instruction if set as high (on state)

; BTFSC = Check status of the specified bit number,

                ;skip one (1) instruction if set as low (off state)

; mcu = pic16f84A

; simulate using picsimulatoride

 

; Set up the pins of the microcontroller

BSF STATUS,5          ; bit set on pin 5 of status register

                                            ; from bank0 to bank1...


Continue reading ...
 

Sample Assembly Programming

Posted by Jed Melendres on Tuesday, July 1, 2014,

;  - Sample programs using assembly language in PIC -

; mcu = pic16f84A

; simulate using picsimulatoride

; Set up the pins of the microcontroller

        BSF STATUS,5      ; BIT SET ON PIN 5 OF STATUS REGISTER

                                    ; FROM BANK0 TO BANK1 ON REGISTER FILE MAP

        MOVLW 0X00        ; MOVE LITERAL VALUE 0000 0000

        MOVWF TRISA     ; SET ALL PORTA PINS AS OUTPUT

        BCF STATUS,5      ; BIT CLEAR ON PIN 5 OF STATUS REGISTER

                  ...


Continue reading ...
 
 

Blog Archive

 
Make a Free Website with Yola.