Ejemplo n.º 1
0
//電流を表示する
//引数:	0.1mA単位の値
void	lcdPutCurrent(int16_t mValue, int xPos, int yPos)
{
	uint16_t	num, dec;
	
	lcdLineClear(xPos, yPos);
	lcdSetPos(xPos * 8, yPos);
	
	// 符号の表示
	if (mValue < 0)
		lcdPutChar('-');
	else
		lcdPutChar(' ');
	
	num = abs(mValue) / 10;	//整数部
	dec = abs(mValue) % 10;	//小数部
	
	//100mA未満は小数第1位まで表示
	//100mA以上は整数部のみ表示(小数点以下は切り捨て)
	//[99.9][100]mAが境目
	if (num < 100)
	{
		if (num < 10) lcdPutChar(' ');
		lcdPutUInt(num);
		lcdPutChar('.');
		lcdPutUInt(dec);
	}
	else
	{
		if (num < 1000) lcdPutChar(' ');
		lcdPutUInt(num);
	}
	
	lcdPutStr("mA");
}
Ejemplo n.º 2
0
void lcdSetBackgroundLight(uint8_t status) {
	lcdPutChar(27);
	lcdPutChar(76);
	if (status == 0) {
		lcdPutChar(0);
	} else {
		lcdPutChar(1);
	}
}
Ejemplo n.º 3
0
int fputc(int c, FILE *stream)
{
   //Standard output?
   if(stream == stdout)
   {
      //Display current character
      lcdPutChar(c);

      return c;
   }
   //Standard error output?
   else if(stream == stderr)
   {
      //Wait for the transmitter to be ready
      while(!(AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_TXEMPTY));

      //Send character
      AT91C_BASE_DBGU->DBGU_THR = c;

      //Wait for the transfer to complete
      while(!(AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_TXEMPTY));

      return c;
   }
   //Unknown output
   else
   {
      return EOF;
   }
}
Ejemplo n.º 4
0
int_t fputc(int_t c, FILE *stream)
{
   //Standard output?
   if(stream == stdout)
   {
      //Display current character
      lcdPutChar(c);

      //On success, the character written is returned
      return c;
   }
   //Standard error output?
   else if(stream == stderr)
   {
      //Wait for the transmitter to be ready
      while(!(LPC_UART0->LSR & LSR_THRE));
      //Send character
      LPC_UART0->THR = c;
      //Wait for the transfer to complete
      while(!(LPC_UART0->LSR & LSR_TEMT));

      //On success, the character written is returned
      return c;
   }
   //Unknown output?
   else
   {
      //If a writing error occurs, EOF is returned
      return EOF;
   }
}
Ejemplo n.º 5
0
int_t fputc(int_t c, FILE *stream)
{
   //Standard output?
   if(stream == stdout)
   {
      //Display current character
      lcdPutChar(c);

      //On success, the character written is returned
      return c;
   }
   //Standard error output?
   else if(stream == stderr)
   {
      //Wait for the transmitter to be ready
      while(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET);
      //Send character
      USART_SendData(USART2, c);
      //Wait for the transfer to complete
      while(USART_GetFlagStatus(USART2, USART_FLAG_TC) == RESET);

      //On success, the character written is returned
      return c;
   }
   //Unknown output?
   else
   {
      //If a writing error occurs, EOF is returned
      return EOF;
   }
}
Ejemplo n.º 6
0
int_t fputc(int_t c, FILE *stream)
{
   //Standard output?
   if(stream == stdout)
   {
      //Display current character
      lcdPutChar(c);

      //On success, the character written is returned
      return c;
   }
   //Standard error output?
   else if(stream == stderr)
   {
      //Character to be written
      uint8_t ch = c;

      //Transmit data
      HAL_UART_Transmit(&UART_Handle, &ch, 1, HAL_MAX_DELAY);

      //On success, the character written is returned
      return c;
   }
   //Unknown output?
   else
   {
      //If a writing error occurs, EOF is returned
      return EOF;
   }
}
Ejemplo n.º 7
0
int_t fputc(int_t c, FILE *stream)
{
   //Standard output?
   if(stream == stdout)
   {
      //Display current character
      lcdPutChar(c);

      return c;
   }
   //Standard error output?
   else if(stream == stderr)
   {
      //Wait for the transmitter to be ready
      while(!(USART6->SR & USART_SR_TXE));

      //Send character
      USART6->DR = c;

      //Wait for the transfer to complete
      while(!(USART6->SR & USART_SR_TC));

      return c;
   }
   //Unknown output?
   else
   {
      return EOF;
   }
}
Ejemplo n.º 8
0
int_t fputc(int_t c, FILE *stream)
{
   //Standard output?
   if(stream == stdout)
   {
      //Display current character
      lcdPutChar(c);

      //On success, the character written is returned
      return c;
   }
   //Standard error output?
   else if(stream == stderr)
   {
      //Wait for the transmitter to be ready
      while(!SCI2.SSR.BIT.TEND);
      //Send character
      SCI2.TDR = c;
      //Wait for the transfer to complete
      while(!SCI2.SSR.BIT.TEND);

      //On success, the character written is returned
      return c;
   }
   //Unknown output?
   else
   {
      //If a writing error occurs, EOF is returned
      return EOF;
   }
}
Ejemplo n.º 9
0
int_t fputc(int_t c, FILE *stream)
{
   //Standard output?
   if(stream == stdout)
   {
      //Display current character
      lcdPutChar(c);

      //On success, the character written is returned
      return c;
   }
   //Standard error output?
   else if(stream == stderr)
   {
      //Wait for the transmit FIFO to be available for writing
      while(!(SCIF2.SCFSR.WORD & SCIF2_SCFSR_TDFE));
      //Send character
      SCIF2.SCFTDR.BYTE = c;
      //Clear TDFE flag
      SCIF2.SCFSR.WORD &= ~SCIF2_SCFSR_TDFE;

      //On success, the character written is returned
      return c;
   }
   //Unknown output?
   else
   {
      //If a writing error occurs, EOF is returned
      return EOF;
   }
}
Ejemplo n.º 10
0
//電圧を表示する
//引数:	mV単位の値
void	lcdPutVoltage(int16_t mValue, int xPos, int yPos)
{
	uint16_t num, dec;

	lcdLineClear(xPos, yPos);
	lcdSetPos(xPos * 8, yPos);	
	
	// 符号の表示
	if (mValue < 0)
		lcdPutChar('-');
	else
		lcdPutChar(' ');
		
	num = abs(mValue) / 1000;	//整数部
	dec = abs(mValue) % 1000;	//小数部
	
	/*
	//10mV未満は小数第2位まで表示(小数第3位以下は切り捨て)
	//10mV以上は小数第1位まで表示(小数第2位以下は切り捨て)
	//[9.99][10.0]mVが境目
	
	if (num < 10)
	{
	*/
		if (num < 10)
			lcdPutChar(' ');
		lcdPutUInt(num);
		lcdPutChar('.');
		//小数部3桁中2桁表示(3桁目は切り捨て)
		dec /= 10;
		if (dec < 10) lcdPutChar('0');
		lcdPutUInt(dec);
	/*
	}
	else
	{
		lcdPutUInt(num);
		lcdPutChar('.');
		//小数部3桁中1桁表示(2桁目以降は切り捨て)
		lcdPutUInt(dec / 1000);
	}
	*/
	
	lcdPutStr("V");
}
Ejemplo n.º 11
0
void lcdInit() {
	lcdPutChar(12); // Clear display
	lcdPutChar(27); // Command Mode
	lcdPutChar(79); // Set cursor position
	lcdPutChar(1); // x (1...20)
	lcdPutChar(1); // y (1...4)
	lcdPutChar(27); // Command Mode again
	lcdPutChar(123); // Clear key buffer
	lcdSetBackgroundLight(1);
}
Ejemplo n.º 12
0
void	lcdPutUInt(uint16_t n)
{
	uint8_t	i = 0;
	
	do
	{
		kbuf[i++] = n % 10;
		n /= 10;
	}
	while (0 < n);
	
	while (i != 0)
		lcdPutChar('0' + kbuf[--i]);
}