better coding methods to freeing active ram in small pics


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default Re: better coding methods to freeing active ram in small pics

    Also, check this thread out for more tips.

    http://www.picbasic.co.uk/forum/show...highlight=code
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  2. #2
    Join Date
    Feb 2011
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: better coding methods to freeing active ram in small pics

    What is your issue programming or outputting?

    Ran into the same brickwall and used the onboard NV ram for stuffing the output messages.
    Used the debug instead of serout/hserout it uses less space
    Then Used gosub for calling the output and read the text one letter and used char+128 to indicate EOL/EOM.

    The gosub used much less space using individual functions:
    so if you had a lot of conditions; set them up as a matrix and work them against the matrix, calling all from the NV ram.
    Amazingly ugly but did it on a bet. Even had room for a copyright

    Next time just buy the larger [read better] part, they wind up being cheaper
    12f1840 / 16f182x / 16f193[8/9]

    Newark.com has decent pricing. [last years pricing, but you get the idea]

    Code:
    PIC12F683	8dip	20MHZ 2Kprog 128nvB 256EE 6I/O $1.41 or	$1.15	
    PIC12F1822	8 dip	2kprog 256ram 128nvB 6 i/o	$1.20
    PIC12F1840-I/P		 8 PDIP	IO6 Prog7K 256B RAM 128nvB 32MHz 3tmr  	$1.18

    Using the NV -- Ofuzzy1 & W_Alarm are now text strings residing in the NV
    Code:
    CharBump        con $80
    Ofuzzy1 data @$10,   "(C)2011 Ofuzzy1 AllRightsReserved-Not for Life Critical Use", "!" + CharBump
    W_Alarm  Data        "Alarm", "_" + CharBump
    Code:
    gosub Print_Copyright
    ...
    
    Print_Copyright:
    gosub Print_SP2 : gosub CR_LF3 ': gosub CR_LF
    zb= Ofuzzy1 : gosub Print_Phrase
    gosub CR_LF3 ': gosub CR_LF
    return

    to print a phrase out use this:
    ab, bb, zb are byte sized VAR
    Code:
    Print_Phrase:   ' Call with zb = ROM_Memory_Location [byte]
    bb = 1
      Do until !BB '  = 0
        read zb, ab
        if ab > CharBump-1 then 
            ab = ab - CharBump
            bb = 0
        endif    
        debug ab
        zb= zb + 1
      loop
    return
    to call get the phrase ready to print use this:
    Code:
    Print_Copyright:
    gosub CR_LF
    zb= Ofuzzy1 : gosub Print_Phrase
    return
    Need 3 or 2 or 1 line feeds?
    Code:
    CR_LF3:
    debug LF,cr
    CR_LF2:
    debug LF,cr
    CR_LF:
    debug CR,LF
    return

Similar Threads

  1. amount of ram
    By vicce67 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th November 2012, 18:15
  2. Re-programming SM PICS on small PCBs
    By tekart in forum General
    Replies: 0
    Last Post: - 11th April 2011, 18:07
  3. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 21:31
  4. Alternative Methods ...
    By T.Jackson in forum Off Topic
    Replies: 3
    Last Post: - 9th June 2008, 14:13

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