SeungheeOh 1 year ago
parent
commit
630abd209c
1 changed files with 391 additions and 197 deletions
  1. 391
    197
      d72042.ino

+ 391
- 197
d72042.ino View File

@@ -23,15 +23,15 @@
23 23
 #define REG_READ_FLG (bitchange(0x1)|READ)
24 24
 #define REG_READ_RDR1 (bitchange(0x2)|READ)
25 25
 #define REG_READ_RDR2 (bitchange(0x3)|READ)
26
-#define REG_READ_LDR1 (bitchange(0x4)|READ)
27
-#define REG_READ_LDR2 (bitchange(0x5)|READ)
26
+#define REG_READ_LOR1 (bitchange(0x4)|READ)
27
+#define REG_READ_LOR2 (bitchange(0x5)|READ)
28 28
 #define REG_READ_DAR1 (bitchange(0x6)|READ)
29 29
 #define REG_READ_DAR2 (bitchange(0x7)|READ)
30 30
 #define REG_READ_RCR (bitchange(0x8)|READ)
31 31
 #define REG_READ_RBF (bitchange(0xe)|READ)
32 32
 
33 33
 
34
-#define LOW_ADDR 0x0
34
+#define LOW_ADDR 0x00
35 35
 #define HIGH_ADDR 0x36
36 36
 
37 37
 #define MODE 8
@@ -58,7 +58,7 @@ void iebus_loop();
58 58
 void dataWrite(char reg_addr, char *data, int datasize);
59 59
 int dataRead(char reg_addr, char *data);
60 60
 byte dataRead1byte(char addr);
61
-void dataWrite1byte(char addr , char data);
61
+void dataWrite1byte(char addr , byte data);
62 62
 
63 63
 byte READFLG;
64 64
 char data[DATASIZE] = {0x0,};
@@ -68,96 +68,250 @@ char data[DATASIZE] = {0x0,};
68 68
 
69 69
 struct _communicationFlag
70 70
 {
71
-  bool RAWF;
72
-  bool TRRQ;
73
-
74
-  byte I;
75
-  bool RERQ;
76
-  byte RECF;
77
-  byte SIZE;
78
-  byte PW;
79
-  byte PR;
80
-  byte J;
81
-  bool MCRQ;
82
-  bool SDRQ;
83
-  bool CORQ;
84
-  bool MTRQF;
85
-  bool MRRQF;
86
-  bool STRQF;
87
-  bool SLREF;
88
-  byte TRCF;
71
+    bool RAWF;
72
+    bool TRRQ;
73
+
74
+    byte I;
75
+    bool RERQ;
76
+    byte RECF;
77
+    byte SIZE;
78
+    byte PW;
79
+    byte PR;
80
+    byte J;
81
+    bool MCRQ;
82
+    bool SDRQ;
83
+    bool CORQ;
84
+    bool MTRQF;
85
+    bool MRRQF;
86
+    bool STRQF;
87
+    bool SLREF;
88
+    byte TRCF;
89 89
 } commFlag;
90 90
 
91 91
 
92
-byte inline bitchange(byte b)
93
-{
94
-  return b << 4;
95
-}
96 92
 
97 93
 
98 94
 
95
+byte  bitchange(byte b)
96
+{
97
+    byte result = 0;
98
+
99
+    //
100
+    // // Serial.print("TEST:0b");
101
+    // // Serial.print(b,BIN);
102
+    ////  
103
+    ////  //result=(bitRead(b,3))|(bitRead(b,2)<<1) |(bitRead(b,1)<<2)|(bitRead(b,0)<<3);
104
+    //if(bitRead(b,0))
105
+    //{
106
+    //  result|=0x8;
107
+    //}
108
+    //
109
+    //if(bitRead(b,1))
110
+    //{
111
+    //  result|=0x4;
112
+    //}
113
+    //
114
+    //if(bitRead(b,2))
115
+    //{
116
+    //  result|=0x2;
117
+    //}
118
+    //
119
+    //if(bitRead(b,3))
120
+    //{
121
+    //  result|=0x1;
122
+    //}
123
+    //  // | (bitRead(b,2) <<1 )| (bitRead(b,3) <<0)
124
+    //  return result;
125
+
126
+    return b<<4;
127
+}
99 128
 
100 129
 ///////////////////////////////////////////////////////////////////////////
101 130
 
