If it is 1 KHz AC signal like sine wave or saw tooth then if you represent +ve half cycles by pulses then freq will be 1KHz. You can use ZCD. When signal first crosses zero then a pulse is formed that is goes high and at the next zero cross it goes low. This way freq will be 1 KHz only. On every zero cross you toggle between 0 and 5V.