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

Debugging With Simulator

friends,

I am working in an LCD keypad module for an industrial controller using AT89S52 processor. Developemnt platform is KEIL IDE. I have done the coding and right now i am doing testing of coded modules. For this i am using in built simulator of keil. here i am experiencing some problems.
I real case all the pins are pulled up so when ever key stroke occcur the corresponding pin will be GNDed. once the key is released i goes back to high again. How this situation cud be simulated in keil. I wrote a debugging function to give external I/P to port pin to signify key strokes. that func is activated on pressing a button. But i have to presss another button to bring port back to norm state. by this time the program would have taken many keystrokes. So i want somthg which will bring port pins back to norm state once keypins are read by simulator. this kinda situation wont arise if you use an in circuit debuger.

Thank you

Nitin S

Parents
  • I'm not too sure what your signal function is supposed to do, but I think the following is what you really want.

    signal void press_key (char k) {
      PORT1 &= ~(1<<k);  /* Clear P1.k */
      swatch (0.5);      /* Wait .5 sec */
      PORT1 |=  (1<<k);  /* Set P1.k */
      swatch (0.5);      /* Wait .5 sec */
    }
    press_key takes as an argument the bit position in P1 you want to simulate a key press on. It then simulates a key press (by clearing that bit), a delay of .5 sec, a release of the key (by setting the bit), and another delay of .5 sec.

    You may define toolbox buttons for each key. For example:

    define button "Key 1", "press_key(0)"
    define button "Key 2", "press_key(1)"
    define button "Key 3", "press_key(2)"
    Jon

Reply
  • I'm not too sure what your signal function is supposed to do, but I think the following is what you really want.

    signal void press_key (char k) {
      PORT1 &= ~(1<<k);  /* Clear P1.k */
      swatch (0.5);      /* Wait .5 sec */
      PORT1 |=  (1<<k);  /* Set P1.k */
      swatch (0.5);      /* Wait .5 sec */
    }
    press_key takes as an argument the bit position in P1 you want to simulate a key press on. It then simulates a key press (by clearing that bit), a delay of .5 sec, a release of the key (by setting the bit), and another delay of .5 sec.

    You may define toolbox buttons for each key. For example:

    define button "Key 1", "press_key(0)"
    define button "Key 2", "press_key(1)"
    define button "Key 3", "press_key(2)"
    Jon

Children