 He obtained a cadetship in 1775, and was appointed to an ensigncy in the Madras infantry, 21 Nov. 1776.He served as an engineer officer in the war with Hyder Ali, although he appears never to have belonged to the engineers.As lieutenant, he served with the Guides in Lord Cornwallis's campaigns against Tippu Sultan; and eight years after, as a field officer, was surveyor-general with the army under Lieutenant-general Harris, which captured Seringapatam in 1799.