I need help. I built a circuit using a PIC16f628 for timing. On power up a relay must be energised after a delay set on a dip switch (RA1, RA2, RA3). A microswitch is connected on RA0. When the microswitch is closed momentarily, the relay must switch off for a time period set on a dip switch (RA4, RA5, RA6), and then switch on again. I have written the program in assembler. It seems to work in the MPLAB simulator, but when I program the chip and use it in circuit strange things seem to happen. The timing does not seem to function. The relay (on RB1) does not come on unless RA1, RA2 and RA3 is high. The dip switches have 10k pull up resistors. I have attached the code. After spending many hours on this I am not sure what is wrong. Any help will be apperciated! The time code was generated by the Delay Code Generator found on the PICLIST.