caramoan tour package

caramoan tour package

Author Topic: dual 7-segment up counter using this circuit  (Read 1343 times)

Offline newo

  • CR2032 Battery
  • **
  • Posts: 49
  • Pogi/Ganda Points: 0
  • Gender: Male
dual 7-segment up counter using this circuit
« on: August 09, 2010, 11:41:20 PM »


possible po ba na magawa ung 0-99 up counter using pic16f84a? or dapat may baguhin sa circuit? kasi eto po ung circuit na pnpagamet samen, ksu nung gngwan ko po ng code, parang di ko kaya sa circuit na to.

ung counter po na pinapagamet samen is TMR0, pahelp naman po sa idea ng project na toh,,
gamet ko po is MPLAB sa compiling and PROTEUS sa simulation

thanks in advance!
"Success is never a destination, its a journey."

Philippine Electronics Forum

dual 7-segment up counter using this circuit
« on: August 09, 2010, 11:41:20 PM »

Offline nucleus

  • Gas Turbine
  • **
  • Posts: 2573
  • Pogi/Ganda Points: 123
  • Gender: Male
Re: dual 7-segment up counter using this circuit
« Reply #1 on: August 10, 2010, 12:05:46 AM »


possible po ba na magawa ung 0-99 up counter using pic16f84a? or dapat may baguhin sa circuit? kasi eto po ung circuit na pnpagamet samen, ksu nung gngwan ko po ng code, parang di ko kaya sa circuit na to.

ung counter po na pinapagamet samen is TMR0, pahelp naman po sa idea ng project na toh,,
gamet ko po is MPLAB sa compiling and PROTEUS sa simulation

thanks in advance!

wala kang capacitor sa crystal, though kahit wala yun gagana parin dapat yan hindi lang stable
papost ng code na nagawa mo para malaman natin kung bakit ayaw gumana
Hi! I'm nucleus and i carry the charge 8)

Hindi ako nandito para makipagkumpitensya kanino man

Philippine Electronics Forum

Re: dual 7-segment up counter using this circuit
« Reply #1 on: August 10, 2010, 12:05:46 AM »

Offline newo

  • CR2032 Battery
  • **
  • Posts: 49
  • Pogi/Ganda Points: 0
  • Gender: Male
Re: dual 7-segment up counter using this circuit
« Reply #2 on: August 12, 2010, 12:38:06 AM »
sir nucleus, inieedit ko pa po ung code ko, may tanung lang po muna ako sa proteus simulation, ung code ko po kc dapat alternate po ung pag-on ng 2 7-segment, pero pag sa proteus parehas p dn po nag-oon, may bbguhin po sa settings ng proteus?
"Success is never a destination, its a journey."

Philippine Electronics Forum

Re: dual 7-segment up counter using this circuit
« Reply #2 on: August 12, 2010, 12:38:06 AM »

Offline nucleus

  • Gas Turbine
  • **
  • Posts: 2573
  • Pogi/Ganda Points: 123
  • Gender: Male
Re: dual 7-segment up counter using this circuit
« Reply #3 on: August 12, 2010, 05:16:08 PM »
p channel ang gamitin mong fet
Hi! I'm nucleus and i carry the charge 8)

Hindi ako nandito para makipagkumpitensya kanino man

Philippine Electronics Forum

Re: dual 7-segment up counter using this circuit
« Reply #3 on: August 12, 2010, 05:16:08 PM »

Offline newo

  • CR2032 Battery
  • **
  • Posts: 49
  • Pogi/Ganda Points: 0
  • Gender: Male
Re: dual 7-segment up counter using this circuit
« Reply #4 on: August 13, 2010, 04:37:27 PM »
sir nucleus, my binago po ako sa circuit ko:


eto po ung pang newbie na code na nagawa ko, nung nagsimulate po ako sa MPLAB using WATCH, mukang tama naman po ung code ko pero po sa proteus continuous po ung counting, san po kya mali ko?




    list      p=16F84A             ; list directive to define processor
    #include <p16F84a.inc>         ; processor specific variable definitions

    __CONFIG   _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC

;***** VARIABLE DEFINITIONS
INT_VAR    UDATA    0x0C

               
         DEL1   res   1               
         DEL2   res 1            
         DEL3   res 1
         ONES      res 1            
         TENS1   res 1
         TENS2   res 1

;MAIN PROGRAM**********************************************************
RESET_VECTOR      CODE    0x0000     
        goto    start       
        
MAIN_PROGRAM    CODE

start:      


      banksel      TRISA         
      movlw      0x08      
      movwf      TRISA         
      clrf      TRISB         

      banksel      PORTA
      clrf      PORTA         
      movlw      0x02
      movwf      PORTB

      movlw      0x01
      movwf      ONES
      movwf      TENS1
      clrf      TENS2         
            


      btfsc      PORTA, 3         
      goto       $-1            
      call      INC      
   
      

