Monday 1 August 2011

. Encyclopedia_of_Weapons_of_World_War_II.rar
482. Encyclopedia_of_Weather_and_Climate.rar
483. Encyclopedia_of_Western_Colonialism_since_1450.rar
484. Encyclopedia_of_White-Collar_and_Corporate_Crime.rar
485. Encyclopedia_of_Wine.rar
486. Encyclopedia_of_Women_in_Higher_Education.rar
487. Encyclopedia_of_Women_in_Medicine.rar
488. Encyclopedia_of_Women_in_the_Ancient_World.rar
489. Encyclopedia_of_Women_s_Health.rar
490. Encyclopedia_of_Wood.part1.rar
491. Encyclopedia_of_Wood.part2.rar
492. Encyclopedia_of_Work_in_America_-_History__Policy_and_Society.rar
493. Encyclopedia_of_World_Beliefs__Practices_and_Culture.rar
494. Encyclopedia_of_World_Biography.rar
495. Encyclopedia_of_World_Climatology.rar
496. Encyclopedia_of_World_Cultures.part1.rar
497. Encyclopedia_of_World_Cultures.part2.rar
498. Encyclopedia_of_World_Cultures.part3.rar
499. Encyclopedia_of_World_Cultures.part4.rar
500. Encyclopedia_of_World_Cultures.part5.rar
501. Encyclopedia_of_World_Fascism.rar
502. Encyclopedia_of_World_Geography.rar
503. Encyclopedia_of_World_History.rar
504. Encyclopedia_of_World_Literature.rar
505. Encyclopedia_of_World_Poverty.rar
506. Encyclopedia_of_World_Religions_-_Britannica.rar
507. Encyclopedia_of_World_Religions_-_Facts_on_File.rar
508. Encyclopedia_of_World_s_Endangered_Languages.rar
509. Encyclopedia_of_World_Sport.rar
510. Encyclopedia_of_World_War_II_-_Student_Edition.rar
511. Encyclopedia_of_World_War_II_in_the_Pacific.rar
512. Encyclopedia_of_World_Writers__Beginnings_To_20th_Century.rar
513. Encyclopedia_Scientific_Principles.rar
514. Extraordinary_Animals_-_An_Encyclopedia_of_Curious_and_Unusual_Animals.rar
515. Fertilizer_Encyclopedia.rar
516. Gale_Encyclopedia_of_Medicine.rar
517. Gale_Group_Africa_An_Encyclopedia_for_Students_Edition.rar
518. Gale_Group_Encyclopedia_of_The_Great_Depression.rar
519. Gale_Group_The_New_Catholic_Encyclopedia.part1.rar
520. Gale_Group_The_New_Catholic_Encyclopedia.part2.rar
521. Gale_Group_The_New_Catholic_Encyclopedia.part3.rar
522. Gale_Group_WorldMark_Encyclopedia_of_National_Economies.rar
523. Gale_Group_WorldMark_Encyclopedia_of_the_Nations_12th.rar
524. Gale_Group_WorldMark_Encyclopedia_of_the_States_7th.rar
525. Graf_-_Encyclopedia_of_Electronic_Circuits.part1.rar
526. Graf_-_Encyclopedia_of_Electronic_Circuits.part2.rar
527. Grzimek_s_Encyclopedia_2nd_Ed.part01.rar
528. Grzimek_s_Encyclopedia_2nd_Ed.part02.rar
529. 388522100 Grzimek_s_Encyclopedia_2nd_Ed.part03.rar
530. Grzimek_s_Encyclopedia_2nd_Ed.part04.rar

Encyclopedia_of_Space_Technology.rar
432. Encyclopedia_of_Statistics.rar
433. Encyclopedia_of_Stem_Cell_Research.rar
434. Encyclopedia_of_Stitch.rar
435. Encyclopedia_of_Supreme_Court.rar
436. Encyclopedia_of_Swearing.rar
437. Encyclopedia_of_Tables.rar
438. Encyclopedia_of_Taboos.rar
439. Encyclopedia_of_Television.rar
440. Encyclopedia_of_Terrorism.rar
441. Encyclopedia_of_Textile_Finishing.rar
442. Encyclopedia_of_the_Blues.rar
443. Encyclopedia_of_The_Great_Depression.rar
444. Encyclopedia_Of_The_Human_Brain__Vol.rar
445. Encyclopedia_of_The_Mongol_Empire.rar
446. Encyclopedia_of_the_New_American_Nation.rar
447. Encyclopedia_of_the_Solar_System__2nd_Edition.rar
448. Encyclopedia_of_the_Undead_A_Field_Guide_to_Creatures_That_Cannot_Rest_in_Peace.rar
449. Encyclopedia_of_Theology.rar
450. Encyclopedia_of_Time.rar
451. Encyclopedia_of_Title_IX_and_Sports.rar
452. Encyclopedia_of_Tobacco.rar
453. Encyclopedia_of_Toxicology.rar
454. Encyclopedia_of_Trading_Strategies.rar
455. Encyclopedia_of_Transcendentalism.rar
456. Encyclopedia_of_Trigonometry.rar
457. Encyclopedia_of_TV_Shows_1925-2007.rar
458. Encyclopedia_of_U.S._and_Colonial_Proof_Coins_1722-1977.rar
459. Encyclopedia_of_U.S._History.rar
460. Encyclopedia_of_U-boats_From_1904_To_The_Present.rar
461. Encyclopedia_of_Undead.rar
462. Encyclopedia_of_United_States_Congress.rar
463. Encyclopedia_of_United_States_Economic_History.rar
464. Encyclopedia_of_Urban_America_-_The.Cities_and_Suburbs.rar
465. Encyclopedia_of_Vampire.rar
466. Encyclopedia_of_Vegetable_Gardening.rar
467. Encyclopedia_of_Violence__Peace_and_Conflict.rar
468. Encyclopedia_of_Virology.part1.rar
469. Encyclopedia_of_Virology.part2.rar
470. Encyclopedia_of_Volcanoes.rar
471. Encyclopedia_of_War_and_American_Society.rar
472. Encyclopedia_Of_War_Crimes_And_Genocide.rar
473. Encyclopedia_of_War_on_Drugs.rar
474. Encyclopedia_of_Warrior_Peoples_and_Fighting_Groups.rar
475. Encyclopedia_of_Wars_of_the_Roses.rar
476. Encyclopedia_of_Water.rar
477. Encyclopedia_of_Water_Garden_Plants_.part1.rar
478. Encyclopedia_of_Water_Garden_Plants_.part2.rar
479. Encyclopedia_of_Water_Science.rar
480. Encyclopedia_of_Weapons_of_Mass_Destruction.rar
Grzimek_s_Encyclopedia_2nd_Ed.part05.rar
532. Grzimek_s_Encyclopedia_2nd_Ed.part06.rar
533. Grzimek_s_Encyclopedia_2nd_Ed.part07.rar
534. Grzimek_s_Encyclopedia_2nd_Ed.part08.rar
535. Grzimek_s_Encyclopedia_2nd_Ed.part09.rar
536. Grzimek_s_Encyclopedia_2nd_Ed.part10.rar
537. Guitar_Chord_Picture_Encyclopedia.rar
538. Icons_of_rock_an_encyclopedia_of_the_legends_who_changed_music_forever.pdf
539. Jack_The_Ripper_An_Encyclopedia.rar
540. Longman_s_-_Birds.rar
541. Longman_s_-_Classification.rar
542. Longman_s_-_Complete.rar
543. Longman_s_-_Fishes.rar
544. Longman_s_-_Mammals.rar
545. Longman_s_-_Reptiles.rar
546. Mackey_-_Encyclopedia_of_Freemasonry.rar
547. Magill_s_Encyclopedia_of_Science_-_Plant_Life.rar
548. Martial_arts_of_the_world_an_encyclopedia.rar
549. Materials_Handbook_An_Encyclopedia.rar
550. Medieval_Islamic_Civilization_An_Encyclopedia.rar
551. Philip_s_Astronomy_Encyclopedia.rar
552. Polar_Exploration_A_Historical_Encyclopedia.rar
553. Rhythm_Guitar_Encyclopedia.rar
554. Routledge_Encyclopedia_of_Philosophy_10_Vol.rar
555. Schirmer_Encyclopedia_Of_Film.rar
556. Shamanism-_An_Encyclopedia.rar
557. The_Airline_Encyclopedia_1909-2000__2002_Edition.rar
558. The_Anime_Encyclopedia.part1.rar
559. The_Anime_Encyclopedia.part2.rar
560. The_Anime_Encyclopedia_Japanese_Animation_Since_1917.part1.rar
561. The_Anime_Encyclopedia_Japanese_Animation_Since_1917.part2.rar
562. The_Crusades_An_Encyclopedia_4_Vol.rar
563. The_DC_Comics_Encyclopedia.part1.rar
564. The_DC_Comics_Encyclopedia.part2.rar
565. The_DC_Comics_Encyclopedia.part3.rar
566. The_DC_Comics_Encyclopedia.part4.rar
567. The_Disneyland_Encyclopedia.rar
568. The_Dream_Encyclopedia.rar
569. The_Encyclopedia_of_Birds__6-Volume_Illustrated_Set_.part1.rar
570. The_Encyclopedia_of_Birds__6-Volume_Illustrated_Set_.part2.rar
571. The_Encyclopedia_of_Country_Living__Updated_9th_Ed.rar
572. The_Encyclopedia_of_Ghosts_and_Spirits_3rd_Ed.rar
573. The_Encyclopedia_of_Serial_Killers.rar
574. The_Encyclopedia_Of_Unsolved_Crimes.rar
575. The_Encyclopedia_Of_Vampires__Werewolves_and_Monsters.rar
576. The_Essential_Batman_Encyclopedia.part1.rar
577. The_Essential_Batman_Encyclopedia.part2.rar
578. The_Essential_Batman_Encyclopedia.part3.rar
579. The_Gale_Encyclopedia_Of_Alternative_Medicine.rar
580. The_Gale_Encyclopedia_of_Biology.rar

  he_Gale_Encyclopedia_of_Children_s_Health.rar
