I want to send data to TFDI. It can be hello world
or any value of variable. But I can't do. I haven't found example code on the internet. Some examples doesn't work. I am using Atmel Studio.
-
The Attiny84 does not have a hardware USART interface. Use something like the SoftwareSerial library. I got it working on an Attiny85.– chrislMar 1, 2019 at 15:46
-
yes I know.But I haven't found working example.If you have working example,can you share with me?– johnyjlaMar 1, 2019 at 18:22
-
Doesn't the SoftwareSerial example from the Arduino IDE work? What happens, if you try it? What is going wrong with it?– chrislMar 2, 2019 at 11:17
-
I don't want to burn bootloader.I want to use atmel studio.And,I haven't still find any way.– johnyjlaMar 4, 2019 at 16:25
1 Answer
The ATTiny84 does not have a hardware UART peripheral. Instead it has a USI (universal serial interface), which does not have all the capabilities needed for UART ("serial") interface.
You don't need to burn the Arduino bootloader to use libraries, that were written for the Arduino IDE. You only might need some of the definitions, which you can get by including the arduino.h file.
I think your best bet is to use existing libraries, like the SoftwareSerial library. There are also lots more libraries, that provide bit banged serial interfaces. You can also get them running in Atmel Studio, by including the source files. This is the easy way.
If you want to go the hard way, you might be able to program a hybrid software/hardware UART interface by utilizing some functions of the USI. In a search I found this site, which is about implementing UART with the USI. They also link to Atmel's Application Note AVR307, which is a good source for understanding this. From this starting point you might also find a ready to go implementation for the USI. If not, you will have to do the work yourself.