Ram Gets Cleared


Closed Thread
Results 1 to 3 of 3
  1. #1
    ljubex's Avatar
    ljubex Guest

    Default Ram Gets Cleared

    Hi everybody,
    I work with Pic 18F452 and have strange problem. In some moment all RAM data goes to 0. I guess that it happens because of bad power supply or something, but does anyone know WHY is this happening and how to solve the problem.

    Thanks a lot

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Could be many things... any code and schematic?

    Did you tried disable the brown-out reset fuse?
    Is MCLR attach to VCC
    Any floating pins?
    Too much nested gosubs?
    Circuit on a solid PCB or on a proto-board?
    Battery powered or bench psu?
    Supply line clean and properly filtered (caps around and close to PIC (at least)?
    Any possible messy or loose contacts crystal, supply rails, ... , ....?
    ...?
    Last edited by mister_e; - 6th November 2005 at 18:27.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    ljubex's Avatar
    ljubex Guest


    Did you find this post helpful? Yes | No

    Default Problem found

    Not solved yet, but I hope it wan't be a problem. The situation was that on reset initial values of all data in one program section was set to zero. This is what compiler is doing, we didn't know that. We use Hi-Tech's compiler. Here is their explanation:

    "Any object file may contain bytes to be stored in memory in one or more program sections, which will be referred to as psects. These psects represent logical groupings of certain types of code bytes in the program. In general the compiler will produce code in three basic types of psects, although there will be several different types of each. The three basic kinds are text psects, containing executable code, data psects, containing initialised data, and bss psects, containing uninitialised but reserved data. The difference between the data and bss psects may be illustrated by considering two external variables; one is initialised to the value 1, and the other is not initialised. The first will be placed into the data psect, and the second in the bss psect. The bss psect is always cleared to zeros on startup of the program, thus the second variable will be initialised at run time to zero. The first will however occupy space in the program file, and will maintain its initialised value of 1 at startup. It is quite possible to modify the value of a variable in the data psect during execution, however it is better practice not to do so, since this leads to more consistent use of variables, and allows for restartable and romable programs. For more information on the particular psects used in a specific compiler, refer to the appropriate machine-specific chapter."

    In situation where electricity is bad, we've got resets frequently. I hope this will be usefull for somebody else.

    Thanks again!

Similar Threads

  1. 12F629 LDR - Light Dependant Resistor
    By Dennis in forum Schematics
    Replies: 15
    Last Post: - 18th February 2010, 22:33
  2. On-Chip RAM
    By DaveC3 in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 28th July 2008, 10:16
  3. Using the DS1302 scratchpad RAM ?
    By Kman in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th August 2007, 16:27
  4. 16F877 RAM Question
    By Art in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 6th August 2005, 11:47
  5. 18f452 tables in ram - code?
    By rshanks in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st October 2004, 05:06

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