Info about components

Go To Last Post
42 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to know the popular chips ,devices &
components. I know only few .So that I can include them in avr projects.

This topic has a solution.

Salman

Last Edited: Tue. Mar 14, 2017 - 05:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Make a list of what features you are looking to implement into your projects and then we can advise.

I would say though that the most popular device used in AVR projects is an AVR.

Jin

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So look around at the kinds of projects that people are doing!

 

Doesn't your university have an electronics department?

 

Explore the web!

 

https://www.arduino.cc/

https://www.arduino.org

 

https://www.sparkfun.com/

 

https://www.adafruit.com

 

https://www.instructables.com/

 

http://hackaday.com/

 

etc, etc, ...

 

Don't fixate on the AVR - the same will apply to other microcontrollers

 

Here's a good starting point for basic electronics - with an overview of common components:

 

https://electronicsclub.info/

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I'm not sure if this is just apocryphal but apparently the entrance exam to the Chinese civil service is just one question "write down everything you know.". Your question above is a bit like that.

 

There must be billions if not trillions of electronic components you might connect and use with an AVR. I think you are going to need to be a bit more specific!

 

Usually the way an electronic design works is that you think of some device you would like to design. Then you consider what devices may be required to achieve that. Then you research the market to find out what possible candidates there are that might be available in each category you think you need.

 

Say for example you plan to use an AVR to build an alarm clock. If you research that you will find that for various reasons (and finding that out is a piece of research work in itself) many people would choose to add an "RTC" chip alongside the AVR. So then you start researching that and finding out what kinds of RTC chip there are and who makes them. I think you will likely find that Maxim-Dallas are possibly the biggest supplier of such chips with some of the most keenly priced devices with the "best" features. But even then you will likely find that they make 50+ different models so then you need to match your requirements to the sub-section of devices that will deliver what you look for - do you want 3.3V or 5V? Do you want SPI or I2C connected? Exactly how accurate do you want it?

 

At the end of that process you will likely narrow down to 1 or 2 suitable devices (possibly from more than one manufacturer) so you might order samples of each and build prototypes and find out which one work best in your intended design.

 

Just saying "tell me about popular chips" doesn't really cut the mustard. I might think a Dallas RTC with SPI interface was the "perfect" device. You might have some reason to think that an I2C interfaced one was better. You might want 2ppm accuracy. I might be happy with 50ppm.

 

This RTC example is just one example of a billion different things.

 

If the question really means "what components should I buy to experiment and learn about AVR interfacing" then I guess you want some example of SPI, some example of I2C, some example of UART interfaced (though you may be using your PC for that one) and so on. A popular thing people add are HD44780 based "character" LCD modules - it's worth adding one of those and learning how to interface to it. Be warned there's probably 10,000+ different HD44780 based LCD modules to choose from - how you pick amongst those, once again, will be down to what it is you want to achieve and that may be driven by envisaging the final device you want to build. There'd be no point getting an 8 character 1 line LCD display if your design requirement says you really need 4 lines of 20 characters to show everything you intend to.

Last Edited: Mon. Mar 13, 2017 - 12:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's a huge reply..thanks for that.Sorry for being incomplete..
Leave about that.
I want to know the required components for interfacing with avr inorder to produce sound for example in alarm clock
Secondly Im doing one project which has 17 led matrix modules(8×5)(created on my own with normal leds)
84 no of 7segment displays of voltage req. -3v and four 7 segment displays of voltage req(7-8v) ..I want to introduce inverter battery in my project ..what according to you should be inverter capacity...
Suppose I need 15 to 20 avrs(approx) (note.didnt complete project yet so approx)
If problem i stated is irrelevant or complexsorry for that .

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

salmanma6 wrote:
to produce sound for example in alarm clock
Still too vague. A "sound" can be nothing more than applying a voltage to a self resonating piezo element all the way up to playing back CD quality sampled audio through a 24 bit DAC.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, salmanma6 -

 

You are still a bit vague. Maybe a "lot vague". For example, you say "produce a sound...". There are perhaps 4-6 ways you can do this, possibly more. Let me list some examples: conventional loud-speaker, piezo "speaker", piezo tone generator, piezo "buzzer", headphones, and more. Now, clearly, some of those are more useful for an alarm clock than others, but only you can decide what you want, Also, if you are limited to local shops, you may find some of these items easier to find or lower cost than others.

 

