8051 : i want to use the timer

Discussion in 'Embedded Systems and Microcontrollers' started by furtsiv, Apr 13, 2017.

  1. furtsiv

    Thread Starter New Member

    Mar 7, 2017
    16
    0
    hey there
     
    Last edited: Oct 29, 2017
  2. absf

    Senior Member

    Dec 29, 2010
    1,873
    512
    Where did you store your startup program (In internal ROM or external NV RAM)?
    Are you going to clear the entire external (assuming 32KB, from your other post) or just a portion of it?
    What is the size of the hex you programmed inside sram?
     
    furtsiv likes this.
  3. furtsiv

    Thread Starter New Member

    Mar 7, 2017
    16
    0
    i store my program in NV RAM
    i want to erase the entire ram wich is 32kb
    the size of the hex is 78kb

    the chip can be powered off but still remember data because of the batery attached to the mcu ,so i want the timer still counting if i remove 5v (because it can be in idle using its 3v battery)

    so i want it to erase ram after x senconds but if it was in idle mode it will erase data after powering up and timer count is superior to x
     
    Last edited: Apr 14, 2017
  4. ScottWang

    Moderator

    Aug 23, 2012
    6,422
    995
    You can using a pnp bjt like a switch to control the Vcc of SRAM.
    And using cmos 555 like lmc555 as a Monostable Multivibrator, you can setup the delay time, and add some other parts as below:

    Power up → rc trigger lmc555 delay time → C isolator → NPN bjt → PNP bjt → SRAM Vcc
    If the values of resistors cause the current of SRAM too less then you can adjust the values of R6, R3, R4 to match what you want. and adjust the VR1 to match your desired delay time.

    SRAM_PowerUpReset_furtsiv_ScottWang.gif

    555 Monostable Circuit Calculator
    .
     
  5. furtsiv

    Thread Starter New Member

    Mar 7, 2017
    16
    0
    thanks
    but the chip already have a timer , can i put a command to erase ram in registers then delay it ?
     
  6. ScottWang

    Moderator

    Aug 23, 2012
    6,422
    995
    You can setup the timer after all initial program is finish and active it, when the time up then send a 0.1 second high pulse to I/O port, and the I/O pin connecting to the pin 3 of 555, and take the 555 away.
     
  7. absf

    Senior Member

    Dec 29, 2010
    1,873
    512
    Here is a memory map of the ds5000 that has only 8KB of NV RAM.

    memory map of ds5000.PNG
    1. If you have 32K of NV RAM, where are the rest of them mapped to? On data or program memory?

    2. When the timer expires after x seconds, where does it go to? Can it be vectored to an address on the program memory?

    3. When you said your hex is 78K, does it mean the file size on the PC directory? Where does it go to in the map?

    4. How do you access to the data memory? Using MOV or MOVX instructions?

    Allen
     
    Last edited: Apr 14, 2017
  8. ScottWang

    Moderator

    Aug 23, 2012
    6,422
    995
    I think you should post your schematic or at least a block diagram, otherwise we don't know how did you arrange the memory units, including hardware and software.
     
    absf likes this.
  9. absf

    Senior Member

    Dec 29, 2010
    1,873
    512
    That would be nice to have a schematic of your setup instead of guessing.

    I have not use this MCU before, it is difficult to see the differences between those 3 families of chips namely intel 8051, maxim ds5000 and atmel at89x51.

    Allen
     
    Last edited: Apr 14, 2017
  10. absf

    Senior Member

    Dec 29, 2010
    1,873
    512
    I think I just found the datasheet of the DS5000 soft micro Module. See attached.

    On page 7 of the PDF. There is a "F" command for "Fill embedded RAM block with constant".

    Can't you just use this command to clear the NV RAM. After the timer expires, let the program jump to a place where you place a short program executing the "F" command to clear the block of RAM with "0". That should fullfill your goal.

    I guess, the syntax should be something like "F start_addr, end_addr, constant"

    And here is a programmer for the DS5000fp.

    Allen.
     
    Last edited: Apr 14, 2017
    ScottWang likes this.
  11. furtsiv

    Thread Starter New Member

    Mar 7, 2017
    16
    0
    this command "f" work if bootloader is activated wich is not the case of a runnig normaly
    i can erase ram from terminal by connectig the chip by serial and using f command
    but i want the microcontroller do it itself after a delay
    can i add this delayed command to the hex file ?
     
Loading...