I think Madrid is better than Barcelona, more because of the general ambience rather than any architectural beauties. The real joy of Madrid is just walking around, soaking up the atmosphere and finding lovely little squares. For a weekens trip concentrate on tapasing your way around, there's a lot of lovely places to eat and drink. Madrid is centred on Puerta del Sol where there are hundreds of bars, some touristy, some not. Go to Papa Bravas for the Patatas Bravas, lovely. Nearby you have Plaza Sanat Ana, which is a great place to sit outside and watch the world go by, close to here is Cafe Central which hosts fanatastic live Jazz at the weekends.
Plaza Mayor is a good place to sit with an overpriced beer, here got to "el torre oro", its a bar that show bullfights oin video where the bull wins. Around the side streets near Plaza Mayor there are variety of bars and resaurants worth trying, especially "lizarran" a basque bar, great tapas(your first is free).
The retiro park is a great place to go walking in the afternoon. There are plenty of museums and buildings to admire, most are walking distance of the centre, so just randomly walk and discover them.
Places to stay, lots of cheap Pensions around Puerta del sol, better places include the TRYP on Gran Via which is often very cheap, otherwise check out the NH and Sol Melia chains. Anywhere central will do as the Metro is cheap and excellent.