magnetic encoder code errors

hi all
can anyone help with this code
Ive tried running but get the following errors
unsure of where the problem is or how to resolve
many thanks ken

#define SELECT_PIN 4
#define CLOCK_PIN 5
#define DATA_PIN 6

void setup()
{
  //setup our pins
  pinMode(DATA_PIN, INPUT);
  pinMode(CLOCK_PIN, OUTPUT);
  pinMode(SELECT_PIN, OUTPUT);

  //give some default values
  digitalWrite(CLOCK_PIN, HIGH);
  digitalWrite(SELECT_PIN, HIGH);

  Serial.begin(19200);
}

//variables to keep track of position
int reading = 0;
float angle = 0;

void loop()
{
   reading = readPosition();
   
   if (reading >= 0)
   {
      angle = ((float)reading / 1024.0) * 360.0;

      Serial.print("Reading: ");
      Serial.print(reading, DEC);
      Serial.print(" Angle: ");
      Serial.println((int)angle, DEC);
   }
   else
   {
      Serial.print("Error: ");
      Serial.println(reading);
   }
   
   delay(1000);
}

//read the current angular position
int readPosition()
{
  unsigned int position = 0;

  //shift in our data  
  digitalWrite(SELECT_PIN, LOW);
  delayMicroseconds(1);
  byte d1 = shiftIn(DATA_PIN, CLOCK_PIN);
  byte d2 = shiftIn(DATA_PIN, CLOCK_PIN);
  digitalWrite(SELECT_PIN, HIGH);

  //get our position variable
  position = d1;
  position = position << 8;
{| border="1"
|-
  position ||= d2;
|}

  position = position >> 6;

  //check the offset compensation flag: 1 == started up
  if (!(d2 & B00100000))
    position = -1;

  //check the cordic overflow flag: 1 = error
  if (d2 & B00010000)
    position = -2;

  //check the linearity alarm: 1 = error
  if (d2 & B00001000)
    position = -3;

  //check the magnet range: 11 = error
  if ((d2 & B00000110) == B00000110)
    position = -4;

  return position;
}

//read in a byte of data from the digital input of the board.
byte shiftIn(byte data_pin, byte clock_pin)
{
  byte data = 0;

  for (int i=7; i>=0; i--)
  {
    digitalWrite(clock_pin, LOW);
    delayMicroseconds(1);
    digitalWrite(clock_pin, HIGH);
    delayMicroseconds(1);

    byte bit = digitalRead(data_pin);
{| border="1"
|-
    data ||= (bit << i);
|}

  }

  Serial.print("byte: ");
  Serial.println(data, BIN);

  return data;
}

//these are the errors
{| border="1"

cheers ken

The errors didn't come through correctly -- it just says {| border="1"

These two bits of code make no syntactic sense. My best guess is that a cut-and-paste from some forum system included some formatting tags.

If you wrote this code, what are those buts supposed to do?

If you didn't write the code, where did you copy it from?

{| border="1"
|-
  position ||= d2;
|}
{| border="1"
|-
    data ||= (bit << i);
|}

hi there john

yes the code is cut and pasted from this link the other codes run however the ssi sketch does not
http://www.reprap.org/wiki/Magnetic_Rotary_Encoder_1_0#PWM_Output
cheers ken

Looks like the fault was in the original. I think the code should look like THIS:

    position |= d2;
    data |= (bit << i);

Note that the "||=" operator is legal but the second '|' appears to be part of the glitch. They should both be "|=".

many thanks for that john

I made those changes and great it all works ok
cheers ken