ATTINY 85 SERIAL DATA

Discussion in 'Embedded Systems and Microcontrollers' started by AJIN NADH, May 6, 2015.

  1. AJIN NADH

    Thread Starter Member

    Dec 18, 2014
    79
    4
    Hi,
    I need to display the serial data avalable in attiny 85 to the terminal...How can i Please Help....
    Ajin nadh
     
  2. DickCappels

    Moderator

    Aug 21, 2008
    2,664
    634
    Oh, that one; it has a USI but no real USART. I would bit-bang it myself, though there is an Atmel application note that describes contortions that one can go through to use the USI, maybe a little better than bit-banging as far as freeing up the cpu a little bit goes.

    This thread on AVRFreaks is a good starting point.

    http://www.avrfreaks.net/forum/implementing-software-uart-attiny85


    This assembly language code includes a bit-banged serial output (4 MHz ATTINY2313)
    http://www.cappels.org/dproj/wfcp/wfcaa.htm
     
  3. AJIN NADH

    Thread Starter Member

    Dec 18, 2014
    79
    4
    Thank you sir,

    I am a starter in attiny85 and my circuit is as follows
    9AJg1Dh.png
    and i used the following code

    Code (Text):
    1.  
    2. #include "SoftwareSerial.h"
    3. const int LED = 0; // this is physical pin 8 for the LED
    4. const int Rx = 3; // this is physical pin 6
    5. const int Tx = 4; // this is physical pin 7
    6. SoftwareSerial mySerial(Rx, Tx);
    7. void setup()
    8. {
    9. pinMode(LED, OUTPUT); // tell Arduino LED is an output
    10. mySerial.begin(19200);
    11. digitalWrite(LED,LOW);
    12. }
    13. void loop()
    14. {
    15. mySerial.println("SANTHOSH");
    16. delay(100);
    17. digitalWrite(LED,HIGH);
    18. delay(100);
    19. mySerial.println("ajinnadh");
    20. delay(100);
    21. digitalWrite(LED,LOW);
    22. }
    23.  

    but its not working....(boudrate of atmega 328 is also 19200).
    i tested by changing the rx and tx


    thanks ,
    Ajin nadh

    Moderators note: Please use code tags for pieces of code
     
    Last edited by a moderator: May 6, 2015
  4. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,814
    834
    It looks like there's a problem on the Arduino UNO side, to start.

    You are using the software serial library and define your TX/RX pins to be pins 3/4 on the Uno (I don't understand your comment about physical pins). Yet, you've wired your communications to the built-in USART on pins 0/1. So, you're sending data to pin 4 while the ATTiny is wired to pin 1.

    There is no need to use the software serial library. Just use the built in communication functions for the TX0/RX0 pins.

    You have a similar issue when defining the LED pin. You have a comment about pin 8, but define it as pin 0 (The Rx pin on the Uno).

    Go back and review how to use pins on the Arduino Uno. Here is a reference to the pinmode command.
     
  5. AJIN NADH

    Thread Starter Member

    Dec 18, 2014
    79
    4

    Hi sir,
    I used the pin 3,4 th of attiny 85 as the software serial....which is connected to the arduino uno, and i found that the serial data is received but only getting the data when boud rate is 2400( at terminal),
    But i programmed as the boud rate as 19200.... why is like this...?



    Regards
    ajin nadh
     
  6. AJIN NADH

    Thread Starter Member

    Dec 18, 2014
    79
    4
    I did it thanks for the support
     
  7. AJIN NADH

    Thread Starter Member

    Dec 18, 2014
    79
    4
    The boudrate is multiple of 8
     
  8. DickCappels

    Moderator

    Aug 21, 2008
    2,664
    634
    What is the electrical layer in your connection to the terminal? (RS-232? In the case of RS-232 the data needs to be inverted and strictly speaking swing from above 2.5 volts to below -2.5 volts).
     
Loading...