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 / Topics / send data to the serial port using proteus based ATmega16

send data to the serial port using proteus based ATmega16

|

Microcontroller › AVR › send data to the serial port using proteus based ATmega16

  • This topic has 6 replies, 6 voices, and was last updated 10 years, 6 months ago by sashi.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • November 11, 2012 at 10:39 am #4791
    aminanto
    Participant

    I recently made ??a small project for my final project,
    This project involves the transmission of data via the serial port.
    I am using proteus to simulate the system as a whole and based on ATmega16.
    since my laptop does not have a serial port so I
    using Virtual Serial Port Emulator. While I use huperterminal to receive data transmitted by the microcontroller. I just do not have the data sent by the microcontroller.
    Someone please help me, I’ve thought about it for hours and did not manage to make the data sent ..

    This is a screenshot of proteus and code. ..

     

    #include <mega16.h>
    #include <stdlib.h>
    #include <delay.h>
    #include <io.h>

    #define ADC_VREF_TYPE 0×40
    #define USART_BAUDRATE 9600
    #define BAUD_PRESCALE ((8000000/ (USART_BAUDRATE*16UL)) – 1)
    //————————————————

    unsigned int ADC_read(unsigned char adc_input);
    void ADC_init(void);
    void usart_init();
    void usart_putch(unsigned char send);
    void USART_transmit(unsigned char data);
    void SEND_reading(unsigned char abc);

    void ADC_init(void)         // Initialization of ADC
    {
        ADMUX=(1<<REFS0);
        ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);    // faktor pembagi 128
    }

    void usart_init()
    {
        UCSRB |= (1 << RXEN) | (1 << TXEN);   // Turn on the transmission and reception circuitry
        UCSRC |= (1 << URSEL) | (1<<USBS) | (1 << UCSZ0) | (1 << UCSZ1);
        // Use 8-bit character sizes
     
        UBRRL = BAUD_PRESCALE;
        // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
        UBRRH = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value..
        // into the high byte of the UBRR register
    }

    void usart_putch(unsigned char send)
    {
        while ((UCSRA & (1 << UDRE)) == 0); // Do nothing until UDR is ready..
        // for more data to be written to it
        UDR = send; // Send the byte
    }

    void USART_transmit(unsigned char data)
    {
      /*
      while((UCSRA & 0×20)==1)
      {
      UDR=data;
      }
      */
      while ((UCSRA & (1 << UDRE)) == 0); // Do nothing until UDR is ready..
            // for more data to be written to it
            UDR = data; // Send the byte
           
    }
       
    void SEND_reading(unsigned char abc)
    {
        unsigned char k,l,m;
        k=abc/100 + 48;
        l=(abc/10)%10 + 48; 
        m=abc%10 + 48;
        USART_transmit(k);
        USART_transmit(l);
        USART_transmit(m);
        USART_transmit(‘,’);
    }

    // Read the AD conversion result
    unsigned int ADC_read(unsigned char adc_input)
    {
        ADMUX=adc_input | (ADC_VREF_TYPE & 0xff);
        // Delay needed for the stabilization of the ADC input voltage
        delay_us(10);
        // Start the AD conversion
        ADCSRA|=0b01000000;
        // Wait for the AD conversion to complete
        while ((ADCSRA & 0×10)==1);
        ADCSRA|=0b00000;
        return ADCW;
    }

    void main(void)
    {
        unsigned int value;
        DDRA=0xFE;
        DDRB=0xFF;
        DDRD=0xFE; //0×03;
        ADC_init();         // Initialization of ADC
        usart_init();

        while(1)
        {
            value=ADC_read(0);
            value=value*500/1024;
            PORTB=value;
            usart_putch(‘C’);
            //SEND_reading(value);
            delay_ms(100);
        }     
    }

     

     

     

     

     

     

     

     

     

     

     

    one more, I’m using code vision

    I would greatly appreciate any help you guys

     

    November 17, 2012 at 1:04 pm #8755
    AJISH ALFRED
    Participant

    It is your final project right? If you’ve done your code, then why don’t you try it on real hardware and find the result ! The simulation software can’t completely simulate the rael hardware at it fails most of the time to get the correct result due to countless reasons.

    January 10, 2014 at 8:20 pm #10834
    shirish
    Participant

    Hi i m working on the same project with help of proteus but i m getting the problem, i m not getting ht12e in proteus i hav tried to download a lot but i m not getting so can you plz provide me the. dsn file along with libraries

    January 14, 2014 at 8:18 am #10841
    AJISH ALFRED
    Participant

    Hi all,

    Please don’t waste yourm time on simulating things, try it on real hardware!

    February 4, 2014 at 5:29 pm #10934
    Ashutosh Bhatt
    Participant

    may be problem in your  BAUD_PRESCALE

    for 8 MHZ your UBRRL must be 33h. try this direct value.

    March 21, 2014 at 4:40 am #11346
    manimaran
    Participant

    The problem is you are not having the idea about the proteus. Proteus can send the data to outside world by using compim. And also try to change the baud rate in virtual terminal. Then check the crystal value in microcontroller properties..

    August 10, 2015 at 7:33 am #13156
    sashi
    Participant

    yes ,u shoud check the clolk freq of micro controller on proteous ….and the check the boud rate of virtual terminnal ……

     

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Buffer design? February 9, 2026
  • BPF February 9, 2026
  • To couple or decouple February 9, 2026
  • ANOTHER OLD PROJECT REDO February 9, 2026
  • Op amp shock February 9, 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