This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

timer 2

Hello,

We are working on 8051 project and using Keil PK51 version 8.05; M/C is P89C52X2BN on 11.0592 Crystal.

1. If a large function is called from task A , and if the same function is called by task B while the function execution is not yet completed by task A, what will the controller do? Will it skip the function for a while / it calls the function / it treats it as reentrant? I am not taking any semaphore style measures for the function calling. I am facing some data corruption problems in my system. What should I do?

2. I need an example program on using Timer 2 interrupt alongwith the initialization of its related registers, if I need timer 2 in auto-reload mode in up-counting timer style. I had used all the related registers and initialized the timer, but it is not functioning.

Please advise

  • . If a large function is called from task A , and if the same function is called by task B while the function execution is not yet completed by task A, what will the controller do? Will it skip the function for a while / it calls the function / it treats it as reentrant?

    None of these. The controller does not know about reentrancy. It will attempt to execute the code, and, if the the function was not made reentrant at compile time, end up in an undefined state.

    What should I do?

    Well, one of several things:

    1. Make the function in question (and all functions called by it) reentrant.
    2. Make a copy of the function under a slightly different name (and all functions called by it) and use it instead of the original.
    3. Make sure that the function cannot be called twice.

  • See the Downloads section.

    It's under Support.

  • I read the datasheet and still donot understand the function of the 3 modes of Lock Bit...It use to prevent other from read out the flash & eeprom ? Or it use to prevent other rewrite the flash & eeprom ? ..

    Can my code protect the Flash memory part while allow the eeprom data to be read out ?

    I usually release my chip with lockbit so no one can't read the flash. But if I need to update or bug fixed, I can erase that chip and write again. With the lock bit set, my program can read and write value to the EEPROM. But someone can't read it via ISP programmer.

    what are wrong?

  • 1) Your name doesn't seem to be "Surendra V" so you seem to have hijacked someone elses thread.

    2) Your question isn't about timer2, so it doesn't seem to relate to the original post.

    3) This isn't a commercial support-site, so the word "urgent" normally means the reverse. Volunteers don't like people who are bullying them for quick answers.

    4) You are asking a number of questions. You are not supplying the required facts for people to be able to make anything but educated guesses...

  • yes i am new and sorry,,,,,you must pleas answer now

  • Dear,

    Please post new thread..

  • do you not ...

    1) Your name doesn't seem to be "Surendra V" so you seem to have hijacked someone elses thread.

    2) Your question isn't about timer2, so it doesn't seem to relate to the original post.

    ... start a new thread

    4) You are asking a number of questions. You are not supplying the required facts for people to be able to make anything but educated guesses...

    ... supply full information about your problem

    Erik