582. The_Gale_Encyclopedia_Of_Endangered_Species.part1.rar
583. The_Gale_Encyclopedia_Of_Endangered_Species.part2.rar
584. The_Gale_Encyclopedia_Of_Fashion_Costume___Culture.rar
585. The_Gale_Encyclopedia_Of_Genetic_Disorders.rar
586. The_Gale_Encyclopedia_Of_Mathematics.rar
587. The_Gale_Encyclopedia_Of_Mental_Disorders.rar
588. The_Gale_Encyclopedia_Of_Neurological_Disorders.rar
589. The_Gale_Encyclopedia_of_Religion_2nd_ED.part1.rar
590. The_Gale_Encyclopedia_of_Religion_2nd_ED.part2.rar
591. The_Gale_Encyclopedia_Of_Russian_History.rar
592. The_Gale_Encyclopedia_Of_Science_3rd_ED.part1.rar
593. The_Gale_Encyclopedia_Of_Science_3rd_ED.part2.rar
594. The_Gale_Encyclopedia_Of_Surgery.rar
595. The_Gale_Encyclopedia_Of_The_Unusual___Unexplained.rar
596. The_Illustrated_Encyclopedia_Extraordinary_Automobiles.rar
597. The_International_Encyclopedia_of_Revolution_and_Protest_-_1500_to_the_Present.rar
598. The_Internet_Encyclopedia.rar
599. The_Mafia_Encyclopedia.rar
600. The_Mammoth_Encyclopedia_of_Science_Fiction.rar
601. The_Marvel_Comics_Encyclopedia.part01.rar
602. The_Marvel_Comics_Encyclopedia.part02.rar
603. The_Marvel_Comics_Encyclopedia.part03.rar
604. The_Marvel_Comics_Encyclopedia.part04.rar
605. The_Marvel_Comics_Encyclopedia.part05.rar
606. The_Marvel_Comics_Encyclopedia.part06.rar
607. The_Marvel_Comics_Encyclopedia.part07.rar
608. The_Marvel_Comics_Encyclopedia.part08.rar
609. The_Marvel_Comics_Encyclopedia.part09.rar
610. 388206707 The_Marvel_Comics_Encyclopedia.part10.rar
611. The_Princeton_Encyclopedia_Of_The_World_Economy.rar
612. The_Renaissance-_An_Encyclopedia_for_Students.rar
613. The_Routledge_Companion_to_the_Christian_Church.rar
614. The_Routledge_Encyclopedia_of_Social_and_Cultural_Anthropology.rar
615. The_Sage_Encyclopedia_of_Qualitative_Research_Methods.rar
616. The_Superhero_Book_The_Ultimate_Encyclopedia__2004_.rar
617. The_Ultimate_Encyclopedia_of_Comic_Book_Icons_and_Hollywood_Heroes.rar
618. The_World_Geographical_Encyclopedia.rar
619. Vegetable_Gardening_Encyclopedia.rar
620. Wiley_Encyclopedia_of_Telecommunications.rar

Friday 11 June 2010

Classic LED Flasher Circuit


Classic LED Flasher Circuit
This LED flasher circuit is a classic two transistor flip flop. This flasher circuit is very popular and it’s usually the first circuit to build when starting electronic circuit building hobby. Here is the schematic diagram of the famous LED flasher circuit:
How LED Flasher Circuit Works
The circuit consist of two transistors, two capacitors, four resistors, and two LEDs. When the power supply is first connected to this LED flasher circuit, both transistor is racing to be triggered first by the base current through 100k resistor. Actually when one transistor is triggered first than the other, the first activated transistor will behave like a closed switch, so the LED will turn ON and the base of the other transistor will be grounded through the capacitor. This grounding keep the first transistor to be activated and the second one to stay off untill the capacitor is charged above the bias voltage needed to activate the second transistor. After reaching this voltage, the second transistor will be switched on and now the second transistor will turn ON the LED on its collector, turning off the first transistor by grounding its base through the second capacitor. This alternating process will be repeated forever until the power supply is turned off. The flashing rate will depend on the resistors (100k) and the capacitors values. You can change the values of the capacitors to change the flashing frequency. Use a higher capacitance value for lower flashing rate, and vice verse.
LED Flasher Circuit Usage
LED flasher circuit gives a lot of fun for our christmas decoration, or as the core of our Halloween’s Jack-O-lanternsflashing eyes. You can use this LED flasher circuit for turn-sign of your car model, or as the safety flasher of your bicycles. Only your imagination could limit the usage of this LED flasher circuit.
google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);

Light Emitting Diodes (LEDs)

Light Emitting Diodes (LEDs)
FunctionLEDs emit light when an electric current passes through them.
Connecting and soldering LEDs must be connected the correct way round, the diagram may be labelled a or + for anode and k or - for cathode (yes, it really is k, not c, for cathode!). The cathode is the short lead and there may be a slight flat on the body of round LEDs. If you can see inside the LED the cathode is the larger electrode (but this is not an official identification method).
LEDs can be damaged by heat when soldering, but the risk is small unless you are very slow. No special precautions are needed for soldering most LEDs.

Testing an LEDNever connect an LED directly to a battery or power supply! It will be destroyed almost instantly because too much current will pass through and burn it out.
LEDs must have a resistor in series to limit the current to a safe value, for quick testing purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less. Remember to connect the LED the correct way round!
For an accurate value please see Calculating an LED resistor value below.

Colours of LEDs LEDs are available in red, orange, amber, yellow, green, blue and white. Blue and white LEDs are much more expensive than the other colours.
The colour of an LED is determined by the semiconductor material, not by the colouring of the 'package' (the plastic body). LEDs of all colours are available in uncoloured packages which may be diffused (milky) or clear (often described as 'water clear'). The coloured packages are also available as diffused (the standard type) or transparent.
Tri-colour LEDs The most popular type of tri-colour LED has a red and a green LED combined in one package with three leads. They are called tri-colour because mixed red and green light appears to be yellow and this is produced when both the red and green LEDs are on.
The diagram shows the construction of a tri-colour LED. Note the different lengths of the three leads. The centre lead (k) is the common cathode for both LEDs, the outer leads (a1 and a2) are the anodes to the LEDs allowing each one to be lit separately, or both together to give the third colour.
Bi-colour LEDsA bi-colour LED has two LEDs wired in 'inverse parallel' (one forwards, one backwards) combined in one package with two leads. Only one of the LEDs can be lit at one time and they are less useful than the tri-colour LEDs described above.

