Is this a USB Keyboard? If so follow these directions to stop the computer from turning off the USB interface...Also see one more note below.
A. USB power shutting off:
click my computer, on your desktop
click control panel, it's on the left hand side of my computer window
click the "system" icon, a window will open that says system properties
click the hardware tab
click the device manager bar
when the device manager window opens, scroll down, find universal serial bus controllers
double click universal serial bus controllers, it's on this list
now you will see a list, find USB root hub on the list
double click the first USB hub on the list
when the USB hub properties window opens, click the power management tab at the top of the window
now you will see a box that says: "allow computer to turn off this device to save power"
Un-check that box, click OK
Now double click the second USB hub on the USB Hub Properties list, click the power management tab, un-check the power saver box just as above, and click OK
Now repeat that same procedure for all the other USB hubs on the list, un-check the power saver box in each USB hub, until you have done all the USB hubs on the list. There may be several, you must do each, one at a time.
Now close all your windows and restart the computer.
Now the USB should stay on.
The computer was turning off the USB to save power. It's a bug in XP.
B. Keyboard may not function after computer comes out of standby:
click my computer, click control panel, click display, click screen saver, click power, set turn off monitor to never, set system stand by to never, set turn off hard disks to never, click apply, close all windows, restart computer.