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

Back to Subject List

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


 
#157418 - 5 memory locations?
Responding to: ???'s previous message
Why use 5 memory locations? It sounds like you are advicing that each memory cell should store 0..15 (0x00 .. 0x0f).

Going fully binary (but advanced to get back to decimal for the display), 3 bytes would be enough. But it would be hard to get back the decimal digits for presentation on a display.

Going BCD, where the low part of a byte counts 0..9 and the high part of the byte counts 0, 10, 20, ... you need three bytes. The disadvantage is the need for the code to handle the internal overflow between low and high decimal digit in each byte.

Going decimal, it would take 6 bytes, since the counter is expected to show 6 digits. This is the simplest solution.

Polling isn't so nice unless the count frequency is low. The application will need time to display data on the LCD too, and that would be time not used for polling.

Schematics? Any schematics for your processor should do for a start, with the addition that you may need some protection on the processor pin you use to count pulses, unless the pulses have the correct level and are generated on the same PCB.

Sample code: Look for sample code for the individual ports. Much sample code is available for LCD output. Sample code can be found for pin interrupts or for playing with timers.

If the sample code isn't written for the compiler you are going to use, or your display isn't connected in the same way (and using a similar controller) then you will need to do some rewriting.

How high frequencies do you need to handle? At 1kHz, it would take 16 min 40 sec until you get a 6-digit overflow.

List of 10 messages in thread
TopicAuthorDate
pulse counter with lcd            01/01/70 00:00      
   Re: pulse counter with lcd            01/01/70 00:00      
      5 memory locations?            01/01/70 00:00      
   Re: pulse counter with lcd            01/01/70 00:00      
      counting pules            01/01/70 00:00      
         Definitely use hardware if available            01/01/70 00:00      
            HUH?            01/01/70 00:00      
               All depends on language capabilities            01/01/70 00:00      
                  good idea...            01/01/70 00:00      
                     Bad choices            01/01/70 00:00      

Back to Subject List