Sizes, Shapes and Viewing angles of LEDs
LED Clip
Photograph © Rapid ElectronicsLEDs are available in a wide variety of sizes and shapes. The 'standard' LED has a round cross-section of 5mm diameter and this is probably the best type for general use, but 3mm round LEDs are also popular.
Round cross-section LEDs are frequently used and they are very easy to install on boxes by drilling a hole of the LED diameter, adding a spot of glue will help to hold the LED if necessary. LED clips are also available to secure LEDs in holes. Other cross-section shapes include square, rectangular and triangular.
As well as a variety of colours, sizes and shapes, LEDs also vary in their viewing angle. This tells you how much the beam of light spreads out. Standard LEDs have a viewing angle of 60° but others have a narrow beam of 30° or less.
Rapid Electronics stock a wide selection of LEDs and their catalogue is a good guide to the range available.

Calculating an LED resistor value An LED must have a resistor connected in series to limit the current through the LED, otherwise it will burn out almost instantly.
The resistor value, R is given by:
R = (VS - VL) / I
VS = supply voltage VL = LED voltage (usually 2V, but 4V for blue and white LEDs) I = LED current (e.g. 10mA = 0.01A, or 20mA = 0.02A) Make sure the LED current you choose is less than the maximum permitted and convert the current to amps (A) so the calculation will give the resistor value in ohms (). To convert mA to A divide the current in mA by 1000 because 1mA = 0.001A.
If the calculated value is not available choose the nearest standard resistor value which is greater, so that the current will be a little less than you chose. In fact you may wish to choose a greater resistor value to reduce the current (to increase battery life for example) but this will make the LED less bright.
For exampleIf the supply voltage VS = 9V, and you have a red LED (VL = 2V), requiring a current I = 20mA = 0.020A, R = (9V - 2V) / 0.02A = 350, so choose 390 (the nearest standard value which is greater).
Working out the LED resistor formula using Ohm's lawOhm's law says that the resistance of the resistor, R = V/I, where: V = voltage across the resistor (= VS - VL in this case) I = the current through the resistor
So R = (VS - VL) / I
For more information on the calculations please see the Ohm's Law page.

Connecting LEDs in series If you wish to have several LEDs on at the same time it may be possible to connect them in series. This prolongs battery life by lighting several LEDs with the same current as just one LED.
All the LEDs connected in series pass the same current so it is best if they are all the same type. The power supply must have sufficient voltage to provide about 2V for each LED (4V for blue and white) plus at least another 2V for the resistor. To work out a value for the resistor you must add up all the LED voltages and use this for VL.
Example calculations: A red, a yellow and a green LED in series need a supply voltage of at least 3 × 2V + 2V = 8V, so a 9V battery would be ideal. VL = 2V + 2V + 2V = 6V (the three LED voltages added up). If the supply voltage VS is 9V and the current I must be 15mA = 0.015A, Resistor R = (VS - VL) / I = (9 - 6) / 0.015 = 3 / 0.015 = 200, so choose R = 220 (the nearest standard value which is greater).
Avoid connecting LEDs in parallel! Connecting several LEDs in parallel with just one resistor shared between them is generally not a good idea.
If the LEDs require slightly different voltages only the lowest voltage LED will light and it may be destroyed by the larger current flowing through it. Although identical LEDs can be successfully connected in parallel with one resistor this rarely offers any useful benefit because resistors are very cheap and the current used is the same as connecting the LEDs individually. If LEDs are in parallel each one should have its own resistor.

Reading a table of technical data for LEDsSuppliers' catalogues usually include tables of technical data for components such as LEDs. These tables contain a good deal of useful information in a compact form but they can be difficult to understand if you are not familiar with the abbreviations used.
The table below shows typical technical data for some 5mm diameter round LEDs with diffused packages (plastic bodies). Only three columns are important and these are shown in bold. Please see below for explanations of the quantities.
Type
Colour
IFmax.
VFtyp.
VFmax.
VRmax.
Luminousintensity
Viewingangle
Wavelength
Standard
Red
30mA
1.7V
2.1V
5V
5mcd @ 10mA
60°
660nm
Standard
Bright red
30mA
2.0V
2.5V
5V
80mcd @ 10mA
60°
625nm
Standard
Yellow
30mA
2.1V
2.5V
5V
32mcd @ 10mA
60°
590nm
Standard
Green
25mA
2.2V
2.5V
5V
32mcd @ 10mA
60°
565nm
High intensity
Blue
30mA
4.5V
5.5V
5V
60mcd @ 20mA
50°
430nm
Super bright
Red
30mA
1.85V
2.5V
5V
500mcd @ 20mA
60°
660nm
Low current
Red
30mA
1.7V
2.0V
5V
5mcd @ 2mA
60°
625nm
IF max.
Maximum forward current, forward just means with the LED connected correctly.
VF typ.
Typical forward voltage, VL in the LED resistor calculation. This is about 2V, except for blue and white LEDs for which it is about 4V.
VF max.
Maximum forward voltage.
VR max.
Maximum reverse voltage You can ignore this for LEDs connected the correct way round.
Luminous intensity
Brightness of the LED at the given current, mcd = millicandela.
Viewing angle
Standard LEDs have a viewing angle of 60°, others emit a narrower beam of about 30°.
Wavelength
The peak wavelength of the light emitted, this determines the colour of the LED. nm = nanometre.

Flashing LEDsFlashing LEDs look like ordinary LEDs but they contain an integrated circuit (IC) as well as the LED itself. The IC flashes the LED at a low frequency, typically 3Hz (3 flashes per second). They are designed to be connected directly to a supply, usually 9 - 12V, and no series resistor is required. Their flash frequency is fixed so their use is limited and you may prefer to build your own circuit to flash an ordinary LED, for example our Flashing LED project which uses a 555 astable circuit.

LED DisplaysLED displays are packages of many LEDs arranged in a pattern, the most familiar pattern being the 7-segment displays for showing numbers (digits 0-9). The pictures below illustrate some of the popular designs:
Bargraph
7-segment
Starburst
Dot matrix
Photographs © Rapid Electronics
Pin connections of LED displays
Pin connections diagram© Rapid ElectronicsThere are many types of LED display and a supplier's catalogue should be consulted for the pin connections. The diagram on the right shows an example from the Rapid Electronics catalogue. Like many 7-segment displays, this example is available in two versions: Common Anode (SA) with all the LED anodes connected together and Common Cathode (SC) with all the cathodes connected together. Letters a-g refer to the 7 segments, A/C is the common anode or cathode as appropriate (on 2 pins). Note that some pins are not present (NP) but their position is still numbered.
Also see: Display Drivers.

Monday 7 June 2010

Cấu tạo của các bộ đèn led


Các bộ đèn led có cấu tạo từ các bóng led nhỏ, các bóng led liên kết với nhau qua một bo mạch điện tử (bo mạch có chức năng trung gian cung cấp nguồn và tín hiệu điều khiển cho bóng led). Bóng led thông thường có 2 loại :

  • Mini Power Led : Công suất nhỏ hơn 0.5W
  • High Power Led : Công suất lớn hơn 0.5 W (0.5W,1W,2W..)


Thông thường sử dụng Mini Power Led cho các bộ đèn có kích thước nhỏ, có thể ứng dụng trong các khe hoặc không gian nhỏ hẹp, không phải lo về vấn đề nhiệt độ làm nóng xung quanh.


Ngược lại, High Power Led được sử dụng cho các bộ đèn có công suất lớn. Các bộ đèn này cần có kết cấu tản nhiệt tốt (thường bằng nhôm đúc ép) vì bóng High Power Led rất nóng. Bộ đèn không tỏa được nhiệt sẽ dẫn đến làm giảm quang thông (độ sáng) của bóng led và làm nhanh hư mạch điều khiển của bóng led. Đây là điều cần đặc biệt lưu ý đến khi mua các bộ đèn led.

LED (viết tắt của Light Emitting Diode, có nghĩa là điốt phát quang)

