Dear All,Looking for some code help.

portb.0 connected to press button via dip switch. what i want is:

if DIP SW = off and button is pressed then OUTPUT = toggle.(Latch)
if DIP SW = on and button is pressed then OUTPUT = Momentry(as long as the button is pressed)
IS it possible?

Thanks.