You will have much better results, here, if you do a bit of "homework" first. Pick something that you think that you could use and then ask us if it is suitable. You will probably get a dozen wildly different answers but that range of answers really represents the range of possibilities you have available to you. One of the things about engineering, generally, is that there is rarely only one "best" answer. Often, if cost is critical, for example, you will get one answer but if size is critical, you are likely to get a very different answer. 

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ sir clawson @ sir ka7ehk
Really I don't know anything about sound creating and controlling with avr...sorry that
I want to know how many ways are possible and what are they?
Regret if still vague

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What ive understood is

there are some devices just we have to give some voltage inorder to produce sound..that's it?

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What about second question...just I need a rough idea about it.
Tell something about it

Salman

Last Edited: Mon. Mar 13, 2017 - 05:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This may work best if you say what kind of sound it is you want and we'll tell you ways to achieve it.

 

For example, do you just want a simple "beep" or perhaps a "melody" or even sampled sound such as "get up lazy bones you are half an hour late for work!" ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
You will have much better results, here, if you do a bit of "homework" first.

+1

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Suppose for beep what type of device we need?
Similarly for melody and text
Sir ,Whatever you have specified i need all of them
May be I'll use in future projects

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you're "stocking up" for future projects, why not look at hobbyist websites (and local stores, if you're lucky enough to have any) for "starter packs" or similar...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you remember this....

 

https://www.youtube.com/watch?v=...

 

(jump straight to offset 03:30 if you value your ears!)

 

Rather remarkably that "music" is being played with nothing more than 1 I/O line being fed a sequence of 0's and 1's fed into a small amp and a speaker.

 

So you can achieve that in the same way on an AVR - you take an I/O line to a small amp (possibly just a transistor) and into a small speaker.

 

If you want something more advanced how about this:

 

https://www.youtube.com/watch?v=...

 

They don't seem to link to a circuit for that but it's almost certainly just a timer doing PWM and being fed PCM sound samples. The only downside of such a technique is that you need a LOT of sound data which is almost certainly why they are reading it from an SD/MMC card (almost certainly a Windows .WAV file).

 

The essence of engineering is being exact in the specification of the design. Everything else will fall out from that. So as myself and others have said above - be specific about what you want to achieve and someone here will advise you as to what's needed to achieve any requirement.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I listed the most common means of converting an electrical signal to sound. Each will generally require somewhat different electrical signals. Some require an "amplifier" of some sort. In a bit more detail:

 

1. Loudspeaker - generally low impedance that cannot be driven direct from a port pin. Requires either a fully analog signal or a sampled signal (eg, PWM) that is sampled well above 20KHz. Often the largest one of these. 

 

2. Piezo speaker - usually available somewhat smaller than a standard loudspeaker. I think they also take an amplifier of some kind, but it may be different than a standard speaker.

 

3. Piezo tone generator - a simple sort of piezo speaker. You need to pulse it at the tone frequency. Some range of tones is possible but they are usually resonant. This means that one tone frequency will usually be "preferred" (eg, loudest). Usually  not directly driven from an MCU port pin, but a simple transistor is often sufficient.

 

4. Piezo buzzer - apply a DC voltage and it makes a tone. Some can be driven direct from an MCU port pin. In most cases, a single transistor drive is enough.

 

5. Headphones - like small versions of loud speaker. In many cases, they can be driven direct from an MCU port pin using PWM. To be useful, they have to be put in or on top of the ear.

 

Jim

 

 

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to know more a little bit about headphone
I can browse.Still this website is best

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

salmanma6 wrote:
i need all of them
Peruse sites such as Adafruit, SparkFun, Jameco and HobbyTronics to get ideas of projects and types of devices that are available.

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Maybe this would help the OP!

Google: MicrocontrollersAndSoftwareDesign.pdf

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

salmanma6 wrote:

I want to know the popular chips ,devices & components. I know only few .So that I can include them in avr projects.

 

The popular parts are those that appear on the many Arduino shields that exist. Start by looking at shields and seeing what chips they use.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I dare say looking at Adafruit and Sparkfun sites would give an idea of what is 'popular'. Basically anything that is half useful has been interfaced with an Arduino or Raspberry Pi.

For an alarm clock, I'd be Googling:

google arduino alarm clock

google arduino multiplexed display

google arduino play tune