102 131
 void setup (void) {
103
-  Serial.begin(9600); //set baud rate to 115200 for usart
104 132
 
105
-  SPI.begin ();
106
-  SPI.setClockDivider(SPI_CLOCK_DIV128);//divide the clock by 8
107 133
 
108
-  pinMode(MODE, OUTPUT);
109
-  pinMode(CONTROL, OUTPUT);
134
+    Serial.begin(9600); //set baud rate to 115200 for usart
110 135
 
111
-  pinMode(RESET, OUTPUT);
136
+    SPI.begin ();
137
+    SPI.setClockDivider(SPI_CLOCK_DIV128);//divide the clock by 8
138
+    SPI.setBitOrder(MSBFIRST);
139
+    SPI.setDataMode(SPI_MODE0);
140
+    // SPI.beginTransaction(SPISettings(1000, MSBFIRST, SPI_MODE0));
112 141
 
113
-  digitalWrite(MODE, HIGH);
114
-  digitalWrite(CONTROL, HIGH);
115 142
 
143
+    pinMode(MODE, OUTPUT);
144
+    pinMode(CONTROL, OUTPUT);
116 145
 
117
-  digitalWrite(RESET, HIGH);
118
-  digitalWrite(SS, LOW);
146
+    pinMode(RESET, OUTPUT);
119 147
 
120
-  iebus_init();
121
-}
148
+    digitalWrite(MODE, HIGH);
149
+    digitalWrite(CONTROL, HIGH);
150
+
151
+
152
+    digitalWrite(RESET, HIGH);
153
+    digitalWrite(SS, LOW);  
122 154
 
155
+    iebus_init();
123 156
 
157
+}
124 158
 
125 159
 
126 160
 
161
+byte  reverse_bits(byte Mitutoyo) {
162
+    byte  rtn = 0;
163
+    for (byte i=0; i<4; i++) {
164
+        bitWrite(rtn, 3-i, bitRead(Mitutoyo, i));
165
+    }
166
+    return rtn;
167
+}
168
+
127 169
 
128 170
 
129 171
 void iebus_init()
