The model I'll start working with is ATtiny85. As the AVR family itself, the model was chosen after a comprehensive thought process i.e. I picked it randomly from the catalog while queuing at the local electronics store. I usually don't think too much beforehand; I tend to start with the first idea that comes to my mind and rethink if it fails.
ATtiny85 in DIP8 package |
As bits and bytes are essential in digital electronics, I want to say a few words about them. A bit is the smallest unit of information in digital computing. It has two possible values: HIGH (ON, 1) or LOW (OFF, 0). In electronics these are practically implemented with voltage; either there is some or there is not. When we want to present numbers in binary, we put together multiple bits. For example with two bits we can present numbers from 0 to 3 with 0 = 00, 1 = 01, 2 = 10, and 3 = 11.
In 8-bit microprocessors the data is handled in the groups of 8 bits, which are also known as bytes. Each byte holds a value in the range of 0 to 255. Depending on the situation, bytes can represent other types of data as well, like characters or instructions for the processor. In ATtiny85, there is 8 KiB of memory for the program. KiB is often called kilobytes but the technically correct term would be kibibyte. One kibibyte is 1024 bytes, so 8 KiB would be 8192 bytes.
Next we have to figure out how to connect the microcontroller to the rest of our chip. For this we need to get our hands on its datasheet. Datasheets are the source of all the necessary information regarding electronic components. Each component has a datasheet that tabulates its characteristics, like temperature behaviour or typical variation in parameter values, and most importantly for complicated components, how to use them. So in its datasheet, the pinout for ATtiny85 in DIP8 package looks like this:
ATtiny85 pinout from the datasheet |
According to the datasheet, PB5 is a special case. It behaves normally as the RESET pin, or technically its inverse. This means that if LOW signal is put to the RESET pin, it resets the chip and we get nowhere in our program. To prevent this we have to wire it to HIGH signal which is easiest to get from the operating voltage. Thus all I have to do is to connect the wires to the chip like this:
and voilĂ , it works! ...Or it would work, if it had a program in it. Now it does pretty much nothing but waste electricity. At this point we'll need to get out the Raspberry Pi but that'll be the topic of the next post.
References:
ATtiny25/45/85 datasheet
Original screenshot from the Super Mario Bros. from https://en.wikipedia.org/wiki/Super_Mario_Bros.
No comments:
Post a Comment