google arduino make beep

and so on.

If you can't find the answers there, you're not trying hard enough.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I recommend buying one or two of each Arduino UNO and Arduino Nano boards.  Download and install the Arduino Integrated Development Environment (IDE).  Then learn how to do simple things like change the "blink.ino" demo program.   Get a "C++ for Idiots" and Beginning Arduino books from the local library.

 

Now go to eBay and search under "Arduino modules".   Buy one or two of whatever's cheap for you and looks interesting.  I often buy in lots of five or ten pieces because there is often a big per-unit price difference.  Check if there are any Arduino libraries for any interesting module board that you find. 

 

To begin learning how to connect modules to your Arduino, you need experience with each type of interface and various types of module boards.

 

For learning I2C [what AVR calls TWI and Arduino calls Wire.h], I suggest getting a Real-Time Clock module [DS3231 IC], a HMC5883 magnometer IC module, and an FM radio RDA5807m module.   With these you can make a Walkman clock radio that will tell you what song that you are listening to and what direction that you are walking.

 

Next buy an TFT 2.4" 320x240 flat-screen  module.  There are two types of very cheap ($4-$8) ones: SPI serial and Parallel.  The parallel ones are called MCUFRIEND devices after the clueless company that markets them.  The parallel TFTs usually have touch screens, but they usually arrive with a different controller IC than the one that the eBay seller claims is in the device.   The library called "MCUFRIEND_kbv.h" by AVRfreak David Prentice is invaluable for getting your parallel TFT working.

 

At this point people start focusing on building stereos/music equipment, data-loggers, or robots.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A good place to see popular components are some youtube channels, with guys addicted to buying stuff from ebay and aliexpress.

 

I'll list a few of my favorites:

 

https://www.youtube.com/channel/UCdXHgsCiql_78oT5ydXWvzA/videos

https://www.youtube.com/user/julius256/videos

https://www.youtube.com/user/greatscottlab/videos

 

You can see their reviews and choose components that are interesting for your projects.

Regarding your project, I might use something simpler than an AVR to control each display module, a dedicated chip like the TM1638 (look it up in this forum, for exemple). Cheaper than an AVR and able to handle more current. Then you control all the modules with an AVR.

I first learned about this chip in an youtube channel, actually.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
Buy one or two of whatever's cheap for you and looks interesting.

Beware of buying cheap - especially as a beginner!

 

The first thing that gets sacrificed for cost is any kind of support or documentation. This may be OK for experienced users - who already know what to do with this stuff - but is not suitable for beginners.

 

The forums are littered with beginners who have bought "cheap" (sic) stuff from ebay, but then have no idea how to use it.

 

A key question to ask before buying anything is, "is there enough suitable information to allow me to understand & use this thing?"

 

Therefore, as many have already suggested, I think you will be far better off with suppliers like 

 

 

For instance, look at a typical Adafruit product page:

 

https://learn.adafruit.com/adafr...

 

You get not only the module itself, but also the datasheet, schematics, tutorials, example projects, etc, etc, ...

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

salmanma6 wrote:
I want to know the popular chips ,devices & components. I know only few .So that I can include them in avr projects.

 

The reality is that, with the exception of any special components, you can do just about any AVR project with no more than about 50 different components.

 

Consider the humble diode. I use just 3 different types; a 1A 1000V power diode, a small signal diode and a schottky diode. Why a 1000V diode? Because it's the same price as a 100V/200V/400V/800V one and by standardising I only need to keep one type on the shelf.

 

How about resistors? If we ignore odd values used in things like filters and attenuators then probably just 5 values will suffice: dim LED, bright LED, weak pull-up, strong pull-up and something in the middle of all that lot.

 

Transistors? 3 types; general purpose NPN, general purpose PNP and small TO92 high current NPN.

 

Op-Amp? 3 types: 5V rail dual, split rail dual and split rail quad.

 

AVRs? 3 types: top of range 20-pin, top of range 28-pin and top of range 40-pin.

 

I also have a standard range of electrolytics and a standard decoupler.

 

So I reckon most of my commercial designs use around 50 different 'stock' components plus any specials. Specials are things like driver ICs, displays and sensors.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Although you are right in principle, many times you can find chinese products that are redesigns of the ones supplied by the "legit" companies you mentioned, but much cheaper.

So, you can browse these suppliers for ideas, but then you can buy compatible products elsewhere and save a lot of money.

 

