Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Digimatic SPC Interface

Status
Not open for further replies.

sspence65

New Member
I'm trying to connect a Mitutoyo micrometer to my Arduino m2560. Not able to read any data from the unit. I'm using https://www.sonsivri.com/forum/index.php?topic=29876.0 as the source idea, and am attaching my cable pinouts:

Mitutoyo Cable.JPG
 

Attachments

  • Mitutoyo Cable Arduino.JPG
    Mitutoyo Cable Arduino.JPG
    15.2 KB · Views: 2,804
Last edited:
Here is the code sample I'm working with:

C:
int req = 5; //caliper REQ line goes to pin 5
int dat = 2; //caliper Data line goes to pin 2
int clk = 3; //caliper Clock line goes to pin 3
int iclk = 1; //pin 3 corresponds to interrupt number 1
int i = 0; int j = 0; int k = 0; int n = 0;

int mydata[52];

void setup()
{
  Serial.begin(19200);
  pinMode(req, OUTPUT);
  pinMode(clk, INPUT);
  pinMode(dat, INPUT);
}

void loop()
{
  if (n == 0) attachInterrupt(iclk, myisr, RISING);
    PORTD |= (1<<5); // digitalWrite(req, HIGH);
    delay(10);
    PORTD &= ~(1<<5); // digitalWrite(req, LOW);
    if (i > 51)
    {
      for (j = 0; j < 13; j++)
      {
        Serial.print("--");
        for (k = 0; k < 4; k++)
        {
          Serial.print(mydata[(j*4)+k]);
        }
      }
    i = 0;
    }
}

void myisr()
{
  if (i == 0) PORTD |= (1<<5); //digitalWrite(req, HIGH);
  if(i < 52)
  {
    mydata[j] = digitalRead(dat);
    i++;
  }
}
 
Last edited by a moderator:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top