Jump to content
naim

Pic16f877 On Led Using Assembler

Recommended Posts

LIST P=16F877

#INCLUDE"P16F877A.INC"

 

__CONFIG 0X3F32

 

 

ORG 0X200

 

INIT BSF STATUS,RP0

MOVLW 0x00

MOVWF TRISA

MOVLW 0x00

MOVWF TRISB

MOVLW 0x00

MOVWF PORTC

MOVLW B'11111000'

MOVWF TRISD

MOVLW 0x00

MOVWF TRISE

MOVLW 0x01

MOVWF ADCON1

 

BCF STATUS,RP0

BCF STATUS,RP1

MOVLW 0xFF

MOVWF PORTA

MOVLW 0x00

MOVWF PORTB

MOVLW 0x0F

MOVWF PORTC

MOVLW B'00000111'

MOVWF PORTD

MOVLW 0xFF

MOVWF PORTE

 

 

GOTO ON

ON

BTFSS PORTA,0

GOTO LED0

BTFSS PORTA,1

GOTO LED1

BTFSS PORTA,2

GOTO LED2

BTFSS PORTA,3

GOTO LED3

BTFSS PORTA,4

GOTO LED4

BTFSS PORTA,5

GOTO LED5

BTFSS PORTE,0

GOTO LED6

BTFSS PORTE,1

GOTO LED7

BTFSS PORTE,2

GOTO LED8

BTFSS PORTC,0

GOTO LED9

BTFSS PORTC,1

GOTO LED10

BTFSS PORTC,2

GOTO LED11

BTFSS PORTC,3

GOTO LED12

BTFSS PORTD,0

GOTO LED13

BTFSS PORTD,1

GOTO LED14

BTFSS PORTD,2

GOTO LED15

GOTO INIT

 

LED0 BSF PORTB,7

BTFSS PORTA,0

GOTO LED0

BCF PORTB,7

RETFIE

LED1 BSF PORTB,6

BTFSS PORTA,1

GOTO LED1

BCF PORTB,6

RETFIE

LED2 BSF PORTB,5

BTFSS PORTA,2

GOTO LED2

BCF PORTB,5

RETFIE

LED3 BSF PORTB,4

BTFSS PORTA,3

GOTO LED3

BCF PORTB,4

RETFIE

LED4 BSF PORTB,3

BTFSS PORTA,4

GOTO LED4

BCF PORTB,3

RETFIE

LED5 BSF PORTB,2

BTFSS PORTA,5

GOTO LED5

BCF PORTB,2

RETFIE

LED6 BSF PORTB,1

BTFSS PORTE,0

GOTO LED6

BCF PORTB,1

RETFIE

LED7 BSF PORTB,0

BTFSS PORTE,1

GOTO LED7

BCF PORTB,0

RETFIE

LED8 BSF PORTD,7

BTFSS PORTE,2

GOTO LED8

BCF PORTD,7

RETFIE

LED9 BSF PORTD,6

BTFSS PORTC,0

GOTO LED9

BCF PORTD,6

RETFIE

LED10 BSF PORTD,5

BTFSS PORTC,1

GOTO LED10

BCF PORTD,5

RETFIE

LED11 BSF PORTD,4

BTFSS PORTC,2

GOTO LED11

BCF PORTD,4

RETFIE

LED12 BSF PORTC,7

BTFSS PORTC,3

GOTO LED12

BCF PORTC,7

RETFIE

LED13 BSF PORTC,6

BTFSS PORTD,0

GOTO LED13

BCF PORTC,6

RETFIE

LED14 BSF PORTC,5

BTFSS PORTD,1

GOTO LED14

BCF PORTC,5

RETFIE

LED15 BSF PORTC,4

BTFSS PORTD,2

GOTO LED15

BCF PORTC,4

RETFIE

 

END

Share this post


Link to post
Share on other sites

You might get an answer sooner if you provide some information on what is not working as you would expect. Just a post of some code is not a question.

Share this post


Link to post
Share on other sites

Hii jartim

 

Why are you commenting a post from 2010.

That guy "naim" has probably gone for long, the post above is his first and only since 2010.

 

 

Best regards

Jorge

 

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×