Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/01/03 12:16
Read: times


 
#59695 - RE: 6 Decimal Digits Counter
Responding to: ???'s previous message
Well then I think the microcontroller will be excellent for this application!! I would suggest that if the rate is slow enough (like below 250 Hz) why don't you simply consider connecting the event input into the external interrupt pin such as INT0 and let the microcontroller process an interrupt for each event. The interrupt service routine can then simply implement a software counter for 6 digits in six memory locations. Since you are simply counting you can accumulate digit counts directly so you most easily manipulate the count for later display, storage or logging. (others may suggest you count in binary format across 3 bytes but this then must be converted to base 10 format digits for display.

Your interrupt routine can use a simple piece of code as follows to increment the six digit number.
; in the internal RAM
DIGITS6:
     DS    6
;
;code within the ISR
;
CNTUP:
     MOV   R0, #DIGITS6
     MOV   R2, #6
CNTLP:
     INC   @R0
     CJNE  @R0, #10, CNTCP
CNTCP:
     JC    CNTDN
     MOV   @R0, #0
     INC   R0
     DJNZ  R2, CNTLP
;
CNTDN:
     ....


Michael Karas


List of 37 messages in thread
TopicAuthorDate
6 Decimal Digits Counter            01/01/70 00:00      
   RE: 6 Decimal Digits Counter            01/01/70 00:00      
   RE: 6 Decimal Digits Counter            01/01/70 00:00      
      RE: 6 Decimal Digits Counter            01/01/70 00:00      
         RE: 6 Decimal Digits Counter            01/01/70 00:00      
            RE: 6 Decimal Digits Counter            01/01/70 00:00      
               RE: 6 Decimal Digits Counter            01/01/70 00:00      
               RE: Explanation - Hatem            01/01/70 00:00      
                  RE: Explanation - Hatem            01/01/70 00:00      
            RE: 6 Decimal Digits Counter            01/01/70 00:00      
   RE: PIC16F84            01/01/70 00:00      
      RE: PIC16F84            01/01/70 00:00      
         RE: PIC16F84            01/01/70 00:00      
      RE: PIC16F84            01/01/70 00:00      
   RE: 6 Decimal Digits Counter            01/01/70 00:00      
      RE: 6 Decimal Digits Counter            01/01/70 00:00      
   RE: 6 Decimal Digits Counter            01/01/70 00:00      
      ...and all in just a dozen instructions!            01/01/70 00:00      
      RE: 6 Decimal Digits Counter            01/01/70 00:00      
   Who needs 8 bits, anyhow?            01/01/70 00:00      
   RE: 6 Decimal Digits Counter            01/01/70 00:00      
      RE: Conditional Jump            01/01/70 00:00      
      RE: RISC            01/01/70 00:00      
         RE: RISC            01/01/70 00:00      
            RE: RISC            01/01/70 00:00      
               RE: RISC            01/01/70 00:00      
                  RE: RISC            01/01/70 00:00      
                  RE: RISC            01/01/70 00:00      
                  RE: skip -vs- jump            01/01/70 00:00      
               RE: Skip            01/01/70 00:00      
            RE: RISC            01/01/70 00:00      
      RE: 6 Decimal Digits Counter            01/01/70 00:00      
   RE: 6 Decimal Digits Counter            01/01/70 00:00      
      RE: 6 Decimal Digits Counter            01/01/70 00:00      
         RE: 6 Decimal Digits Counter            01/01/70 00:00      
            RE: 6 Decimal Digits Counter            01/01/70 00:00      
               RE: 6 Decimal Digits Counter            01/01/70 00:00      

Back to Subject List