EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / Hi,I’m posting the following

Hi,I’m posting the following

|

Microcontroller › 8051 › gsm module interface › Hi,I’m posting the following

February 18, 2013 at 6:17 pm #9155
AJISH ALFRED
Participant

Hi,

I’m posting the following code just to show you how can we make use of the printf function in microcontroller coding. The uart_print () code has been written for AVR actually, but you can refer the file initialization and the function prototype.

 

//===============================================================//

 

FILE uart_out = FDEV_SETUP_STREAM(uart_print, NULL,
                                         _FDEV_SETUP_WRITE);

int uart_print(char c, FILE *stream)
{
//


this much code is written for avr


//
  if (c == ‘n’)
    uart_print(‘r’, stream);
  loop_until_bit_is_set(UCSRA, UDRE);
  UDR = c;
  return 0;

//


this much code is written for avr


//
}

 

int main ()

{

      unsigned char adc_val;

      usart_init ();

      adc_init ();

 

      adc_val = adc_get ();

 

      stdout = &uart_out;    

      printf ( “nTemp:%d C”, adc_val );        

}

//===============================================================//

 

Hope this helps you.

    

RSS Recent Posts

  • Supply vs performance query February 7, 2026
  • wall transformer polarity February 7, 2026
  • Do i need a buffer? February 7, 2026
  • BPF February 7, 2026
  • Figgie International intercom 1998 era February 7, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise