808

Dependents:   Chromatograph_Mobile

Committer:
nikmaos
Date:
Tue Aug 11 19:12:58 2020 +0000
Revision:
2:09948f1c22bc
Parent:
1:b456fe5494fe
Child:
3:fe564cf39107
1108;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vitlog 0:4ca9c83d7e14 1 #include "LT1446.h"
vitlog 0:4ca9c83d7e14 2 //повторное объявление из-за использования внешней переменной и ошибки множественного объявления
vitlog 0:4ca9c83d7e14 3 LT1446_MEM_t LT1446_MEM;
vitlog 0:4ca9c83d7e14 4 //экземпляр по умолчанию
vitlog 0:4ca9c83d7e14 5 LT1446_t LT1446_0;
vitlog 0:4ca9c83d7e14 6
vitlog 0:4ca9c83d7e14 7 void LT1446_CalibrateCh(LT1446_Calibr_t *dac,float k, float b)
vitlog 0:4ca9c83d7e14 8 {
vitlog 0:4ca9c83d7e14 9 dac->k=k;
vitlog 0:4ca9c83d7e14 10 dac->b=b;
vitlog 0:4ca9c83d7e14 11 }
vitlog 0:4ca9c83d7e14 12 //Вычислить значение для передачи в ЦАП
vitlog 0:4ca9c83d7e14 13 void LT1446_CalculateCh(LT1446_Calibr_t *dac)
vitlog 0:4ca9c83d7e14 14 {
vitlog 0:4ca9c83d7e14 15 dac->Code=(uint16_t)(dac->k*dac->Volts+dac->b);
vitlog 0:4ca9c83d7e14 16 if (dac->Code>4095) dac->Code=4095;
vitlog 0:4ca9c83d7e14 17 }
vitlog 0:4ca9c83d7e14 18
vitlog 0:4ca9c83d7e14 19 void LT1446_Write(LT1446_t *chip)
vitlog 0:4ca9c83d7e14 20 {
vitlog 0:4ca9c83d7e14 21
vitlog 0:4ca9c83d7e14 22
vitlog 0:4ca9c83d7e14 23 LT1446_MEM.DACA=chip->dacA.Code;
vitlog 0:4ca9c83d7e14 24 LT1446_MEM.DACB=chip->dacB.Code;
vitlog 0:4ca9c83d7e14 25 Cs=0;
nikmaos 2:09948f1c22bc 26 TED2.write(LT1446_MEM.b3);
vitlog 0:4ca9c83d7e14 27 TED2.write(LT1446_MEM.b2);
nikmaos 2:09948f1c22bc 28 TED2.write(LT1446_MEM.b1);
vitlog 0:4ca9c83d7e14 29 Cs=1;
vitlog 0:4ca9c83d7e14 30 }
nikmaos 1:b456fe5494fe 31 void LTCwrite(LT1446_t *chip)
nikmaos 1:b456fe5494fe 32 {
nikmaos 1:b456fe5494fe 33 Cs=0;
nikmaos 1:b456fe5494fe 34 CLK=0;
nikmaos 1:b456fe5494fe 35 /*Записываем канал B*/
nikmaos 1:b456fe5494fe 36 uint8_t b=12;
nikmaos 1:b456fe5494fe 37 while(b--)
nikmaos 1:b456fe5494fe 38 {
nikmaos 1:b456fe5494fe 39 DOUT=chip->dacB.Code&(1<<b);
nikmaos 1:b456fe5494fe 40 CLK=1;
nikmaos 1:b456fe5494fe 41 DOUT=0;
nikmaos 2:09948f1c22bc 42 CLK=0;
nikmaos 1:b456fe5494fe 43 }
nikmaos 1:b456fe5494fe 44 /*Канал А */
nikmaos 1:b456fe5494fe 45 b=12;
nikmaos 1:b456fe5494fe 46 while(b--)
nikmaos 1:b456fe5494fe 47 {
nikmaos 1:b456fe5494fe 48 DOUT=chip->dacA.Code&(1<<b);
nikmaos 1:b456fe5494fe 49 CLK=1;
nikmaos 1:b456fe5494fe 50 DOUT=0;
nikmaos 1:b456fe5494fe 51 CLK=0;
nikmaos 1:b456fe5494fe 52 }
nikmaos 2:09948f1c22bc 53 Cs=1;
nikmaos 1:b456fe5494fe 54 }
vitlog 0:4ca9c83d7e14 55
vitlog 0:4ca9c83d7e14 56
vitlog 0:4ca9c83d7e14 57