Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Handmade Character Soft Toys
anil1961
Updated:
Tuesday at 2:11 PM
Bodim.lk out now !
Manoj Suranga Bandara
Updated:
Sunday at 3:05 AM
Power Lifting Lever Belt
SkullVamp
Updated:
Jun 13, 2026
Ad icon
port.lk Domain for sale
Lankan-Tech
Updated:
Jun 13, 2026
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Jun 11, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Counter PIC16F84
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="xshax" data-source="post: 13678755" data-attributes="member: 85885"><p>;*****Define Registers*****</p><p></p><p>PC equ 02h</p><p>STATUS equ 03h</p><p>PORTA equ 05h</p><p>PORTB equ 06h</p><p>TRISA equ 85h</p><p>TRISB equ 86h</p><p>CounterL equ 0Dh</p><p>CounterH equ 0Eh</p><p>Digit1 equ 10h</p><p>Digit2 equ 11h</p><p></p><p>;*****initialization*****</p><p></p><p>bsf STATUS,5 ;Switch to Bank 1</p><p>movlw b’00111001'</p><p>movwf TRISA ;RA0 I/P RA1,2 O/P</p><p>clrf TRISB ;PORT B output</p><p>bcf STATUS,5 ;Switch to Bank 0</p><p>clrf Digit1 ;initilize to zero</p><p>clrf Digit2 ;initilize to zero</p><p>;**display the first digit**</p><p>Loop bcf PORTA,2 ;disable digit2</p><p>movf Digit1,0 ;get digit1 value</p><p>call Table ;Look Up Table</p><p>movwf PORTB ;Writ the number</p><p>bsf PORTA,1 ;enable digit1</p><p></p><p>;**small delay to display digit1**</p><p></p><p>Delay1 decfsz CounterL,1</p><p>goto Delay1</p><p></p><p>;**display the second digit**</p><p></p><p>bcf PORTA,1 ;disable digit1</p><p>movf Digit2,0 ;get digit2 value</p><p>call Table ;Look Up Table</p><p>movwf PORTB ;Writ the number</p><p>bsf PORTA,2 ;enable digit2</p><p></p><p>;**small delay to display digit2**</p><p></p><p>Delay2 decfsz CounterL,1</p><p>goto Delay2</p><p>btfss PORTA,0 ;Button pressed?</p><p>goto Countup ;If yes Count up</p><p>goto Loop ;else back to Loop</p><p></p><p>;**Update Digit1 and Digit2**</p><p></p><p>Countup incf Digit1,1 ;increase Digit1</p><p>movlw D’10' ;load w with ten</p><p>xorwf Digit1,0 ;compare with 10</p><p>btfss STATUS,2 ;if equal result 0</p><p>goto Loop ;else back to Loop</p><p>clrf Digit1 ;make Digit1 = 0</p><p>incf Digit2,1 ;increase Digit1</p><p>movlw D’10' ;load w with ten</p><p>xorwf Digit2,0 ;compare with 10</p><p>btfsc STATUS,2 ;if equal result 0</p><p>clrf Digit1 ;make Digit2 = 0</p><p>goto Loop ;back to Loop</p><p></p><p>;****Look Up Table for bit patterns****</p><p></p><p>Table addwf PC,1</p><p>retlw b’00111111' ;Number 0</p><p>retlw b’00000110' ;Number 1</p><p>retlw b’01011011' ;Number 2</p><p>retlw b’01001111' ;Number 3</p><p>retlw b’01100110' ;Number 4</p><p>retlw b’01101101' ;Number 5</p><p>retlw b’01111101' ;Number 6</p><p>retlw b’00000111' ;Number 7</p><p>retlw b’01111111' ;Number 8</p><p>retlw b’01100111' ;Number 9</p><p>end</p><p></p><p></p><p></p><p></p><p></p><p></p><p>vidusara eke giya counter eka hari kamam ne asm kara ganna widihak......?</p></blockquote><p></p>
[QUOTE="xshax, post: 13678755, member: 85885"] ;*****Define Registers***** PC equ 02h STATUS equ 03h PORTA equ 05h PORTB equ 06h TRISA equ 85h TRISB equ 86h CounterL equ 0Dh CounterH equ 0Eh Digit1 equ 10h Digit2 equ 11h ;*****initialization***** bsf STATUS,5 ;Switch to Bank 1 movlw b’00111001' movwf TRISA ;RA0 I/P RA1,2 O/P clrf TRISB ;PORT B output bcf STATUS,5 ;Switch to Bank 0 clrf Digit1 ;initilize to zero clrf Digit2 ;initilize to zero ;**display the first digit** Loop bcf PORTA,2 ;disable digit2 movf Digit1,0 ;get digit1 value call Table ;Look Up Table movwf PORTB ;Writ the number bsf PORTA,1 ;enable digit1 ;**small delay to display digit1** Delay1 decfsz CounterL,1 goto Delay1 ;**display the second digit** bcf PORTA,1 ;disable digit1 movf Digit2,0 ;get digit2 value call Table ;Look Up Table movwf PORTB ;Writ the number bsf PORTA,2 ;enable digit2 ;**small delay to display digit2** Delay2 decfsz CounterL,1 goto Delay2 btfss PORTA,0 ;Button pressed? goto Countup ;If yes Count up goto Loop ;else back to Loop ;**Update Digit1 and Digit2** Countup incf Digit1,1 ;increase Digit1 movlw D’10' ;load w with ten xorwf Digit1,0 ;compare with 10 btfss STATUS,2 ;if equal result 0 goto Loop ;else back to Loop clrf Digit1 ;make Digit1 = 0 incf Digit2,1 ;increase Digit1 movlw D’10' ;load w with ten xorwf Digit2,0 ;compare with 10 btfsc STATUS,2 ;if equal result 0 clrf Digit1 ;make Digit2 = 0 goto Loop ;back to Loop ;****Look Up Table for bit patterns**** Table addwf PC,1 retlw b’00111111' ;Number 0 retlw b’00000110' ;Number 1 retlw b’01011011' ;Number 2 retlw b’01001111' ;Number 3 retlw b’01100110' ;Number 4 retlw b’01101101' ;Number 5 retlw b’01111101' ;Number 6 retlw b’00000111' ;Number 7 retlw b’01111111' ;Number 8 retlw b’01100111' ;Number 9 end vidusara eke giya counter eka hari kamam ne asm kara ganna widihak......? [/QUOTE]
Insert quotes…
Verification
Hathara warak wissa keeyada? (Hathara wadi karanna 20)
Post reply
Top
Bottom