Example #1
0
void ht1621WrData(uint8_t data, uint8_t count)
{
  while (count) {
    WR_LOW();
    if (data & 0x80)
      DATA_HIGH();
    else
      DATA_LOW();
    delay1_7us();
    WR_HIGH();
    delay1_7us();
    data <<= 1;
    count -= 1;
  }
}
Example #2
0
void ht1621WrAllData(uint8_t chip, uint8_t *pData)
{
  int len;
  if (chip) {
    len = sizeof(Ht1621Data2);
    CS2_LOW();
  }
  else {
    len = sizeof(Ht1621Data1);
    CS1_LOW();
  }
  delay1_7us();
  ht1621WrData(0xa0, 3);
  ht1621WrData(0, 6); // HT1621 6 bit,left 2 bit;
  for (int i=0; i<len; i++) {
    ht1621WrData(*pData++, 8);
  }
  if (chip)
    CS2_HIGH();
  else
    CS1_HIGH();
  delay1_7us();
}
Example #3
0
void ht1621SendCommand(uint8_t chip, unsigned char command)
{
  if (chip)
    CS2_LOW();
  else
    CS1_LOW();

  delay1_7us();
  WR_LOW();      //PRESENT 100 COMMAND CODE
  delay1_7us();
  DATA_HIGH();
  delay1_7us();
  WR_HIGH();
  delay1_7us();
  WR_LOW();
  delay1_7us();
  DATA_LOW();
  delay1_7us();
  WR_HIGH();
  delay1_7us();

  WR_LOW();
  delay1_7us();
  DATA_LOW();
  delay1_7us();
  WR_HIGH();
  delay1_7us();

  for (int i=0; i<8; i++) {
    WR_LOW();
    delay1_7us();
    if ((command & 0x80) !=0) {
      DATA_HIGH();
      delay1_7us();
    }
    else {
      DATA_LOW();
      delay1_7us();
    }
    WR_HIGH();
    delay1_7us();
    command = command << 1;
  }
  WR_LOW();
  delay1_7us();
  WR_HIGH();
  delay1_7us();

  if (chip)
    CS2_HIGH();
  else
    CS1_HIGH();

  delay1_7us();
}
Example #4
0
void sendToplcdCommand( uint8_t command, uint8_t chip )
{
  uint32_t i ;
    
	WR_HIGH;
	if ( chip	) CS2_LOW ; else CS1_LOW ;
	delay1_7us() ;
	WR_LOW ;      //PRESENT 100 COMMAND CODE 
	DATA_HIGH ;
	delay1_7us() ;
	WR_HIGH ;
	delay1_7us() ;
	WR_LOW ;
	DATA_LOW ;
	delay1_7us() ;
	WR_HIGH ;
	delay1_7us() ;
	WR_LOW ;
	delay1_7us() ;
	WR_HIGH ;
	delay1_7us() ;
	for (i =0;i<=7;i++) 
	{
		WR_LOW ;
		if ((command & 0x80) !=0)  
		{
	    DATA_HIGH ;
		}
		else 
		{
			DATA_LOW ;
		}
		delay1_7us() ;
		WR_HIGH ;
		delay1_7us() ;
		command = command << 1 ;
	}
	WR_LOW ;
	delay1_7us() ;
	WR_HIGH ;
	delay1_7us() ;
	if ( chip	) CS2_HIGH ; else CS1_HIGH ;
	delay1_7us() ;
}