LED là gì?
LED (viết tắt của Light Emitting Diode, có nghĩa là điốt phát quang) là các điốt có khả năng phát ra ánh sáng hay tia hồng ngoại. Cũng giống như điốt, LED được cấu tạo từ một khối bán dẫn loại p ghép với một khối bán dẫn loại n.
Hoạt động của LED
Khối bán dẫn loại p chứa nhiều lỗ trống tự do mang điện tích dương nên khi ghép với khối bán dẫn n (chứa các điện tử tự do) thì các lỗ trống này có xu hướng chuyễn động khuếch tán sang khối n. Cùng lúc khối p lại nhận thêm các điện tử (điện tích âm) từ khối n chuyển sang. Kết quả là khối p tích điện âm (thiếu hụt lỗ trống và dư thừa điện tử) trong khi khối n tích điện dương (thiếu hụt điện tử và dư thừa lỗ trống).
Ở biên giới hai bên mặt tiếp giáp, một số điện tử bị lỗ trống thu hút và khi chúng tiến lại gần nhau, chúng có xu hướng kết hợp với nhau tạo thành các nguyên tử trung hòa. Quá trình này có thể giải phóng năng lượng dưới dạng ánh sáng (hay các bức xạ điện từ có bước sóng gần đó).
Tùy theo mức năng lượng giải phóng cao hay thấp mà bước sóng ánh sáng phát ra khác nhau (tức màu sắc của LED sẽ khác nhau). Mức năng lượng (và màu sắc của LED) hoàn toàn phụ thuộc vào cấu trúc năng lượng của các nguyên tử chất bán dẫn.
Ứng dụng
Đèn chiếu sáng sử dụng các LED phát ánh sáng trắng.
LED được dùng để làm bộ phận hiển thị trong các thiết bị điện, điện tử, đèn quảng cáo, trang trí, đèn giao thông.
Các LED phát ra tia hồng ngoại được dùng trong các thiết bị điều khiển từ xa cho đồ điện tử dân dụng.
Đèn LED trắng nói riêng và đèn LED nói chung có nhiều ứng dụng rộng rãi mà đèn huỳnh quang không làm được như đèn xe, đèn đường, đèn hầm mỏ, đèn chiếu hậu cho màn hình của điện thoại cầm tay, đèn chiếu hậu cho màn hình tinh thể lỏng (LCD), in ấn kỹ thuật số....
Một đặc điểm khác của đèn LED là ít tiêu hao năng lượng và không nóng. Bóng đèn truyền thống, đèn neon, đèn halogen... đều cần từ 110-220 V mới cháy được, trong khi đèn LED trắng chỉ cần từ 3-24 V để phát sáng. Do ít tiêu hao năng lượng nên đèn LED có thể sử dụng ở vùng sâu vùng xa mà không cần nhà máy phát điện công suất cao.

Với các ưu điểm : ánh sáng lớn, độ bền cao và ít tiêu tốn điện năng, Led được ứng dụng rộng rãi trên các lĩnh vực: bảng quảng cáo ngoài trời , bảng quang báo, đồng hồ cỡ lớn đặt tại các biển quảng cáo tấm lớn trên đường cao tốc, hệ thống đèn giao thông, biển chỉ dẫn, và các sản phẩm khác như bảng chạy chữ điện tử, bảng hệ thống giờ, Bảng tỷ giá, bảng chứng khóan, hệ thống xếp hàng tự động…
Một số bảng hiệu của thương hiệu nổi tiếng đã được ứng dụng sản phẩm Led: Sacombank, Sơn Collection, bảng hiệu Mì Hàn Quốc, Happy Cook , Sam Sung…

Saturday 31 October 2009

Running Small Motors with PIC Microcontrollers (Kindle Edition)


Author: Sandhu, H
ISBN: 0071633510
ISBN 13: 9780071633512
Published by: MCGRAW-HILL
Date Published: Sep 2009
User level: Intermediate/Advance
Pages: 334
RRP: £19.99




Product Information

This is the only comprehensive guide to using PIC microcontrollers to drive small motors. This easy-to-follow tutorial explores the techniques - both in hardware and software - that you need to understand in order to run small motors with PIC microcontrollers. All material is covered in a non-mathematical way so anyone interested in computer control of motors can do so even with a minimal technical background. "Running Small Motors with PIC Microcontrollers" contains more than 2,000 lines of PicBasicPro code and dozens of circuit diagrams with the focus on controlling motors. Hands-on tutorials, program listings, and resources are included.

Part I: Microcontrollers Chapter 1. Introduction to microEngineering Labs' LAB-X1 Experimental Board Chapter 2. Getting Started Chapter 3. Understanding the Microchip Technology PIC 16F877A: Features of the MCU Chapter 4. The Software, Compilers, and Editors Chapter 5. Controlling the Output and Reading the Input Chapter 6. Timers and Counters Chapter 7. Clocks and Memory: Sockets U3, U4, U5, U6, U7 and U8 Chapter 8. Serial Communications: Sockets U9 and U10 Chapter 9. Using Liquid Crystal Displays: An Information Resource Part II: Running the Motors Chapter 10. The PIC 18F4331 Microcontroller: A Minimal Introduction Chapter 11. Running Motors: A Preliminary Discussion Chapter 12. Motor Amplifiers Chapter 13. Running Hobby R/C Servo Motors Chapter 14. Running Small DC Motors with Permanent Magnet Fields Chapter 15. Running DC Motors with Attached Incremental Encoders Chapter 16. Running Bipolar Stepper Motors Chapter 17. Running Small AC Motors: Using Solenoids and Relays Chapter 18. Debugging and Troubleshooting Chapter 19. Conclusion Part III: Appendixes Appendix A. Setting Up Compiler for One Keystroke Operation Appendix B. Abbreviations Used in the Book and in the Data Sheets Appendix C. The Book Support Web Site Appendix D. Sources of Materials Appendix E. Motor Control Language: Some Minimal Ideas, Guidance, and Notes Index

by Harprit Singh Sandhu (Author)

Friday 30 October 2009

Peripheral Interface Controller

PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1640[1] originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral Interface Controller".

PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability.

Microchip announced on February 2008 the shipment of its six billionth PIC processor.

Contents

Core architecture

The PIC architecture is distinctively minimalist. It is characterized by the following features:

  • Separate code and data spaces (Harvard architecture)
  • A small number of fixed length instructions
  • Most instructions are single cycle execution (4 clock cycles), with single delay cycles upon branches and skips
  • A single accumulator (W), the use of which (as source operand) is implied (i.e. is not encoded in the opcode)
  • All RAM locations function as registers as both source and/or destination of math and other functions.[2]
  • A hardware stack for storing return addresses
  • A fairly small amount of addressable data space (typically 256 bytes), extended through banking
  • Data space mapped CPU, port, and peripheral registers
  • The program counter is also mapped into the data space and writable (this is used to implement indirect jumps).

Unlike most other CPUs, there is no distinction between memory space and register space because the RAM serves the job of both memory and registers, and the RAM is usually just referred to as the register file or simply as the registers.

Data space (RAM)

PICs have a set of registers that function as general purpose RAM. Special purpose control registers for on-chip hardware resources are also mapped into the data space. The addressability of memory varies depending on device series, and all PIC devices have some banking mechanism to extend the addressing to additional memory. Later series of devices feature move instructions which can cover the whole addressable space, independent of the selected bank. In earlier devices (i.e., the baseline and mid-range cores), any register move had to be achieved via the accumulator.

To implement indirect addressing, a "file select register" (FSR) and "indirect register" (INDF) are used: A register number is written to the FSR, after which reads from or writes to INDF will actually be to or from the register pointed to by FSR. Later devices extended this concept with post- and pre- increment/decrement for greater efficiency in accessing sequentially stored data. This also allows FSR to be treated almost like a stack pointer.

External data memory is not directly addressable except in some high pin count PIC18 devices.

Code space

All PICs feature Harvard architecture, so the code space and the data space are separate. PIC code space is generally implemented as EPROM, ROM, or flash ROM.

In general, external code memory is not directly addressable due to the lack of an external memory interface. The exceptions are PIC17 and select high pin count PIC18 devices.[5]

