Go Down

Topic: PulseIn and Nuelectronics ENC28J60 Ethernet Shield (Read 1 time) previous topic - next topic


Mar 10, 2011, 06:38 pm Last Edit: Mar 14, 2011, 06:21 pm by Vahan Reason: 1
Hi folks,

I'm currently tinkering with some weather sensors and have found a strange problem when I try to add the ENC28J60 EthernetShield to my setup.

I've the following block to calculate the frequency of the MTF3223 (HS1101) humidity sensor:

Code: [Select]

long getFrequency(int pin)
  long freq = 0;

  for (unsigned int j = 0; j < FREQUENCY_SAMPLES; j++)
    long f = pulseIn(pin, HIGH, 250000);
    if (f == 0)
      return false;
      freq += 500000 / f;

  return freq / FREQUENCY_SAMPLES;

It works OK on a barebone Uno and 2009, but as soon as I add the enc28j60 shield the reported frequency jumps up approx +1khz  :smiley-roll-sweat:

This happens even if I don't add / initialize the ethernet library.

The shield is one of these: http://cgi.ebay.com/ENC28J60-Ethernet-Shield-Arduino-Duemilanove-/250771510445

Any clues what I'm doing wrong? I'm not using any of the pins that are used by the Shield (2,10,11,12,13)

Go Up