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

Push Button Simulation

Greet all,
I'm trying to write a signal simulation function for a push button, but it doesn't seem to work. What I tried to do was create a Toggle button in Tool menu of Keil IDE (uVision2 Version 2.40a) to toggle an input port pin as it's a push button switch when I run the debugger. I've been reading Keil uVision user guide, but don't quite to get it. Here are what I did.

This one works as intended.

define button "Toggle", "Port3 = Port3 ^ 0x10" 

This one doesn't work.
signal void Toggle (void)
{
	PORT3 = (PORT3 ^ 0x10);
	twatch (1000000);
}

This one works but not like the first one.
signal void Toggle (void)
{
	PORT3 = (PORT3 ^ 0x10);
	twatch (1000000);
}
Toggle ();

Everytime I run the debugger, it acts as the push button is pressed and held with no button in Tool menu to toggle it.
To my understanding, if simulation function is written correctly, at the compile time I should not have any error message (apparently I have none) and a button label Toggle should be created in Tool menu. For some reason it doesn't do that. Could someone tell me what wrong with this one? Any input would be greatly appreciated. Have a great day.

T.L

Parents Reply Children