Two questions from a nooby ...

1. How can I either estimate (and a rectorandom estimate is fine) or measure how long it takes my program to execute a loop? That is, if I'm looking at a dozen ports to see if a switch is thrown and then do some other stuff, how do I figure out how often each port will be sampled to see if the switch has been activated?

2. Is there a program or routine where I can load my program and "build" a circuit (complete with processor, switches, lights, resistors, capacitors, perhaps peripheral memory...) and watch what happens when I press this or that switch?

Jim