in reply to Sending and reading hex commands on a Win32 serial port

An alternative:
pack('C*', 0xca, 0x00, 0x01, 0x00, 0x00, 0xfe);