Square wave generator + RC circuit

I'm working on building a simple square wave generator that drives an RC circuit.

My idea is for the Arduino to provide a square wave via one of the digital (output) pins, and then for the Arduino to also measure the voltage between the resistor and capacitor (hooked up in series) via one of the A2D pins. I'm using an ~3MOhm resistor and ~10muF capacitor. The RC time constant I'm measuring (for the decay) is about 30ms, which seems ballpark.

So far as I can tell though, the driving circuit works as I've described it, and the capacitor charges, but the a2d circuit only captures the discharging behavior of the rc-pair. Code and data follow. For the period of time the capacitor is charging the A0 pin just reads 0 (nothing).

Suggestions would be appreciated.

// drive rc circuit
//
 
double TD = 4000;  // driving signal period, milliseconds
int SF = 100; // number of data points per period of the 
// driving frequency, should be an even number
int half_wave = SF/2;  // half of the cycle
double dt = TD/SF;  // time to wait between reads
 
 
unsigned long time_right_now;
float voltage;
 
int counter;
int a2d_pin_value;  // the integer A->D temperature reading
int source_v;
int num_loops = 0;
 
#define v_source_pin 13
#define v_measure_pin 0
 
void setup()
{
  //configure the serial connection
  Serial.begin(9600);
 
  pinMode(v_source_pin,OUTPUT);
 
  counter=0;
}
 
 
void loop()
{
 
  // get the time for the message
  time_right_now = millis();
 
  // tick the counter - this is roughly equivalent by ticking the clock by dt
  counter++;
 
  //this sets the first (HIGH) half of the square wave
  if(counter==SF) {
    num_loops++;
    counter=0;
    digitalWrite(v_source_pin,HIGH);
    source_v = 5;    
 
    // to avoid a long string of numbers, take a break 
    // in the behavior every 5 square waves
    if(num_loops%5==0){
      delay(1000*5);
    }
  }
 
  //this is the second (LOW) half of the square wave
  if(counter==half_wave) {
    digitalWrite(v_source_pin,LOW);
    source_v=0;
  }
 
  // read the voltage
  a2d_pin_value = analogRead(v_measure_pin);
  // convert the A->D reading to a voltage
  voltage = (a2d_pin_value/1023.0)*5.0;
 
  // send the data to the serial (USB) port
  //datapacket is...
  Serial.print(time_right_now,DEC);
  Serial.print(",");
  Serial.print(a2d_pin_value,DEC);
  Serial.print(",");
  Serial.print(voltage,DEC);
  Serial.print(",");
  Serial.print(source_v,DEC);
  Serial.print(",\t\n");
 
  // pause before taking and sending another data packet
  delay(dt);
 
}

OUTPUT

6247,1004,4.9071359634,5,	
6313,977,4.7751708030,5,	
6379,952,4.6529812812,5,	
6445,926,4.5259041786,5,	
6510,901,4.4037146568,5,	
6576,876,4.2815251350,5,	
6641,854,4.1739978790,5,	
6707,830,4.0566959381,5,	
6772,808,3.9491691589,5,	
6838,785,3.8367546081,5,	
6903,766,3.7438905239,5,	
6968,746,3.6461389064,5,	
7033,725,3.5434994697,5,	
7099,706,3.4506354331,5,	
7164,687,3.3577713966,5,	
7230,669,3.2697944641,5,	
7296,651,3.1818180084,5,	
7361,633,3.0938415527,5,	
7427,616,3.0107526779,5,	
7492,600,2.9325511932,5,	
7558,584,2.8543498992,5,	
7623,568,2.7761485576,5,	
7689,553,2.7028348445,5,	
7753,538,2.6295208930,5,	
7819,524,2.5610947608,5,	
7884,510,2.4926686286,5,	
7950,496,2.4242424964,5,	
8015,483,2.3607037067,5,	
8081,470,2.2971651554,5,	
8146,457,2.2336266040,5,	
8212,445,2.1749756336,5,	
8278,433,2.1163246631,5,	
8343,421,2.0576734542,5,	
8409,410,2.0039100646,5,	
8474,399,1.9501465797,5,	
8540,388,1.8963831901,5,	
8604,378,1.8475073814,5,	
8670,367,1.7937438488,5,	
8735,358,1.7497556209,5,	
8801,348,1.7008798122,5,	
8866,339,1.6568915843,5,	
8932,330,1.6129031181,5,	
8997,321,1.5689148902,5,	
9063,312,1.5249266624,5,	
9128,304,1.4858260154,5,	
9194,295,1.4418376922,5,	
9260,288,1.4076246261,5,	
9325,280,1.3685239553,5,	
9390,273,1.3343108892,5,	
9455,265,1.2952101230,5,

diagram.jpg