Making Program Code Space your playground...


Results 1 to 16 of 16

Threaded View

  1. #6
    Join Date
    Oct 2005
    Posts
    35


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi,

    Yes I was using EEPROM for array storage but the 16f877 has only 256 bytes available. I will need about 4k just for pattern storage. That is why I'm looking at using the code program space. The problem seems to be my use of binary data input. Here's the code i'm using for testing.


    ' PCode.bas
    ' Quick Demo Program
    ' showing how you can play with
    ' Program Code Space

    Define debug_pacing 1000 'serial setup
    Define debug_reg porta
    Define debug_bit 0
    Define debug_baud 2400
    Define debug_mode 1
    TRISB= %00000000
    TRISa= %00000 '
    '

    ' RAM Assignments & Variables
    ' ---------------------------
    PCAddress var WORD ' Used to determine ADDRESS of Data
    ' within Program Code space
    PCData var BYTE ' Data Variable - in this example a BYTE
    ' but could be a WORD as each memory
    ' address is capable of storing 14-bits
    PCWord var WORD
    '
    ' Start Program
    ' =============
    Pause 2000
    DoitAgain:
    PCAddress=7190 ' Pointer to start of Data area
    '
    ' Read & Display till we get a stop character
    ' -------------------------------------------
    ReadCodeLoop:
    READCODE PCAddress,PCData ' Sequentially read bytes
    If PCData>0 then ' Until a Stop character is found

    debug "ADD=", dec pcaddress 'lcd display
    debug 254,192
    debug "DAT=", dec pcdata

    PCAddress=PCAddress+1 ' Remembering to increment our address
    portB=pcdata 'output data to portB LEDs

    Pause 300
    Goto ReadCodeLoop
    endif
    Pause 50

    Goto DoitAgain

    End


    Asm
    CODE 7190



    DB 00000001
    DB 00000010
    DB 00000100
    DB 00001000
    DB 00010000
    DB 00100000
    DB 01000000
    DB 10000000
    DB 0

    Endasm




    ........................
    RESULTS

    debug LCD readout values
    00000001 = 1 OK
    00000010 = 10 NG
    00000100 = 100 NG
    00001000 = 232 NG
    00010000 = 16 OK
    00100000 = 160 NG
    01000000 = 64 OK
    10000000 = 128 OK
    Last edited by Homerclese; - 9th October 2005 at 01:23.

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 09:54
  2. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  3. Replies: 1
    Last Post: - 23rd May 2009, 09:22
  4. Need more code space
    By ghutchison in forum General
    Replies: 1
    Last Post: - 12th February 2005, 20:54
  5. oscillator code and placement within program
    By bartman in forum mel PIC BASIC
    Replies: 14
    Last Post: - 14th December 2004, 02:39

Members who have read this thread : 1

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