byte compression


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Thanks for the suggestions, Skimask and SteveB.
    I'll try your code, Skimask, and see if it works. Would it save any code space on the PIC (compared to my original code?)

    The application logs data at very irregular intervals, from seconds to days. So SteveB's suggestion would require three bytes (or at least 21 bits anyway): two bytes for the seconds since the last incident, and 5 bits for the number of days since the last incident (and I think I would only count seconds up to 12 hours, then increment a half-day counter). A couple of bytes saved, but two different time data formats in the EEPROM: the initial time stamp, and then the incremented offsets, and post-processing required for the data.
    I think I'll stick with time stamps on each event.

    Norbert

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Norbert View Post
    Thanks for the suggestions, Skimask and SteveB.
    I'll try your code, Skimask, and see if it works. Would it save any code space on the PIC (compared to my original code?)
    I'm not sure if it'll save any code space, and it does make it a bit harder to read. About the only thing it will save for sure it space on the screen while you're looking at it.

    I think I'll stick with time stamps on each event.
    Norbert
    There ya go. Sometimes it's a lot easier to stick with something a bit wasteful and make the hardware take up the slack (i.e. a larger eeprom or more of them)...

Similar Threads

  1. LCD freeze
    By harryweb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th October 2009, 08:01
  2. Memory use - how much do you use?
    By keymuu in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 10th June 2009, 22:39
  3. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. 16F877 RAM Question
    By Art in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 6th August 2005, 11:47

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts