See link.
http://h10061.www1.hp.com/ccsearch/search?pname=HP+Pavilion+6540C+Desktop+PC+%28US%2FCAN%29&opname=HP+Pavilion+6540C+Desktop+PC+%28US%2FCAN%29&qry=specification&submit.x=0&submit.y=0&method=prodFinder&ctry=us&lang=en&dlc=en&sni=60494&search=0
The memory sticks are usually not "generic" and you have to get them from Crucial.com or just get lucky.
There are too many posts from people wanting to make their sticks work.
To save you and me time I'll answer how here -> Get compatible RAM.
Bob
I have inherited my daughter's little over a year-old PC, but have been trying to see if I can keep my old PC going to do a few things on since I am more familiar with some programs on it. It is an HP Pavilion 6540C (my first PC). It has 466 Celeron/10.25 GB HD/96 MB SDRAM.
It has been 'leaking' memory the past few months and I have run numerous virus/trojan/spyware programs & more. The VERY few things they found have made no difference in performance. Once it was 'on' the free physical memory would dwindle down fairly soon if you connected to the Net. I have the Fast DeFrag program and you can 'clean' it and watch it dwindle back down fairly soon to 1 MB.
I took off a LOT of files and programs and it didn't help. It should have lots of free space. I used SmartClose to see if closing things one at a time would tell me anything, but I saw no difference.
I bought two used 128MB memory modules and they will not let the PC boot up if used together. I can boot up if I use either 'new' one and the larger of the two original ones. Fast DeFrag will reflect that I now have more free memory once I hit 'Clean.'
I reinstalled WIN98SE since my hard drive test found no errors. It does make my PC boot up quicker than it has in a couple of years (that was another problem)...it boots up the way it used to. It still will not boot with the two 128MB modules. I can't go into BIOS to see what it says since the monitor won't even come on this way (unless there is something I don't know how to do).
My brother-in-law has been giving me some tips via email. I did see where it recognized the two memory modules on the DOS screen if I left one original one in when I was reinstalling. It still seems like physical memory dwindles too fast even with one 128 MB module added. Any ideas?
I thought the hard drive was acting up when the PC made weird noises after I got it booted up after swapping memory around. That turned out to be the CPU fan. I figured that out last night.
It is supposed to be able to handle two 128 MB modules max. Each one HAS worked in various combinations. When I tried both original memory modules it would not boot up. That's why I thought the hard drive may be going bad.

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic