HP Deskjet 2540 - Reset Ink Levels on the Cartridge
The HP Deskjet 2540 cannot physically see inside the cartridges to find out how much ink is left. Instead, the copper contacts on the outside of the cartridges contain this information. The ink levels start at full. Every time a page is printed or a head cleaning routine run, the printer writes this information to the cartridge. Eventually, the cartridge will state that it is empty. However this may not be the case, and it may be possible to use the remaining ink in the cartridge.
If you have refilled your cartridge, or have purchased a remanufactured one, the copper contacts will already hold the information that the cartridge is empty. Clearly they are not, but it is not currently possible to reset the ink level on the copper contacts of the cartridge.
You will always receive an "empty cartridge" error message, but you should be able to continue printing.