Word size

The word size of PICs can be a source of confusion. All PICs handle (and address) data in 8-bit chunks, so they should be called 8-bit microcontrollers. However, the unit of addressability of the code space is not generally the same as the data space. For example, PICs in the baseline and mid-range families have program memory addressable in the same wordsize as the instruction width, ie. 12 or 14 bits respectively. In contrast, in the PIC18 series, the program memory is addressed in 8-bit increments (bytes), which differs from the instruction width of 16 bits.

In order to be clear, the program memory capacity is usually stated in number of (single word) instructions, rather than in bytes.

Stacks

PICs have a hardware call stack, which is used to save return addresses. The hardware stack is not software accessible on earlier devices, but this changed with the 18 series devices.

Hardware support for a general purpose parameter stack was lacking in early series, but this greatly improved in the 18 series, making the 18 series architecture more friendly to high level language compilers.

Instruction set

A PIC's instructions vary from about 35 instructions for the low-end PICs to over 80 instructions for the high-end PICs. The instruction set includes instructions to perform a variety of operations on registers directly, the accumulator and a literal constant or the accumulator and a register, as well as for conditional execution, and program branching.

Some operations, such as bit setting and testing, can be performed on any numbered register, but bi-operand arithmetic operations always involve W; writing the result back to either W or the other operand register. To load a constant, it is necessary to load it into W before it can be moved into another register. On the older cores, all register moves needed to pass through W, but this changed on the "high end" cores.

PIC cores have skip instructions which are used for conditional execution and branching. The skip instructions are: 'skip if bit set', and, 'skip if bit not set'. Because cores before PIC18 had only unconditional branch instructions, conditional jumps are implemented by a conditional skip (with the opposite condition) followed by an unconditional branch. Skips are also of utility for conditional execution of any immediate single following instruction.

The PIC architecture has no (or very meager) hardware support for automatically saving processor state when servicing interrupts. The 18 series improved this situation by implementing shadow registers which save several important registers during an interrupt.

In general, PIC instructions fall into 5 classes:

  1. Operation on W with 8-bit immediate ("literal") operand. E.g. movlw (move literal to W), andlw (AND literal with W). One instruction peculiar to the PIC is retlw, load immediate into W and return, which is used with computed branches to produce lookup tables.
  2. Operation with W and indexed register. The result can be written to either the W register (e.g. addwf reg,w). or the selected register (e.g. addwf reg,f).
  3. Bit operations. These take a register number and a bit number, and perform one of 4 actions: set or clear a bit, and test and skip on set/clear. The latter are used to perform conditional branches. The usual ALU status flags are available in a numbered register so operations such as "branch on carry clear" are possible.
  4. Control transfers. Other than the skip instructions previously mentioned, there are only two: goto and call.
  5. A few miscellaneous zero-operand instructions, such as return from subroutine, and sleep to enter low-power mode.

Performance

Many of these architectural decisions are directed at the maximization of top-end speed, or more precisely of speed-to-cost ratio. The PIC architecture was among the first scalar CPU designs, and is still among the simplest and cheapest. The Harvard architecture—in which instructions and data come from conveniently separate sources—simplifies timing and microcircuit design greatly, and this pays benefits in areas like clock speed, price, and power consumption.

The PIC is particularly suited to implementation of fast lookup tables in the program space. Such lookups are O(1) and can complete via a single instruction taking two instruction cycles. Basically any function can be modelled in this way. Such optimization is facilitated by the relatively large program space of the PIC (e.g. 4096 x 14-bit words on the 16F690) and by the design of the instruction set, which allows for embedded constants.

