Real time classification of complex patterns of trains of spikes is a difficult and important computational problem. Here we propose a compact, low power, fully analog neuromorphic device which can learn to classify complex patterns of mean firing rates. The chip implements a network of integrate-and-fire neurons connected by bistable plastic synapses. Learning is supervised by a teacher which simply provides an extra input to the output neurons during training. The synapses are modified only as long as the current generated by the plastic synapses does not match the output desired by the teacher (as in the perceptron learning rule). Our device has been designed to be able to learn linearly separable patterns and we show in a series of tests that it can classify uncorrelated random spatial patterns of mean firing rates.