Measuring distance/position using accelerometer with arduino mega 2560 board

The accelerometer will be mounted on a pendulum which will be made to oscillate on application of external force .
I want to mark a particular point in its oscillation path and count the number of times the pendulum swings above the particular point . All this using an accelerometer to sense the particular point.

Please help me with suggestions on the code for the above problem

Why do you want to use an accelerometer?
What do you think it will report?

The accelerometer is going to measure acceleration. This is going to be a combination of the actual acceleration of the pendulum, plus the effect of gravity on the accelerometer. It is going to be difficult to associate this with a "particular point". The common use of accelerometers to measure the tilt of the object with respect to the gravitational field only works properly for stationary objects.