130 172
 {
131
-  digitalWrite(RESET, LOW);
132
-  delay(10);
133
-  digitalWrite(RESET, HIGH);
134
-  delay(10);
173
+    digitalWrite(RESET, LOW);
174
+    delay(10);
175
+    digitalWrite(RESET, HIGH);
176
+    delay(10);
177
+
178
+
179
+
180
+    //  dataWrite1byte(REG_WRITE_UAR1, LOW_ADDR << 4);
181
+    //  delay(500);
182
+    //
183
+    //  dataWrite1byte(REG_WRITE_UAR2, HIGH_ADDR);
184
+    //
185
+    //
186
+    //  delay(500);
187
+    //
188
+    //
189
+    //  
190
+    //  dataWrite1byte(REG_WRITE_CTR, B00000000);
191
+    //  delay(500);
192
+    //
193
+    //
194
+    //  dataWrite1byte(REG_WRITE_CMR, B01000000);
195
+    //  delay(2000);
196
+
197
+
198
+
199
+
200
+    {
201
+        Serial.print("REG_READ_STR[0b");
202
+        Serial.print(REG_READ_STR,BIN);
203
+        Serial.print("]");
204
+        Serial.print("REG_READ_STR: 0x");
205
+        byte tmp = dataRead1byte(REG_READ_STR);
206
+        Serial.println(tmp,BIN);  
207
+    }
208
+
209
+
210
+
211
+
212
+
213
+    {
214
+        Serial.print("REG_READ_FLG[0b");
215
+        Serial.print(REG_READ_FLG,BIN);
216
+        Serial.print("]");
217
+        Serial.print("REG_READ_FLG: 0x");
218
+        byte tmp = dataRead1byte(REG_READ_FLG);
219
+        Serial.println(tmp,BIN);  
220
+    }
221
+
222
+
223
+    {
224
+        Serial.print("REG_READ_LOR[0b");
225
+        Serial.print(REG_READ_LOR2,BIN);
226
+        Serial.print("]");
227
+        Serial.print("REG_READ_LOR2: 0x");
228
+        byte tmp = dataRead1byte(REG_READ_LOR2);
229
+        Serial.println(tmp,BIN);  
230
+    }
231
+
232
+
233
+    {
234
+        Serial.print("REG_READ_RCR[0b");
235
+        Serial.print(REG_READ_RCR,BIN);
236
+        Serial.print("]");
237
+        Serial.print("REG_READ_RCR: 0x");
238
+        byte tmp = dataRead1byte(REG_READ_RCR);
239
+        Serial.println(tmp,BIN);  
240
+    }
241
+
242
+    Serial.println("=====================================================");  
243
+    dataWrite1byte(REG_WRITE_CTR,0b00000001); //Enter stanby mode
244
+    delay(100);
245
+    dataWrite1byte(REG_WRITE_CTR,0b00000000); //Exits from standby mode
246
+    delay(100);
247
+    dataWrite1byte(REG_WRITE_CTR,0b00010000); //set REENs 
248
+    delay(100);
249
+    dataWrite1byte(REG_WRITE_CMR,0b01000000); //Lock
250
+    delay(100);
251
+    {
252
+        Serial.print("REG_READ_STR[0b");
253
+        Serial.print(REG_READ_STR,BIN);
254
+        Serial.print("]");
255
+        Serial.print("REG_READ_STR: 0x");
256
+        byte tmp = dataRead1byte(REG_READ_STR);
257
+        Serial.println(tmp,BIN);  
258
+    }
259
+
260
+
261
+
262
+
263
+
264
+    {
265
+        Serial.print("REG_READ_FLG[0b");
266
+        Serial.print(REG_READ_FLG,BIN);
267
+        Serial.print("]");
268
+        Serial.print("REG_READ_FLG: 0x");
269
+        byte tmp = dataRead1byte(REG_READ_FLG);
270
+        Serial.println(tmp,BIN);  
271
+    }
272
+
273
+
274
+    {
275
+        Serial.print("REG_READ_LOR[0b");
276
+        Serial.print(REG_READ_LOR2,BIN);
277
+        Serial.print("]");
278
+        Serial.print("REG_READ_LOR2: 0x");
279
+        byte tmp = dataRead1byte(REG_READ_LOR2);
280
+        Serial.println(tmp,BIN);  
281
+    }
282
+
283
+
284
+    {
285
+        Serial.print("REG_READ_RCR[0b");
286
+        Serial.print(REG_READ_RCR,BIN);
287
+        Serial.print("]");
288
+        Serial.print("REG_READ_RCR: 0x");
289
+        byte tmp = dataRead1byte(REG_READ_RCR);
290
+        Serial.println(tmp,BIN);  
291
+    }
135 292
 
136
-  dataWrite1byte(REG_WRITE_UAR1, LOW_ADDR << 4);
137
-  dataWrite1byte(REG_WRITE_UAR2, HIGH_ADDR);
138
-  dataWrite1byte(REG_WRITE_CMR, B10000000); //CMR 100000 b1 b0
139 293
 
140
-  flaginit();
141
-  pinMode(iebusIRQ, INPUT_PULLUP);
294
+    //pinMode(iebusIRQ, INPUT_PULLUP);
295
+    // attachInterrupt(digitalPinToInterrupt(iebusIRQ), iebus_irq, RISING);
142 296
 
143
-  attachInterrupt(digitalPinToInterrupt(iebusIRQ), iebus_irq, RISING);
297
+    flaginit();
144 298
 }
145 299
 void flaginit()
146 300
 {
147
-  commFlag.RAWF = 0;
148
-  commFlag.TRRQ = 0;
149
-  commFlag.RERQ = 0;
150
-  commFlag.SIZE = 0;
151
-  commFlag.J = 1;
152
-  commFlag.PW = 0;
153
-  commFlag.PR = 0;
154
-  commFlag.MCRQ = 0;
155
-  commFlag.SDRQ = 0;
156
-  commFlag.CORQ = 0;
157
-  commFlag.MTRQF = 0;
158
-  commFlag.MRRQF = 0;
159
-  commFlag.STRQF = 0;
160
-  commFlag.SLREF = 0;
301
+    commFlag.RAWF = 0;
302
+    commFlag.TRRQ = 0;
303
+    commFlag.RERQ = 0;
304
+    commFlag.SIZE = 0;
305
+    commFlag.J = 1;
306
+    commFlag.PW = 0;
307
+    commFlag.PR = 0;
308
+    commFlag.MCRQ = 0;
309
+    commFlag.SDRQ = 0;
310
+    commFlag.CORQ = 0;
311
+    commFlag.MTRQF = 0;
312
+    commFlag.MRRQF = 0;
313
+    commFlag.STRQF = 0;
314
+    commFlag.SLREF = 0;
161 315
 
162 316
 
163 317
 }
