Cannon have length and diameter. For the purposes of your question, the diameter doesn't matter, except that diameter of the shell has a larger effect on drag (wind resistance) than the length of the shell. A small diameter shell can be fired from a large diameter cannon by using a sabot to carry the shell through the barrel.
According to NASA, a one-mile long cannon could do the job, if your payload can withstand 4,000 g acceleration:
Let us assume that the shell inside the cannon accelerates at a constant rate of a (meters/sec2). From the equations of motion with a constant acceleration (developed earlier for falling objects, whose acceleration a equals g ≈10 m/sec2), if t (in seconds) is the time spent accelerating, the final velocity (m/sec) is
v = at
and the distance covered, in meters
s = (at^2)/2
From the first equation, t = v/a. Substituting this in the second equation gives, after a few steps
v^2 = 2as
Suppose the barrel of the cannon is a mile long (≈1600 meter) and the final velocity v, the one with which the shell emerges, is the escape velocity from the surface of the Earth
v = vesc. = 11,300 m/sec
v^2 ≈ 128,000,000 (m/sec)2
Then a quick calculation yields: a ≈ 40,000 m/s2 ≈ 4000 g
http://istp.gsfc.nasa.gov/stargaze/SSHARP.htm
The longer the barrel, the lower the acceleration needed. (This assumes that the acceleration is constant throughout the barrel. This is approximated by firing charges at intervals along the barrel as the shell passes.) The calculations are shown above. It might be interesting to calculate how long a barrel would have to be if the acceleration was 1 g or 10 m/s^2.
Payloads can be "hardened" against high accelerations, but I don't know what the highest feasible accelerations are. Every cannon shell contains a fuze that must survive the acceleration of being fired.
Of course, the calculations above ignore the aerodynamic drag (wind resistance) of the atmosphere. Because of that, the initial acceleration would have to be much higher than 11,399 m/s^2. How much higher would depend on the drag coefficient of the projectile. (And I don't know how to include aerodynamic drag.)
The HARP Project experimented with launching scientific payloads to high altitudes, but was cancelled before the planned attempt to launch a sattelite could be made. You'll find a lot of information on the HARP Project on the Internet.
http://www.astronautix.com/articles/abroject.htm
http://en.wikipedia.org/wiki/Project_HARP
http://www.google.com/search?q=harp+project+cannon
The Super High Altitude Research Project (SHARP) was a follow-on to HARP. See the results of this Google search:
http://www.google.com/search?q=%22super+high+altitude+research+project%22