Not able to get PinChangeInt working

Hi there,
I have an Arduino Uno as a DRO, reading 2 off chinese calipers on my mini-lathe, with the caliper clock signals into interrupts 0 and 1 (pins 2 and 3 respectively) I want to use the same kit for my newly-acquired mini-mill, but that requires three caliper inputs.
I’m sure I can do this witha mega, which has plenty of interrupt pins, but I wanted to try staying with an Uno.

A bit of reading brought me to the PinChangeInt library, which I uploaded and tried to get working. Unfortunately, i just can’t seem to get any response from it, and would appreciate some guidance. Here’s a code snippet

Pin 4 wired as the interrupt input

#include <PinChangeInt.h>
#define intPin 4  //Using digital input pin 4 as the interrupt

void setup() {
  Serial.begin(9600);
  
 pinMode(intPin, INPUT); 
 digitalWrite(intPin, HIGH);
 PCintPort::attachInterrupt(intPin, ReadCal, FALLING); //ReadCal is the caliper read
  // set up the LCD's number of columns and rows and clear display 
   }

which doesn’t work

and my original code, using the hardwired interrupt on pin 3, which works just fine, so i know the rest of the sketch is ok

void setup() {
  Serial.begin(9600);
  
  attachInterrupt(1, ReadCal, FALLING);//ReadCal is the caliper read
  }

Note: I’ve used the downloaded version 2.19 Beta of the PinChangeInt library from http://code.google.com/p/arduino-pinchangeint/wiki

I guess I must be doing something wrong but just can’t see what it is - any suggestions ?

I guess I must be doing something wrong but just can’t see what it is - any suggestions ?

The usual one for people who only post snippets. The fine folks at http://snippets-r-us.com can probably help you.

My first post ever, so apologies Thanks for the heads-up on the snippets issue - I shall take note for the future

Hi Tom,

i posted a code to drive three calipers without using interrupts. You can find it here: http://forum.arduino.cc/index.php?topic=210741.msg1600240#msg1600240. It is working properly. There is one problem i did not fix yet: either all calipers are connected to the arduino, or the values are not shown.

regards

Safran

Does this...

 PCintPort::attachInterrupt(intPin, ReadCal, FALLING); //ReadCal is the caliper read

need to be this?

 PCintPort::attachInterrupt(intPin, &ReadCal, FALLING); //ReadCal is the caliper read

safran: Hi Tom,

i posted a code to drive three calipers without using interrupts. You can find it here: http://forum.arduino.cc/index.php?topic=210741.msg1600240#msg1600240. It is working properly. There is one problem i did not fix yet: either all calipers are connected to the arduino, or the values are not shown.

regards

Safran

The code doesn't work because each reading axis is dependent upon having read the preceding axis. If the Z axis caliper isn't present, then you'll be stuck waiting for it. The code is about 150 lines too long.