For example, 16x2 LCD:

SparkFun - 13.95 USD

Ebay - 1.46 EUR

 

Ultrasonic distance sensor:

SparkFun - 3.95 USD

Ebay - 1.17 GBP (2 units)

 

Off course, you have to be careful with fakes, when buying from chinese suppliers, go for the unit with chinese parts. For example, imagine you are buying an Arduino nano, buy the ones with chinese USB chips CH340, and not with FTDI chips (probably fake).

 

Another advice when buying chinese stuff, is that you must be ready to test the part as soon as it arrives. Since Ebay and Paypal have excellent buyer protection, if the part doesn't meet specs, you can usually get a refund from the seller.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Salman,

 

I am going to suggest that you look very closely at this website.

 

http://www.ebay.com.au/itm/Adeep...

 

Yes it is for an Arduino and many different components, but it is probably one of the best collections that I have seen for some time. The list of contents is at the end of the page. You can look for more by googling with Arduino Kit

 

And here is another one that just came in my email.

 

http://www.gearbest.com/kits/pp_...

 

Ross McKenzie ValuSoft Melbourne Australia

Last Edited: Tue. Mar 14, 2017 - 12:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
Although you are right in principle, many times you can find chinese products that are redesigns of the ones supplied by the "legit" companies you mentioned, but much cheaper.

So, you can browse these suppliers for ideas, but then you can buy compatible products elsewhere and save a lot of money.

 

Yes, of course you can - provided you know what you're doing.

 

My point is that we are talking specifically about a beginner here - who, by definition, does not yet know what they're doing.

 

Plus, the particular beginner in question doesn't seem to be very good at googling and researching these things - so would probably be better off with a "one-stop shop".

 

Another advice when buying chinese stuff, is that you must be ready to test the part as soon as it arrives

Again, not suitable for a novice.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cool thing

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

salmanma6 wrote:
Secondly Im doing one project which has 17 led matrix modules(8×5)(created on my own with normal leds) 84 no of 7segment displays of voltage req. -3v and four 7 segment displays of voltage req(7-8v) ..I want to introduce inverter battery in my project ..what according to you should be inverter capacity... Suppose I need 15 to 20 avrs(approx) (note.didnt complete project yet so approx)  .

anyone give a rough idea regarding above one .

secondly i want to know more  chips like TM1638 through which we can easily control 7 segment display and led matrix modules which i need the most

El Tangas wrote:

Regarding your project, I might use something simpler than an AVR to control each display module, a dedicated chip like the TM1638 (look it up in this forum, for exemple). Cheaper than an AVR and able to handle more current. Then you control all the modules with an AVR.

I first learned about this chip in an youtube channel, actually.

Salman

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

salmanma6 wrote:

...anyone give a rough idea regarding above one .

 

Build one module, measure the current and multiply by the total number of modules.

 

salmanma6 wrote:

secondly i want to know more  chips like TM1638... 

 

If I Google 'LED display drivers' the first result links to Mouser who list a total of 455 LED display driver chips. Enough choice for you?

 

 

I think you are making the same mistake lots of newcomers and hobbyists make - you are spending too much time thinking and not enough time doing (=learning).

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
I think you are making the same mistake lots of newcomers and hobbyists make - you are spending too much time thinking and not enough time doing (=learning).

In particular, you are thinking about some huge Grand Plan before you've even completed a basic, simple project.

 

AKA, trying to run before learning to walk.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

salmanma6 wrote:
secondly i want to know more  chips like TM1638...

Brian Fairchild wrote:
If I Google 'LED display drivers' the first result links to Mouser who list a total of 455 LED display driver chips. Enough choice for you?

 

And again: http://www.avrfreaks.net/comment...

 

Seriously - learning to use Google effectively is a key skill!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you know the best led driver chip with more no of pins

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
 

SPI protocol implementation .. ATMEGA32.... controlling 8 7-segment displays with... 3 lines
# include<avr/io.h>
# include<util/delay.h>


# define ss 4
# define mosi 5
# define sck 7

void spi(char cmd,char data)
{
PORTB &=(~(1<<ss));

SPDR = cmd;
while(!(SPSR&(1<<SPIF)));
SPDR = data;
while(!(SPSR&(1<<SPIF)));

PORTB |=(1<<ss);

}

