18f452 tables in ram - code?


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Robert,

    >>Onward to the 18f452. Ah... 16*256 bytes of ram. Now, how do I get at them?

    The 18F452 doesn't have 16*256 bytes of RAM. Only 1,536 bytes in 6 banks with 256 bytes per bank.

    PBP handles everything for you. Just create your variables, and PBP will assign them all to RAM automatically for you.

    You don't need to mess with BSR bits or anything else.

    You can create 16 * 16-byte arrays like this.

    A VAR BYTE[16]
    B VAR BYTE[16]
    C VAR BYTE[16]
    D VAR BYTE[16]
    E VAR BYTE[16]
    F VAR BYTE[16]
    G VAR BYTE[16]
    H VAR BYTE[16]
    I VAR BYTE[16]
    J VAR BYTE[16]
    K VAR BYTE[16]
    L VAR BYTE[16]
    M VAR BYTE[16]
    N VAR BYTE[16]
    O VAR BYTE[16]
    P VAR BYTE[16]

    Of course you can also do it the long way, and create 256 individual variables.

    To see how PBP is assigning your variables to RAM, just open the .lst file created at compile time. You'll see something like this for the above arrays.

    _B EQU RAM_START + 02BH
    _C EQU RAM_START + 03BH
    _D EQU RAM_START + 04BH
    _E EQU RAM_START + 05BH
    _F EQU RAM_START + 06BH
    _G EQU RAM_START + 07BH

    Etc, etc,,
    Last edited by Bruce; - 29th September 2004 at 18:46.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 22:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 22:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 9th December 2008, 00:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 09:26
  5. Why doesn't my code for 18f452 work on 18f252?
    By senojlr in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd December 2005, 03:42

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