The simplicity of the PIC, and its scalar nature, also serve to greatly simplify the construction of real-time code. It is typically possible to multiply the line count of a PIC assembler listing by the instruction cycle time to determine execution time. (This is true because skip-based instructions take 2 cycles whether the skip occurs or doesn't.) On other CPUs (even the Atmel, with its MUL instruction), such quick methods are just not possible. In low-level development, precise timing is often critical to the success of the application, and the real-time features of the PIC can save crucial engineering time.

A similarly useful and unique property of PICs is that their interrupt latency is constant (it's also low: 3 instruction cycles). The delay is constant even though instructions can take one or two instruction cycles: a dead cycle is optionally inserted into the interrupt response sequence to make this true. External interrupts have to be synchronized with the four clock instruction cycle, otherwise there can be a one instruction cycle jitter. Internal interrupts are already synchronized.

The constant interrupt latency allows PICs to achieve interrupt driven low jitter timing sequences. An example of this is a video sync pulse generator. Other microcontrollers can do this in some cases, but it's awkward. The non-interrupt code has to anticipate the interrupt and enter into a sleep state before it arrives. On PICs, there is no need for this.

The three-cycle latency is increased in practice because the PIC does not store its registers when entering the interrupt routine. Typically, 4 instructions are needed to store the W-register, the status register and switch to a specific bank before starting the actual interrupt processing.

Limitations

The PIC architectures have several limitations:

  • Only a single accumulator
  • A small instruction set
  • Operations and registers are not orthogonal; some instructions can address RAM and/or immediate constants, while others can only use the accumulator
  • Memory must be directly referenced in arithmetic and logic operations, although indirect addressing is available via 2 additional registers
  • Register-bank switching is required to access the entire RAM of many devices, making position-independent code complex and inefficient

The following limitations have been addressed in the PIC18, but still apply to earlier cores:

  • Conditional skip instructions are used instead of conditional jump instructions used by most other architectures
  • Indexed addressing mode is very rudimentary
  • Stack:
    • The hardware call stack is so small that program structure must often be flattened
    • The hardware call stack is not addressable, so pre-emptive task switching cannot be implemented
    • Software-implemented stacks are not efficient, so it is difficult to generate reentrant code and support local variables
  • Program memory is not directly addressable, and thus space-inefficient and/or time-consuming to access. (This is true of most Harvard architecture microcontrollers.)

With paged program memory, there are two page sizes to worry about: one for CALL and GOTO and another for computed GOTO (typically used for table lookups). For example, on PIC16, CALL and GOTO have 11 bits of addressing, so the page size is 2KB. For computed GOTOs, where you add to PCL, the page size is 256 bytes. In both cases, the upper address bits are provided by the PCLATH register. This register must be changed every time control transfers between pages. PCLATH must also be preserved by any interrupt handler.[6]

Compiler development

These properties have made it difficult to develop compilers that target PIC microcontrollers. While several commercial compilers are available, in 2008, Microchip finally released their C compilers, C18, and C30 for their line of 18f 24f and 30/33f processors. By contrast, Atmel's AVR microcontrollers—which are competitive with PIC in terms of hardware capabilities and price, but feature a RISC instruction set—have long been supported by the GNU C Compiler.

Also, because of these properties, PIC assembly language code can be difficult to comprehend. Judicious use of simple macros can make PIC assembly language much more palatable, but at the cost of a reduction in performance. For example, the original Parallax PIC assembler ("SPASM") has macros which hide W and make the PIC look like a two-address machine. It has macro instructions like "mov b,a" (move the data from address a to address b) and "add b,a" (add data from address a to data in address b). It also hides the skip instructions by providing three operand branch macro instructions such as "cjne a,b,dest" (compare a with b and jump to dest if they are not equal).

Family Core Architectural Differences

Baseline Core Devices

These devices feature a 12-bit wide code memory, a 32-byte register file, and a tiny two level deep call stack. They are represented by the PIC10 series, as well as by some PIC12 and PIC16 devices. Baseline devices are available in 6-pin to 40-pin packages.

Generally the first 7 to 9 bytes of the register file are special-purpose registers, and the remaining bytes are general purpose RAM. If banked RAM is implemented, the bank number is selected by the high 3 bits of the FSR. This affects register numbers 16–31; registers 0–15 are global and not affected by the bank select bits.

The ROM address space is 512 words (12 bits each), which may be extended to 2048 words by banking. CALL and GOTO instructions specify the low 9 bits of the new code location; additional high-order bits are taken from the staus register. Note that a CALL instruction only includes 8 bits of address, and may only specify addresses in the first half of each 512-word page.

The instruction set is as follows. Register numbers are referred to as "f", while constants are referred to as "k". Bit numbers (0–7) are selected by "b". The "d" bit selects the destination: 0 indicates W, while 1 indicates that the result is written back to source register f.

12-bit PIC instruction set
Opcode (binary) Mnemonic Description
0000 0000 0000 NOP No operation
0000 0000 0010 OPTION Load OPTION register with contents of W
0000 0000 0011 SLEEP Go into standby mode
0000 0000 0100 CLRWDT Reset watchdog timer
0000 0000 01ff TRIS f Move W to port control register (f=1..3)

0000 001 fffff MOVWF f Move W to f
0000 010 xxxxx CLRW Clear W to 0 (a.k.a CLR x,W)
0000 011 fffff CLRF f Clear f to 0 (a.k.a. CLR f,F)
0000 10d fffff SUBWF f,d Subtract W from f (d = f − W)
0000 11d fffff DECF f,d Decrement f (d = f − 1)
0001 00d fffff IORWF f,d Inclusive OR W with F (d = f OR W)
0001 01d fffff ANDWF f,d AND W with F (d = f AND W)
0001 10d fffff XORWF f,d Exclusive OR W with F (d = f XOR W)
0001 11d fffff ADDWF f,d Add W with F (d = f + W)
0010 00d fffff MOVF f,d Move F (d = f)
0010 01d fffff COMF f,d Complement f (d = NOT f)
0010 10d fffff INCF f,d Increment f (d = f + 1)
0010 11d fffff DECFSZ f,d Decrement f (d = f − 1) and skip if zero
0011 00d fffff RRF f,d Rotate right F (rotate right through carry)
0011 01d fffff RLF f,d Rotate left F (rotate left through carry)
0011 10d fffff SWAPF f,d Swap 4-bit halves of f (d = f<<4>>4)
0011 11d fffff INCFSZ f,d Increment f (d = f + 1) and skip if zero

0100 bbb fffff BCF f,b Bit clear f (Clear bit b of f)
0101 bbb fffff BSF f,b Bit set f (Set bit b of f)
0110 bbb fffff BTFSC f,b Bit test f, skip if clear (Test bit b of f)
0111 bbb fffff BTFSS f,b Bit test f, skip if set (Test bit b of f)

1000 kkkkkkkk RETLW k Set W to k and return
1001 kkkkkkkk CALL k Save return address, load PC with k
101 kkkkkkkkk GOTO k Jump to address k (9 bits!)
1100 kkkkkkkk MOVLW k Move literal to W (W = k)
1101 kkkkkkkk IORLW k Inclusive or literal with W (W = k OR W)
1110 kkkkkkkk ANDLW k AND literal with W (W = k AND W)
1111 kkkkkkkk XORLW k Exclusive or literal with W (W = k XOR W)

Mid-Range Core Devices

These devices feature a 14-bit wide code memory, and an improved 8 level deep call stack. The instruction set differs very little from the baseline devices, but the increased opcode width allows 128 registers and 2048 words of code to be directly addressed. The mid-range core is available in the majority of devices labeled PIC12 and PIC16.

The first 32 bytes of the register space are allocated to special-purpose registers; the remaining 96 bytes are used for general-purpose RAM. If banked RAM is used, the high 16 registers (0x70–0x7F) are global, as are a few of the most important special-purpose registers, including the STATUS register which holds the RAM bank select bits. (The other global registers are FSR and INDF, the low 8 bits of the program counter PCL, the PC high preload register PCLATH, and the master interrupt control register INTCON.)

The PCLATH register supplies high-order instruction address bits when the 8 bits supplied by a write to the PCL register, or the 11 bits supplied by a GOTO or CALL instruction, is not sufficient to address the available ROM space.

14-bit PIC instruction set
Opcode (binary) Mnemonic Description
00 0000 0000 0000 NOP No operation
00 0000 0000 1000 RETURN Return from subroutine, W unchanged
00 0000 0000 1001 RETFIE Return from interrupt
00 0000 0110 0010 OPTION Write W to OPTION register
00 0000 0110 0011 SLEEP Go into standby mode
00 0000 0110 0100 CLRWDT Reset watchdog timer
00 0000 0110 01ff TRIS f Write W to tristate register f

00 0000 1 fffffff MOVWF f Move W to f
00 0001 0 xxxxxxx CLRW Clear W to 0 (W = 0)
00 0001 1 fffffff CLRF f Clear f to 0 (f = 0)
00 0010 d fffffff SUBWF f,d Subtract W from f (d = f − W)
00 0011 d fffffff DECF f,d Decrement f (d = f − 1)
00 0100 d fffffff IORWF f,d Inclusive OR W with F (d = f OR W)
00 0101 d fffffff ANDWF f,d AND W with F (d = f AND W)
00 0110 d fffffff XORWF f,d Exclusive OR W with F (d = f XOR W)
00 0111 d fffffff ADDWF f,d Add W with F (d = f + W)
00 1000 d fffffff MOVF f,d Move F (d = f)
00 1001 d fffffff COMF f,d Complement f (d = NOT f)
00 1010 d fffffff INCF f,d Increment f (d = f + 1)
00 1011 d fffffff DECFSZ f,d Decrement f (d = f − 1) and skip if zero
00 1100 d fffffff RRF f,d Rotate right F (rotate right through carry)
00 1101 d fffffff RLF f,d Rotate left F (rotate left through carry)
00 1110 d fffffff SWAPF f,d Swap 4-bit halves of f (d = f<<4>>4)
00 1111 d fffffff INCFSZ f,d Increment f (d = f + 1) and skip if zero

01 00 bbb fffffff BCF f,b Bit clear f (Clear bit b of f)
01 01 bbb fffffff BSF f,b Bit set f (Set bit b of f)
01 10 bbb fffffff BTFSC f,b Bit test f, skip if clear (Test bit b of f)
01 11 bbb fffffff BTFSS f,b Bit test f, skip if set (Test bit b of f)

10 0 kkkkkkkkkkk CALL k Save return address, load PC with k
10 1 kkkkkkkkkkk GOTO k Jump to address k (11 bits)

11 00xx kkkkkkkk MOVLW k Move literal to W (W = k)
11 01xx kkkkkkkk RETLW k Set W to k and return
11 1000 kkkkkkkk IORLW k Inclusive or literal with W (W = k OR W)
11 1001 kkkkkkkk ANDLW k AND literal with W (W = k AND W)
11 1010 kkkkkkkk XORLW k Exclusive or literal with W (W = k XOR W)
11 110x kkkkkkkk SUBLW k Subtract W from literal (W = k − W)
11 111x kkkkkkkk ADDLW k Add literal to W (W = k + W)

PIC17 High End Core Devices

The 17 series never became popular and has been superseded by the PIC18 architecture. It is not recommended for new designs, and availability may be limited.

Improvements over earlier cores are 16-bit wide opcodes (allowing many new instructions), and a 16 level deep call stack. PIC17 devices were produced in packages from 40 to 68 pins.

The 17 series introduced a number of important new features:

  • a memory mapped accumulator
  • read access to code memory (table reads)
  • direct register to register moves (prior cores needed to move registers through the accumulator)
  • an external program memory interface to expand the code space
  • an 8bit x 8bit hardware multiplier
  • a second indirect register pair
  • auto-increment/decrement addressing controlled by control bits in a status register (ALUSTA)

[edit] PIC18 High End Core Devices

Microchip introduced the PIC18 architecture in 2002. [3] Unlike the 17 series, it has proven to be very popular, with a large number of device variants presently in manufacture. In contrast to earlier devices, which were more often than not programmed in assembly, C has become the predominant development language[4].

The 18 series inherits most of the features and instructions of the 17 series, while adding a number of important new features:

  • much deeper call stack (31 levels deep)
  • the call stack may be read and written
  • conditional branch instructions
  • indexed addressing mode (PLUSW)
  • extending the FSR registers to 12 bits, allowing them to linearly address the entire data address space
  • the addition of another FSR register (bringing the number up to 3)

The auto increment/decrement feature was improved by removing the control bits and adding four new indirect registers per FSR. Depending on which indirect file register is being accessed it is possible to postdecrement, postincrement, or preincrement FSR; or form the effective address by adding W to FSR.

In more advanced PIC18 devices, an "extended mode" is available which makes the addressing even more favorable to compiled code:

  • a new offset addressing mode; some addresses which were relative to the access bank are now interpreted relative to the FSR2 register
  • the addition of several new instructions, notable for manipulating the FSR registers.

These changes were primarily aimed at improving the efficiency of a data stack implementation. If FSR2 is used either as the stack pointer or frame pointer, stack items may be easily indexed—allowing more efficient re-entrant code. Microchip C18 chooses to use FSR2 as a frame pointer.

PIC24 and dsPIC 16-bit Microcontrollers

In 2001, Microchip introduced the dsPIC series of chips[7], which entered mass production in late 2004. They are Microchip's first inherently 16-bit microcontrollers. PIC24 devices are designed as general purpose microcontrollers. dsPIC devices include digital signal processing capabilities in addition.

Architecturally, although they share the PIC moniker, they are very different from the 8-bit PICs. The most notable differences are[8]

  • they feature a set of 16 working registers
  • they fully support a stack in RAM, and do not have a hardware stack
  • bank switching is not required to access RAM or special function registers
  • data stored in program memory can be accessed directly using a feature called Program Space Visibility
  • interrupt sources may be assigned to distinct handlers using an interrupt vector table

Some features are:

dsPICs can be programmed in C using a variant of gcc.

[edit] PIC32 32-bit Microcontrollers

In November 2007 Microchip introduced the new PIC32MX family of 32-bit microcontrollers. The initial device line-up is based on the industry standard MIPS32 M4K Core[5]. The device can be programmed using the Microchip MPLAB C Compiler for PIC32 MCUs, a variant of the GCC compiler. The first 18 models currently in production (PIC32MX3xx and PIC32MX4xx) are pin to pin compatible and share the same peripherals set with the PIC24FxxGA0xx family of (16-bit) devices allowing the use of common libraries, software and hardware tools.

The PIC32 architecture brings a number of new features to Microchip portfolio, including:

  • The highest execution speed 80 MIPS (90+ Dhrystone MIPS @80MHz)
  • The largest FLASH memory: 512kbyte
  • One instruction per clock cycle execution
  • The first cached processor
  • Allows execution from RAM
  • Full Speed Host/Dual Role and OTG USB capabilities
  • Full JTAG and 2 wire programming and debugging
  • Real-time trace

[edit] Device Variants and Hardware Features

PIC devices generally feature:

  • Sleep mode (power savings).
  • Watchdog timer.
  • Various crystal or RC oscillator configurations, or an external clock.

Variants

Within a series, there are still many device variants depending on what hardware resources the chip features.

Trends

The first generation of PICs with EPROM storage are almost completely replaced by chips with Flash memory. Likewise, the original 12-bit instruction set of the PIC1650 and its direct descendants has been superseded by 14-bit and 16-bit instruction sets. Microchip still sells OTP (one-time-programmable) and windowed (UV-erasable) versions of some of its EPROM based PICs for legacy support or volume orders. It should be noted that the Microchip website lists PICs that are not electrically erasable as OTP despite the fact that UV erasable windowed versions of these chips can be ordered.

[edit] History

The original PIC was built to be used with General Instruments' new 16-bit CPU, the CP1600. While generally a good CPU, the CP1600 had poor I/O performance, and the 8-bit PIC was developed in 1975 to improve performance of the overall system by offloading I/O tasks from the CPU. The PIC used simple microcode stored in ROM to perform its tasks, and although the term wasn't used at the time, it shares some common features with RISC designs.

In 1985 General Instruments spun off their microelectronics division, and the new ownership canceled almost everything — which by this time was mostly out-of-date. The PIC, however, was upgraded with internal EPROM to produce a programmable channel controller, and today a huge variety of PICs are available with various on-board peripherals (serial communication modules, UARTs, motor control kernels, etc.) and program memory from 256 words to 64k words and more (a "word" is one assembly language instruction, varying from 12, 14 or 16 bits depending on the specific PIC micro family).

PIC and PICmicro are registered trademarks of Microchip Technology. It is generally thought that PIC stands for Peripheral Interface Controller, although General Instruments' original acronym for the initial PIC1640 and PIC1650 devices was "Programmable Interface Controller".[2] The acronym was quickly replaced with "Programmable Intelligent Computer".[3]

Various older (EPROM) PIC microcontrollers

The Microchip 16C84 (PIC16x84), introduced in 1993[6] was the first[citation needed] CPU with on-chip EEPROM memory. This electrically-erasable memory made it cost less than CPUs that required a quartz "erase window" for erasing EPROM.

Development Tools

Commercially Supported

Microchip provides a freeware IDE package called MPLAB, which includes an assembler, linker, software simulator, and debugger. They also sell C compilers for the PIC18 and dsPIC which integrate cleanly with MPLAB. Free student versions of the C compilers are also available with all features. But for the free versions, optimizations will be disabled after 60 days.[9]

Several third parties make C,[10] BASIC[11] and Pascal[12] language compilers for PICs, many of which integrate to MPLAB and/or feature their own IDE.

A blockset[13] for Matlab/Simulink allow one to generate C and binary files from a simulink model. Most common peripherals have their blocksets and you do not need to write the configuration code.

Open Source

The following development tools are available for the PIC family under the GPL or other free software or open sources licenses.

FreeRTOS is a mini real time kernel ported to PIC18, PIC24, dsPIC and PIC32 architectures.

GPUTILS is a set of PIC utilities comprising an assembler, a disassembler, a linker and an object file viewer.

GPSIM is an Open Source simulator for the PIC microcontrollers featuring hardware modules that simulate specific devices that might be connected to them, like LCDs.

SDCC is a C compiler supporting 8-bit PIC micro controllers (PIC16, PIC18). Currently, throughout the SDCC website, the words, "Work is in progress", are frequently used to describe the status of SDCC's support for PICs.

File:Flowcode.png
KTechlab, a OpenSource microcontroller IDE written in c++ and qt. Ktechlab supports the programming of microcontrollers using C, Assembly, Microbe (a BASIC-like language) and using flowcode a graphical programming language similar to Flowcode

Ktechlab is a free IDE for programming PIC Microcontroller. It allows one to write the program in C, Assembly, Microbe (a BASIC-like language) and using FlowChart Method.

PiKdev [7] runs on Linux and is a simple graphic IDE for the development of PIC-based applications. It currently supports assembly language. Non Open Source C language (Currently free 1/22/07) is also supported for PIC 18 devices. PiKdev is developed in C++ under Linux and is based on the KDE environment.

Piklab is a forked version of PiKdev and is managed as SourceForge Project. Piklab adds to Pikdev by providing support for programmers and debuggers. Currently, Piklab supports the JDM, PIC Elmer, K8048, HOODMICRO, ICD1, ICD2, PICkit1, PICKkit2, and PicStart+ as programming devices and has debugging support for ICD2 in addition to using the simulator, GPSim.[14]

JAL [8] stands for Just Another Language. It is a Pascal-like language that is easily mastered. The compiler supports a few Microchip (16c84, 16f84, 12c508, 12c509, 16F877) and SX microcontrollers. The resulting assembly language can then be viewed, modified and further processed as if you were programming directly in assembler.

PMP (Pic Micro Pascal) is a free Pascal language compiler and IDE. It is intended to work with Microchip MPLAB that it uses device definition files, assembler and linker. It supports PIC10 to PIC18 devices.

The GNU Compiler Collection and the GNU Binutils have been ported to the PIC24, dsPIC30F and dsPIC33F in the form of Microchip's MPLAB C30 compiler and MPLAB ASM30 Assembler.

MIOS is a real-time operating system written in PIC assembly, optimized for MIDI processing and other musical control applications. There is a C wrapper for higher level development. Currently it runs on the MIDIbox Hardware Platform.

FlashForth [9] is a native Forth operating system for the PIC18F and the dsPIC30F series. It makes the PIC a standalone computer with an interpreter, compiler, assembler and multitasker.

Great Cow Basic (GCBasic) [10] The syntax of Great Cow BASIC is based on that of QBASIC/FreeBASIC. The assembly code produced by Great Cow BASIC can be assembled and run on almost all 10, 12, 16 and 18 series PIC chips.

Device Programmers

A development board for low pin-count MCU, from Microchip

Devices called "programmers" are traditionally used to get program code into the target PIC. Most PICs that Microchip currently sell feature ICSP (In Circuit Serial Programming) and/or LVP (Low Voltage Programming) capabilities, allowing the PIC to be programmed while it is sitting in the target circuit. ICSP programming is performed using two pins, clock and data, while a high voltage (12V) is present on the Vpp/MCLR pin. Low voltage programming dispenses with the high voltage, but reserves exclusive use of an I/O pin and can therefore be disabled to recover the pin for other uses (once disabled it can only be re-enabled using high voltage programming).

There are many programmers for PIC microcontrollers, ranging from the extremely simple designs which rely on ICSP to allow direct download of code from a host computer, to intelligent programmers that can verify the device at several supply voltages. Many of these complex programmers use a pre-programmed PIC themselves to send the programming commands to the PIC that is to be programmed. The intelligent type of programmer is needed to program earlier PIC models (mostly EPROM type) which do not support in-circuit programming.

Many of the higher end flash based PICs can also self-program (write to their own program memory). Demo boards are available with a small bootloader factory programmed that can be used to load user programs over an interface such as RS-232 or USB, thus obviating the need for a programmer device. Alternatively there is bootloader firmware available that the user can load onto the PIC using ICSP. The advantages of a bootloader over ICSP is the far superior programming speeds, immediate program execution following programming, and the ability to both debug and program using the same cable.

Microchip Programmers

Microchip PICSTART Plus programmer

There are many programmers/debuggers available directly from Microchip.

Current Microchip Programmers (as of 3/2009)[15]

  • PICStart Plus (RS232 serial interface) : intelligent.
  • PRO MATE II (RS232 serial interface) : intelligent.
  • MPLAB PM3 (RS232 serial and USB interface)
  • MPLAB ICD2 (RS232 serial and USB 1.0 interface) : ICSP programming only
  • MPLAB REAL ICE (USB 2.0 interface) : ICSP programming only
  • PICKit 2 (USB interface)
  • PICKit 3 (USB interface)
  • ICD 3 (USB interface)

Legacy Microchip Programmers

Third-Party Programmers

There are programmers available from other sources, ranging from plans to build your own, to self-assembly kits and fully tested ready-to-go units. Some are simple designs which require a PC to do the low-level programming signalling (these typically connect to the serial or parallel port and consist of a few simple components), while others have the programming logic built into them (these typically use a serial or USB connection, are usually faster, and are often built using PICs themselves for control). For a directory of PIC related tools and websites, see PIC microcontroller at the Open Directory Project. These are some common programmer types:

  • Simple serial port ICSP programmers
    • These generally rely on driving the PIC's Vss line negative to get the necessary voltage differences from programming. Hence they are compact and cheap but great care is needed if using them for in circuit programming.
  • Simple parallel port ICSP programmers
    • Simple to understand but often have much higher part counts and generally require external power supplies.
  • Intelligent programmers (some use USB port)
    • Generally faster and more reliable (especially on laptops which tend to have idiosyncrasies in the way they implement their ports) but far more complex to build (in particular they tend to use a PIC in the programmer which must itself be programmed somehow).

Here are some programmers available:

Usbpicprog
  • usbpicprog, an open source USB PIC programmer usbpicprog
  • Open Programmer, another open source USB programmer for PICmicro and I2C EEPROM, using HID class OpenProgrammer
  • home-made ICSP JDM Pic
  • DIY PIC and EEPROM programmer with ICSP support. PCB files, photos and detailed information are also provided.
  • PIC PRESTO that supports ICSP, ISP, JTAG, I2C, SPI, Microwire interfaces, works on USB and complies with programming specifications
  • home-made ICSP with external powersupply based on JDM: BobProg (Romanian)

The major problem of home-made or very simple programmers is that these programmers do not comply with programming specifications and this can cause premature loss of data in the flash or EEPROM[citation needed].

Debugging

Software Emulation

MPLAB (which is a free download) includes a software emulator for PICs. However, software emulation of a microcontroller will always suffer from limited simulation of the device's interactions with its target circuit.

Proteus VSM is a commercial software product developed by Labcenter Electronics which allows simulation of many PICmicro devices along with a wide array of peripheral devices. This method can help bridge the gap between the limited peripheral support offered by the MPLAB simulator and traditional in-circuit debugging/emulating. The product interfaces directly with MPLAB to offer a schematic display of signals and peripheral devices.

KTechLab is a free and open source circuit simulator for KDE which features simulating some types of PIC microcontrollers besides many other analog and digital parts.

Piklab is a free and open source IDE for developing PIC software on KDE. Piklab is able to simulate and debug PIC software using another free and open source tool called gpsim as a backend.

In-Circuit Debugging

Later model PICs feature an ICD (in-circuit debugging) interface, built into the CPU core. ICD debuggers (MPLAB ICD2 and other third party) can communicate with this interface using three lines. This cheap and simple debugging system comes at a price however, namely limited breakpoint count (1 on older pics 3 on newer PICs), loss of some IO (with the exception of some surface mount 44-pin PICs which have dedicated lines for debugging) and loss of some features of the chip. For small PICs, where the loss of IO caused by this method would be unacceptable, special headers are made which are fitted with PICs that have extra pins specifically for debugging.

In-Circuit Emulators

Microchip offers three full in circuit emulators: the MPLAB ICE2000 (parallel interface, a USB converter is available); the newer MPLAB ICE4000 (USB 2.0 connection); and most recently, the REAL ICE. All of these ICE tools can be used with the MPLAB IDE for full source-level debugging of code running on the target.

The ICE2000 requires emulator modules, and the test hardware must provide a socket which can take either an emulator module, or a production device.

The REAL ICE connects directly to production devices which support in-circuit emulation through the PGC/PGD programming interface, or through a high speed connection which uses two more pins. According to Microchip, it supports "most" flash-based PIC, PIC24, and dsPIC processors.[16]

The ICE4000 is no longer directly advertised on Microchip's website, and the purchasing page states that it is not recommended for new designs.

PIC clones

  • Ubicom (formerly Scenix) produces the SX range of chips. These are baseline core PIC clones that run much faster than the original. As of November 2005 Parallax is the exclusive supplier of the SX.
  • OpenCores has a PIC16F84 core written in Verilog.
  • Holtek HT48FXX Flash I/O type series
  • ANGSTREM produces 8-bit 4 MIPS (at 8MHz) microcontroller An15E03 (КР1878ВЕ1 in Russian) which is pin-compatible with PIC16F84

[edit] PICKit 2 Open-source structure and clones

PICKit 2 has been an interesting PIC programmer from Microchip. It can program all PICs and debug most of the PICs (as of May-2009, only PIC32 as a family are not support for MPLAB debugging.). Ever since its first releases, all software source code (firmware, PC application) and hardware schematic are open to the public. This makes the end user easy to modify the programmer for non-windows operating system, such as: Linux, Mac os, etc. In the mean time, it also creates lots of DIY interest and Clones. This open-source structure bring in many features to the PICKit 2 community, features like, Programmer-to-Go, UART tool, Logic tool, etc. are contributed by many PICKit 2 users. In the mean time, fans even added new features to the PICKit 2 design, to name a few, max. 4M byte Programmer-to-go capability, USB buck/boost circuits, RJ12 type connectors, etc.

8/16/32-bit PIC microcontroller product families

These links take you to product selection matrices at the manufacturer's site.

8-bit Microcontrollers

16-bit Microcontrollers

32-bit Microcontrollers

16-bit Digital Signal Controllers

The F in a name generally indicates the PICmicro uses flash memory and can be erased electronically. A C generally means it can only be erased by exposing the die to ultraviolet light (which is only possible if a windowed package style is used). An exception to this rule is the PIC16C84 which uses EEPROM and is therefore electrically erasable.

The PIC's "code protection" features are not at all perfect; To some extent, the weaknesses repeat themselves across the entire line of devices. But it should also be acknowledged that Microchip has pushed out targeted revisions to the code protection system as hacks have become widely known. Flylogic Engineering has documented some of this ongoing back-and-forth on their website.