Exemple #1
0
void lcd_send_byte(unsigned char byte)
{
    unsigned char i, temp;


    temp = byte;

    for(i = 0; i < 8; i++)
    {
        LCD_SCK_LOW();

        if(temp & 0x80)
        {
            LCD_MOSI_HIGH();
        }
        else
        {
            LCD_MOSI_LOW();
        }

        LCD_SCK_HIGH();

        temp <<= 1;
    }
}
Exemple #2
0
static void Initialize_SPI(void)
{
    // Initialize SPI Interface pins as GPIOs
    LCD_MOSI_MAKE_OUT();
    LCD_SCK_MAKE_OUT();

    LCD_SCK_HIGH();
    LCD_MOSI_HIGH()
}
Exemple #3
0
/** Transfer data to a slave (MSB first)
 *
 * @param sck the pin to use for the SCK output
 * @param mosi the pin to use for the MOSI output
 * @param data the data to transfer
 * @param bits the number of bits to transfer
 */
void sspiOutMSB(uint8_t data) {
  uint8_t bit;
  for(bit = 0x80; bit; bit >>= 1) {
    // Bring the clock low
    LCD_SCK_LOW();
    // Set data
    if(data & bit) {
      LCD_MOSI_HIGH();
    } else {
      LCD_MOSI_LOW();
    }
    // Bring the clock high
    LCD_SCK_HIGH();
  }
}
Exemple #4
0
void LCD_SendByte(unsigned char a)
{
	unsigned char i,d;
	LCD_CS_HIGH();
	LCD_SIO_OUT();
	for(i=0;i<8;i++)
	{
		LCD_SCK_LOW();  //clrbit(LCD_CTRL,E);  
		d = a&0x80;
		if(d)
			LCD_SIO_HIGH();	//setbit(LCD_CTRL,RW);
		else
			LCD_SIO_LOW();	//clrbit(LCD_CTRL,RW);
		a<<=1;
		LCD_SCK_HIGH();  //setbit(LCD_CTRL,E); //上升弦发送
	}
	LCD_CS_LOW();
}