;SUBROUTINES***********************************************************
       



INC      
      movf      TENS1, w
      call      TENSDIGIT
      movwf      PORTB   
      banksel      PORTA
      bsf         PORTA, 2
      bcf         PORTA, 1
      movf      TENS1, w
      xorlw      0x09         
      btfsc      STATUS, Z         
      clrf      TENS1

      nop

      movf      ONES, w   
      call       ONESDIGIT
      movwf      PORTB
      banksel      PORTA
      bsf         PORTA, 1
      bcf         PORTA, 2
      
      movf      ONES, w         
      xorlw      0x0A         
      btfsc      STATUS, Z         
      clrf      ONES
      
      btfsc      PORTA, 3
      goto      INC
      incf      ONES, f
      incf      TENS1, f
      goto      INC
      
      


ONESDIGIT
      addwf      PCL,f      
      retlw      0x02
      retlw      0x9E
      retlw      0x24
      retlw      0x0C
      retlw      0x98
      retlw      0x48
      retlw      0x40
      retlw      0x1E
      retlw      0x00
      retlw      0x18
      


TENSDIGIT
      movf      TENS1, w
      xorlw      0x0A
      btfsc      STATUS, Z
      incf      TENS2
      movf      TENS2, w
      xorlw      0x0A
      btfsc      STATUS, Z
      clrf      TENS2
      movf      TENS2, w
      call      ONESDIGIT
return

END      
               

         
"Success is never a destination, its a journey."

Philippine Electronics Forum

Re: dual 7-segment up counter using this circuit
« Reply #4 on: August 13, 2010, 04:37:27 PM »

Offline newo

  • CR2032 Battery
  • **
  • Posts: 49
  • Pogi/Ganda Points: 0
  • Gender: Male
Re: dual 7-segment up counter using this circuit
« Reply #5 on: August 13, 2010, 08:41:17 PM »
sir, naaus ko na po pla, eto poL

  list      p=16F84A            ; list directive to define processor
    #include <p16F84a.inc>        ; processor specific variable definitions

    __CONFIG  _CP_OFF & _WDT_OFF & _PWRTE_ON & _LP_OSC

; '__CONFIG' directive is used to embed configuration data within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.

;***** VARIABLE DEFINITIONS
cblock      0x0C
            DEL1 
         DEL2
         DEL3
         ONES
         TENS
endc
;**********************************************************************
RESET_VECTOR      CODE    0x0000  ; processor reset vector
        goto    start            ; go to beginning of program

MAIN_PROGRAM    CODE
start:

        banksel       TRISB
        clrf       TRISB
        movlw       0x08
        movwf       TRISA


        banksel       PORTB
        clrf       PORTB
        clrf       PORTA


        movlw       0x02
        movwf       PORTB


        clrf       ONES
        clrf       TENS


INCREMENT
        btfsc       PORTA, 3
        goto       SETSEGMENTS
        goto       ONESDIGIT

CLEARCONTS
      clrf       ONES
        clrf       TENS
      return


SETSEGMENTS
       movf       ONES, w
       call       DECDIGITS
       movwf       PORTB
      bsf           PORTA, 1
       bcf           PORTA, 2
          
         call      DELAY
         
       movf       TENS,w
       call       DECDIGITS
       movwf       PORTB
      bsf           PORTA, 2
       bcf           PORTA, 1
      
      call      DELAY
         
       goto       INCREMENT

ONESDIGIT
        incf       ONES, f
        movf       ONES, w
      xorlw       0x0A
        btfsc       STATUS, Z   
        call      TENSDIGIT
      goto        SETSEGMENTS
      

TENSDIGIT
       clrf      ONES
       incf       TENS, f
       movf       TENS, w
       xorlw       0x0A
       btfsc      STATUS,Z
       goto        CLEARCONTS
return   


DECDIGITS
        addwf       PCL,f
        retlw      0x02
      retlw      0x9E
      retlw      0x24
      retlw      0x0C
      retlw      0x98
      retlw      0x48
      retlw      0x40
      retlw      0x1E
      retlw      0x00
      retlw      0x18 

DELAY
   movlw   0x7F
   movwf   DEL1
   movlw   0x3F
   movwf   DEL2
Delay_0
   decfsz   DEL1, f
   goto   $+2
   decfsz   DEL2, f
   goto   Delay_0

         ;2 cycles
   goto   $+1




return


END







pero, if ever po mkita nyu po mali dun sa unang code po, papost po sir,, tnx!!!
"Success is never a destination, its a journey."

Philippine Electronics Forum

Re: dual 7-segment up counter using this circuit
« Reply #5 on: August 13, 2010, 08:41:17 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com