Debugging with KEIL C51

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

Reply to
Nitin Skandan
Loading thread data ...

A while ago I used an older version of the Keil simulator. It had a facility to perform a simulated action, then run the simulator for a given number of cycles, then perform another action. It sounds like what you want for your case.

Thad

Reply to
Thad Smith

Why don't you use KEIL software simulator which is built in IDE, and use Pheripheral PORT which you have keypad connected to and manualy give a pulse on port. And you can also use break points to avoid getting too many key press informations.

Reply to
Mickey

You seem to have missed out on the parts of the debug function syntax in Keil uVision that let a debug function wait for a specified amount of time, or until a given virtual register changes its state. Use those and you can generate both phases of your keypress in one call to a debug function, and thus in a single Toolbox button press.

[A suggestion: Keil's own discussion forum might be a better place for this kind of question...]
--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

I wrote a signal function to reset the PORT0 once that has been read . It is looks like signal void function() { while(1) { if(temp ==1) { exec("PORT0 = 0xFF") ; twatch(10) ; } } } Temp is set to 1 in 8051 code when a port has been read and readg is not 0xFF ie normal state where key is not pressed.

But some reason or other i am not getg desired response

thank you

Reply to
Nitin Skandan

As written, this will trigger *immediately* after your set temp=1, quite possibly before your code ever sees the port pins change.

Switch the order of the twatch() and the exec() and you should be in a better shape. I'm also quite sure it's not necessary to go through exec() to reset the port --- there's bound to be a VREG for that.

You may want to single-step through the code and watch the peripheral windows of the ports closely.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.