Working code but my layman approach uses too much code space


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Working code but my layman approach uses too much code space

    Like Henrik said, the formula is really subtracting 4000 from a WORD. So here's the way I tackled it:

    Code:
    wCalc   VAR WORD
    G3T     VAR wCalc[0]
    G4T     VAR wCalc[1]
    IF wCalc <4000 THEN     'Number will be negative
        DUMMY =MULT*(wCalc+B2)
        MG2_NM = DIV32 100
        MG2_NM=10000-MG2_NM
        LCDOUT $FE, POS4-1,"-"
    ELSE                    'Number will be positive or 0
        Dummy = MULT*(wCalc-B2)
        MG2_NM = DIV32 100
        LCDOUT $FE,POS4-1," "
    ENDIF
    IF MG2_NM < 100  THEN
        LCDOUT "  "
    ELSEIF  MG2_NM < 1000  THEN
        LCDOUT " "
    ENDIF
    LCDOUT DEC MG2_NM/10,".",DEC MG2_NM//10

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Re: Working code but my layman approach uses too much code space

    Thanks for the help guys. Your posts helped out a lot.

Similar Threads

  1. I'm running out of code space example.
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st June 2010, 20:33
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Running out of Code Space - or so it seems
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2006, 16:44
  4. Need more code space
    By Sphere in forum General
    Replies: 2
    Last Post: - 19th September 2005, 20:49
  5. Need more code space
    By ghutchison in forum General
    Replies: 1
    Last Post: - 12th February 2005, 20:54

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