@@ -180,191 +334,231 @@ void iebus_slavetransmission()
180 334
 {
181 335
 
182 336
 }
337
+
338
+
183 339
 void iebus_command()
184 340
 {
341
+    while((READFLG = dataRead1byte(REG_READ_FLG))&0x8);
342
+    dataWrite1byte(REG_WRITE_CMR, 0b00010000);
185 343
 
186
-}
187
-
344
+    //CMR command code
188 345
 
189
-int checkMARC()
190
-{
191
-  byte rcrdata = 0xf0 & dataRead1byte(REG_READ_RCR);
192
-  int  isResult = 0;
193
-  if (bitRead(rcrdata, 7) == 0 && bitRead(rcrdata, 6) == 0)
194
-  {
195
-    isResult = 1;
196
-  }
197
-  else if (bitRead(rcrdata, 7) == 0 && bitRead(rcrdata, 6) == 1 && bitRead(rcrdata, 5) == 0)
198
-  {
199
-    isResult = 2;
200
-  }
201
-  else if (bitRead(rcrdata, 7) == 0 && bitRead(rcrdata, 6) == 1 && bitRead(rcrdata, 5) == 1)
202
-  {
203
-    isResult = 3;
204
-  }
205
-  else
206
-  {
207
-    isResult = 0;
208
-  }
209
-
210
-  return isResult;
211 346
 }
212 347
 
213 348
 
214 349
 
215 350
 void iebus_irq()
