I think that you are interpreting the original statement incorrectly. Mod is, indeed, in most programming languages the binary operator %. So, for instance,
5 % 4 = 1
This implies that $5 \equiv 1 \qquad (\text{mod } 4)$ (It is not the same, however. See Michael Hardy's comments below.)
However, this will not help you solve the original equation. My interpretation of your question leads me to believe that you tried something like this:
(note to anyone scanning, the following is intentionally incorrect)
13 * d = 1 mod 1680 = 1 % 1680 = 1
and then conclude that d=1/13. Similarly, your mod function mod(m,n) performs the equivalent operation, resulting again in 1/13.
The original equation asks,
$13 d\equiv 1 \qquad (\operatorname{mod} 1680)$
or, what number, when multiplied by 13, is equivalent to 1 mod 1680? The first thing to realize is that, if 13 does not divide 1680, there are infinitely many numbers. Chances are, we want the smallest positive number for which this is true.
There are many, many ways to think about this. You could just start plugging in numbers, trying to find one which satisfies this condition. If you were doing this by hand, that would be a terrible way to go, however if you are programming it this won't take very long:
d=1 while (d * 13 % 1680 != 1): d++
On the other hand, for really large numbers this is pretty inefficient. One approach is to rewrite your equation as an equivalent one (as pedja suggested):
If we are looking for $d$ such that $13d\equiv 1 \quad (\operatorname{mod} 1680)$, then we are looking for a number $d$ such that $13d-1=1680k$ for some integer $k$. Let's rearrange that to make it:
$13d-1680k=1$
This is as a linear Diophantine equation, and one can use the Euclidean Algorithm to solve linear Diophantine equations. This approach is algorithmic in nature, so it could certainly be programmed.
Another method would be to use rules about the modulus to find one such $d$. This method works well by hand when the modulus is small, but I doubt it could be (easily) programmed. This relies more on your mathematical sense, to choose suitable operations which will eventually remove the multiplier of 13 on the left side.