Pages: [1]   Go Down
Author Topic: PulseIn and Nuelectronics ENC28J60 Ethernet Shield  (Read 833 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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;
    }
    else
    {
      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)
« Last Edit: March 14, 2011, 12:21:30 pm by Vahan » Logged

Pages: [1]   Go Up
Jump to: