In order to synchronize ship's chronometer before their departure from Edinburgh's Firth of Forth, Captain Wauchope, a Scottish Naval Officer in the Royal Navy installed in 1961, a the time ball on top of Nelson's Monument at Calton Hill, which was easily visible from the Leith harbour. At precisely one O'clock the ball used to drop giving signal to sailors to synchronize their clocks.
Image from Flickr is by qyphon
It was therefore decided to introduce a simultaneous firing of a cannon. Originally an 18-pound muzzle loading cannon located at Half Moon Battery of Edinburgh Castle was used. It needed four men to load and fire the gun which could be easily heard by ships in the harbour 3 kms away.
Picture of Half moon battery from Panoramio is by Dman6486
After advent of precision chronometers the gun firing became redundant, but the tradition has continued and is prevalent now a days also. However from 1953 instead of the cannon a 25 pound Howitzer is now fired form Mill's Mount Battery. This is done every day at one O'clock except on Sunday and the occasion is a popular tourist attraction.
Image from Flickr is by J.Marshall
Info source: http://www.edinburgh-royalmile.com
More Info: http://members.fortunecity.com/gillonj/edinburghtimegun/
It may be worth noting that time balls and time guns are not unique features of Edinburgh. There are several other places where this practice was adopted but was later stopped. Like Edinburgh some places have retained this practice.
For more reading refer to Wikipedia Time Ball / Noon Gun