Post Go back to editing

ADAS1000: some wrong about data frames. B0,0,0,0,11,7D,9C,7D,11,7D,9C,7D,11,7D,9C,7D,11,7D,9C,7D,11,7D,9C,7D 五个通道信号出来竟然一样的。

B0,0,0,0,11,7D,9C,7D,11,7D,9C,7D,11,7D,9C,7D,11,7D,9C,7D,11,7D,9C,7D

B0,0,0,0,11,7D,9C,5E,11,7D,9C,5E,11,7D,9C,5E,11,7D,9C,5E,11,7D,9C,5E

 ADAS1000WriteRegister(DID_ADAS1000_M,ADAS1000_FRMCTL, 0x8A079600);
 //Configure VCM = WCT = (LA+LL+RA)/3. RLD is enabled onto RL, Shield amplifier enabled.
 ADAS1000WriteRegister(DID_ADAS1000_M, ADAS1000_CMREFCTL, 0x85E0000B);
 //150Hz sinewave put onto each electrode.
 // ADAS1000WriteRegister(DID_ADAS1000_M, ADAS1000_TESTTONE, 0x88F80007);
 //Change internal LPF to 250Hz
 // ADAS1000WriteRegister(DID_ADAS1000_M, ADAS1000_FILTCTL, 0x8B000000);//40HZ 
 ADAS1000WriteRegister(DID_ADAS1000_M, ADAS1000_FILTCTL, 0x8B000002);//150HZ 
 // ADAS1000WriteRegister(DID_ADAS1000_M, ADAS1000_FILTCTL, 0x8B000004);//250HZ 
 // ADAS1000WriteRegister(DID_ADAS1000_M, ADAS1000_FILTCTL, 0x8B000006);//450HZ 
 //Powers up device, enables all ECG channels in gain 1.4,
 //low noise mode, Master device using XTAL input source 差分输入 2.8增益
 ADAS1000WriteRegister(DID_ADAS1000_M, ADAS1000_ECGCTL,   0x81F806BE);

I ,II,II,V1,V2, have same signal!!

五个通道信号出来竟然一样的。

 
void ADAS1000_ReadFrame(unsigned char Did,unsigned char* pDataBuffer, 
												unsigned int frameCnt,unsigned char startRead, 
												unsigned char stopRead, unsigned char waitForReady, 
												unsigned char readyRepeat)
{
	unsigned char readCmd[4]	= {0, 0, 0, 0};
	unsigned int ready = 0;
  Device_x device_x;
	
	if(Did==DID_ADAS1000_S)
	{
		device_x = Device_Salver;
   
	}else {
		device_x = Device_Master;
	}
	// If the read sequence must be started send a FRAMES command.
	if(startRead)
	{
    readCmd[0] = ADAS1000_FRAMES;	// Register address.
 		SPI_Write(device_x,readCmd, 4);
	}
//  printf("frameSize=%d",frameSize);
	// Read the number of requested frames.
	while(frameCnt)
	{
		// If waiting for the READY bit to be set read the header until the bit is set, otherwise just read the entire frame.
		if(waitForReady)
		{
			ready = 1;
			while(ready == 1)
			{
				//if the header is repeated until the READY bit is set read only the header, otherwise read the entire frame
				if(readyRepeat)
				{
					SPI_Read(device_x,pDataBuffer,4);
					ready = *pDataBuffer & 0x40;
					if(ready == 0)
					{
						SPI_Read(device_x,pDataBuffer + 4, frameSize - 4);
						pDataBuffer += frameSize;
						frameCnt--;
					}
				}
				else
				{
					SPI_Read(device_x,pDataBuffer, frameSize);
					ready = *pDataBuffer & 0x40;
					if(ready == 0)
					{
						pDataBuffer += frameSize;			
						frameCnt--;
					}
				}
			}
		}
		else
		{
			SPI_Read(device_x,pDataBuffer, frameSize);
			pDataBuffer += frameSize;			
			frameCnt--;
		}
	}

	// If the frames read sequence must be stopped read a register to stop the frames read.
	if(stopRead)
	{
		ADAS1000ReadRegister(Did,ADAS1000_FRMCTL, &ready);
	}
}
 
Parents Reply Children
No Data