216 351
 {
217
-  byte marcValue;
218
-  noInterrupts();
219
-  READFLG = dataRead1byte(REG_READ_FLG);
220
-  if (isRAW)
221
-  {
222
-    commFlag.RAWF = 1;
223
-  }
224
-  else
225
-  {
226
-    marcValue = checkMARC();
227
-    if ((commFlag.MTRQF == 1 && isMARQ == 0) || (commFlag.MRRQF == 1 && isMARQ == 0) || (marcValue > 0))
228
-    {
229
-      Serial.println("MARC");
230
-      if (marcValue == 1)
231
-      {
232
-        //00xx
233
-        commFlag.TRCF = marcValue>>4;
234
-        commFlag.TRRQ = 1;
235
-      }
236
-      else if (marcValue == 2)
237
-      {
238
-        //010x
239
-        commFlag.RERQ = 1;
240
-        commFlag.SIZE = dataRead1byte(REG_READ_RDR1);
241
-        commFlag.RECF = marcValue>>4;
242
-      }
243
-      else if (isMarc == 3)
244
-      {
245
-        //011x
246
-        commFlag.RERQ = 1;
247
-        commFlag.SIZE = dataRead1byte(REG_READ_RDR1);
248
-        commFlag.RECF = marcValue>>4;
249
-
250
-        //increment PW
251
-        commFlag.RERQ = 0;
252
-        commFlag.SIZE = 0;
352
+    noInterrupts();
253 353
 
254
-      }
255 354
 
355
+    interrupts();
356
+}
256 357
 
257 358
 
258
-      //is Return code in slrc
359
+void iebus_irq2()
360
+{
361
+    byte registerRCR;
362
+    noInterrupts();
363
+    READFLG = dataRead1byte(REG_READ_FLG);
364
+    if (isRAW) // Program Crash?
365
+    {
366
+        commFlag.RAWF = 1;
259 367
     }
260
-  }
261
-  interrupts();
368
+    else
369
+    {
370
+        //Read RCR
371
+        registerRCR = dataRead1byte(REG_READ_RCR);
372
+        byte MARC = (registerRCR>>4)&0xf;
373
+        byte SLRC = registerRCR&0x0f;
374
+
375
+        //is return MARC Enabled
376
+        if(bitRead(MARC,3)==0&&bitRead(MARC,2)==0)
377
+        {
378
+            //00xx
379
+            commFlag.TRCF=MARC;
380
+            commFlag.TRRQ=true;
381
+
382
+        }
383
+        else      if(bitRead(MARC,3)==0&&bitRead(MARC,2)==1 &&bitRead(MARC,1)==0)
384
+        {
385
+            ////010x
386
+            commFlag.RERQ=true;
387
+            commFlag.SIZE=dataRead1byte(REG_READ_RDR1);
388
+            commFlag.RECF = MARC;
389
+
390
+        }
391
+
392
+        else     if(bitRead(MARC,3)==0&&bitRead(MARC,2)==1 &&bitRead(MARC,1)==1)
393
+        {
394
+            //011x
395
+            commFlag.RERQ=true;
396
+            commFlag.SIZE=dataRead1byte(REG_READ_RDR1);
397
+            commFlag.RECF = MARC;
398
+            commFlag.PW++;
399
+
400
+            commFlag.RERQ=false;
401
+            commFlag.SIZE=0;
402
+        }
403
+
404
+        else
405
+        {
406
+            Serial.print("MARC Disabled");
407
+
408
+        }
409
+
410
+
411
+        //is return SLRC Enabled
412
+        if(bitRead(SLRC,3)==0&&bitRead(SLRC,2)==0)
413
+        {
414
+            //00xx
415
+            commFlag.TRCF=SLRC;
416
+            commFlag.TRRQ=true;
417
+
418
+        }
419
+
420
+        else if((bitRead(SLRC,3)==0&&bitRead(SLRC,2)==1 &&bitRead(SLRC,1)==0)|(bitRead(SLRC,3)==1&&bitRead(SLRC,2)==0 &&bitRead(SLRC,1)==0))
421
+        {
422
+            //010x, 100x
423
+            commFlag.RERQ=true;
424
+            commFlag.SIZE=dataRead1byte(REG_READ_RDR2);
425
+            commFlag.RECF = SLRC;
426
+
427
+        }
428
+        else if((bitRead(SLRC,3)==0&&bitRead(SLRC,2)==1 &&bitRead(SLRC,1)==1)|(bitRead(SLRC,3)==1&&bitRead(SLRC,2)==0 &&bitRead(SLRC,1)==1))
429
+        {
430
+            //011x
431
+            commFlag.RERQ=true;
432
+            commFlag.SIZE=dataRead1byte(REG_READ_RDR2);
433
+            commFlag.RECF = SLRC;
434
+            //REEN 1
435
+            dataWrite1byte(REG_WRITE_CTR, 0b00010000);
436
+
437
+            commFlag.RERQ=false;
438
+            commFlag.SIZE=0;
439
+        }
440
+
441
+
442
+    }
443
+    interrupts();
262 444
 }
263 445
 
264 446
 void iebus_loop()
265 447
 {
266
-  if (commFlag.RAWF == 1)
267
-  {
268
-    iebus_init();
269
-    return;
270
-  }
271 448
 
272
-  if (commFlag.TRRQ == 1)
273
-  {
274
-    iebus_transmission();
275
-    commFlag.TRRQ = 0;
276
-  }
277
-  if (commFlag.RERQ == 1)
278
-  {
279
-    iebus_reception();
280
-    commFlag.RERQ = 0;
281
-  }
449
+    if (commFlag.RAWF == 1)
450
+    {
451
+        iebus_init();
282 452
 
283
-  if (commFlag.MCRQ == 1)
284
-  {
285
-    iebus_mastercomm();
286
-    commFlag.MCRQ = 0;
287
-  }
453
+    }
288 454
 
289
-  if (commFlag.SDRQ == 1)
290
-  {
291
-    iebus_slavetransmission();
292
-    commFlag.SDRQ = 0;
293
-  }
455
+    if (commFlag.TRRQ == 1)
456
+    {
457
+        iebus_transmission();
458
+        commFlag.TRRQ = 0;
459
+    }
460
+    if (commFlag.RERQ == 1)
461
+    {
462
+        iebus_reception();
463
+        commFlag.RERQ = 0;
464
+    }
294 465
 
295
-  if (commFlag.CORQ == 1)
296
-  {
297
-    iebus_command();
298
-    commFlag.CORQ = 0;
299
-  }
466
+    if (commFlag.MCRQ == 1)
467
+    {
468
+        iebus_mastercomm();
469
+        commFlag.MCRQ = 0;
470
+    }
471
+
472
+    if (commFlag.SDRQ == 1)
473
+    {
474
+        iebus_slavetransmission();
475
+        commFlag.SDRQ = 0;
476
+    }
477
+
478
+    if (commFlag.CORQ == 1)
479
+    {
480
+        iebus_command();
481
+        commFlag.CORQ = 0;
482
+    }
300 483
 
301 484
 }
302 485
 void dataWrite(char reg_addr, char *data, int datasize)
303 486
 {
304
-  //data
305
-  for (int i = 0; i < datasize; i++)
306
-  {
487
+    //data
488
+    for (int i = 0; i < datasize; i++)
489
+    {
307 490
 
308
-  }
491
+    }
309 492
 }
310 493
 
311 494
 int dataRead(char reg_addr, char *data)
312 495
 {
313
-  int size = 0;
496
+    int size = 0;
314 497
 
315
-  return size;
498
+    return size;
316 499
 }
317 500
 
318 501
 byte dataRead1byte(char addr)
319 502
 {
320
-  byte data;
321
-  // write the LTC CS pin low to initiate ADC sample and data transmit
322
-  digitalWrite(CONTROL, HIGH);
323
-  delay(5);
324
-  SPI.transfer(REG_READ_FLG); // Register Select
325
-
326
-  digitalWrite(CONTROL, LOW);
327
-  delay(5);
328
-  data = SPI.transfer(0x0); // read second 8 bits
329
-  //  Serial.println(data); //0x2
330
-
331
-  return data;
503
+    byte data;
504
+    // write the LTC CS pin low to initiate ADC sample and data transmit
505
+    digitalWrite(CONTROL, HIGH);
506
+
507
+
508
+    //Serial.println(addr&0xff,HEX);
509
+
510
+    SPI.transfer(addr&0xf8); // Register Select
511
+
512
+    digitalWrite(CONTROL, LOW);
513
+
514
+    data = SPI.transfer(0xff); // read second 8 bits
515
+    //  Serial.println(data); //0x2
516
+    digitalWrite(CONTROL, HIGH);
517
+    return (data);
332 518
 }
333 519
 
334 520
 
335
-void dataWrite1byte(char addr , char data)
521
+void dataWrite1byte(char addr , byte data)
336 522
 {
337
-  digitalWrite(CONTROL, HIGH);
338
-  delay(5);
339
-  SPI.transfer(addr); // Register Select
340 523
 
341
-  digitalWrite(CONTROL, LOW);
342
-  delay(5);
343
-  SPI.transfer(data); // read second 8 bits
344
-  delay(5);
524
+    // write the LTC CS pin low to initiate ADC sample and data transmit
525
+    digitalWrite(CONTROL, HIGH);
345 526
 
346
-}
347 527
 
528
+    //Serial.println(addr&0xff,HEX);
348 529
 
349
-void loop (void) {
350
-  iebus_loop();
530
+    SPI.transfer(addr&0xf0); // Register Select
531
+
532
+    digitalWrite(CONTROL, LOW);
533
+    Serial.print("sending:");
534
+    Serial.println(data,HEX);
535
+    SPI.transfer(data); // read second 8 bits
536
+    //  Serial.println(data); //0x2
537
+    digitalWrite(CONTROL, HIGH);
538
+}
351 539
 
352 540
 
541
+void loop (void) {
353 542
 
354 543
 
355
-  byte addr = 0x0;
356
-  byte data;
544
+    byte addr = 0x0;
545
+    byte data;
357 546
 
358
-  //  SPI.beginTransaction(SPISettings(1000, MSBFIRST, SPI_MODE0));
359
-  // set speed bit format and clock/data polarity while starting SPI transaction
360 547
 
361
-  Serial.println(dataRead1byte(REG_READ_FLG));
548
+    //  Serial.print("0b");
549
+    // data = dataRead1byte(READ);
550
+    //  Serial.println( data,BIN);
551
+    //
552
+    //
553
+    //  Serial.print("0b");
554
+    //  data = dataRead1byte(READ);
555
+    //  Serial.println( data,BIN);
362 556
 
363
-  // wite LTC CS pin high to stop LTC from transmitting zeros.
364
-  // SPI.endTransaction();
365
-  // close SPI transaction
366
-  delay(250);
367
-  // Delay that is fast but easy to read.
368
-  //  delayMicroseconds(83);
369
-  // Delay that matches 12 khz delay time.
557
+    // wite LTC CS pin high to stop LTC from transmitting zeros.
558
+    // SPI.endTransaction();
559
+    // close SPI transaction
560
+    delay(2500);
561
+    // Delay that is fast but easy to read.
562
+    //  delayMicroseconds(83);
563
+    // Delay that matches 12 khz delay time.
370 564
 }