int main()
{
DDRA = 0xFF;

DDRB = (1<<ss)|(1<<mosi)|(1<<sck);

SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR0);

spi(0x0a,0x0f);

spi(0x09,0xff);
spi(0x0b,0x07);
spi(0x0c,0x01);

spi(0x01,0x08);
spi(0x02,0x07);
spi(0x03,0x06);
spi(0x04,0x05);

spi(0x05,0x04);
spi(0x06,0x03);
spi(0x07,0x02);
spi(0x08,0x01);

while(1);
}

im not getting this code...please explain anyone...

led driver chip used here is max7221

i got this from 

http://embedded-4u.blogspot.in/2...

 

 

if wrong ....anyone provide me code 

i dont get the logic ..how its done...

 

 

 

 

 

 

 

Salman

Last Edited: Fri. Mar 17, 2017 - 07:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

salmanma6 wrote:

 

i dont get the logic ..how its done...

 

 

Ok. First thing, do you know how the SPI protocol works?

Second thing, read the MAX7221 datasheet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rEAD  the sheet

yeah i know...

Still im unclear..please  provide clean code

 

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

salmanma6 wrote:

rEAD  the sheet

yeah i know...

Perhaps if you tell us what bits you don't understand? A quick look at the data sheet and at tables 2,3 and 4 would seem to explain all you need to know.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

Last Edited: Sat. Mar 18, 2017 - 05:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ki0bk: Good link. I found a newer version of this book here. It's over one thousand pages long. However, its copyright prohibits selling or distributing it, unlike the one you identified, which is CC. I don't think my link constitutes distributing it. His web site is Techideas and it looks like he has some other resources there as well.

RobShaver:-]
---

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The best I can do is comment the code, to help you understand how to read a datasheet. I'm only doing this because I know the MAX7221 well and this is a very simple case.

But you must learn to do it yourself.

 

# define ss 4                           //B4 is slave select for SPI
# define mosi 5                         //B5 is MOSI for SPI. It's the data line.
# define sck 7                          //B7 is the SPI clock

//sends 16 bit SPI command/data for the MAX7221
//see figure 1 in the datasheet: data is 16 bit MSB first, clock idles low (that is, pulse is high then low), data load on clock rising edge
//see timing on the "ELECTRICAL CHARACTERISTICS" table
//and data format on table 1

void spi(char cmd,char data)            
{
PORTB &=(~(1<<ss));                     //drive SS low, this tells the MAX7221
                                        //that data will follow.
SPDR = cmd;                             //send command byte
while(!(SPSR&(1<<SPIF)));               //wait until it is sent
SPDR = data;                            //send data byte
while(!(SPSR&(1<<SPIF)));               //wait until it is sent

PORTB |=(1<<ss);                        //drive SS high: SPI transmission finished

}

int main()
{
DDRA = 0xFF;                            //set all of port A as output
                                        //it has no purpose (?)
DDRB = (1<<ss)|(1<<mosi)|(1<<sck);      //set SS, MOSI and SCK as outputs

SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR0);    //program the AVR SPI peripheral to a mode compatible with the MAX7221 timing requirements
                                        //see the AVR datasheet for details on how to do this
                                        //alternatively, on some AVRs you could use the USART in SPI mode.

/***************************************************************************
in the next lines, when I refer to tables, it means in the MAX7221 datasheet 
****************************************************************************/

spi(0x0a,0x0f);                         //send command 0x0a - intensity (see table 2)
                                        //0x0f - maximum intensity (see table 7)
spi(0x09,0xff);                         //send command 0x09 - decode mode (table 2)
                                        //0xff - use "code B" font for all characters (see table 4)
spi(0x0b,0x07);                         //send command 0x0b - scan limit (table 2)
                                        //0x07 - display all 8 characters (table 8)
spi(0x0c,0x01);                         //send command 0x0c - shutdown (table 2)
                                        //0x01 - normal operation (table 3)
spi(0x01,0x08);                         //send command 0x01 - data for digit 0 (table 2)
                                        //0x08 - data is number '8' ("code B" - tables 5 and 6)
spi(0x02,0x07);                         //the rest are all the same for the other digits
spi(0x03,0x06);
spi(0x04,0x05);

spi(0x05,0x04);
spi(0x06,0x03);
spi(0x07,0x02);
spi(0x08,0x01);

while(1);                               //wait forever
}