In order to investigate the effect of deep brain stimulation on diseases such as epilepsy, we developed a closed-loop electrical stimulation system using LabVIEW virtual instrument environment and NI data acquisition card. The system was used to detect electrical signals of epileptic seizures automatically and to generate electrical stimuli. We designed a novel automatic detection algorithm of epileptic seizures by combining three features of field potentials: the amplitude, slope and coastline index. Experimental results of rat epileptic model in the hippocampal region showed that the system was able to detect epileptic seizures with an accuracy rate 91.3% and false rate 8.0%. Furthermore, the on-line high frequency electrical stimuli showed a suppression effect on seizures. In addition, the system was adaptive and flexible with multiple work modes, such as automatic and manual modes. Moreover, the simple time-domain algorithm of seizure detection guaranteed the real-time feature of the system and provided an easy-to-use equipment for the experiment researches of epilepsy control by electrical stimulation.