Let RBC be the reflected binary code, which is also called the Gray code, S RBC be the sum of digits function for RBC, and {P b 0 (n)} n=1 ∞ be the regular paperfolding sequence. In their previous work the authors proved that the difference function of the sum of digits function for RBC, {S RBC (n)-S RBC (n-1)} n=1 ∞ , coincides with {P b 0 (n)} n=1 ∞ . From an infinite sequence b={b k } k=0 ∞ with b k ∈{-1,1}, one can construct an infinite sequence {P b (n)} n=1 ∞ which is called the generalized paperfolding sequence with respect to b. In this paper, when we assume b is periodic, we propose a new numeration code 𝒞 b , and study some properties of the code 𝒞 b in Theorem 1.2. We can prove that the difference function of the sum of digits function S 𝒞 b for 𝒞 b , {S 𝒞 b (n)-S 𝒞 b (n-1)} n=1 ∞ , coincides with the generalized paperfolding sequence {P b (n)} n=1 ∞ (Theorem 1.1). We also give an exact formula for the average of S 𝒞 b in Theorem 1.3.