Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:examples:digi:led [2015/11/04 14:18] heikopikneren:examples:digi:led [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-~~PB~~+<pagebreak>
 ====== Light-emitting Diode ====== ====== Light-emitting Diode ======
  
-//Necessary knowledge: [HW] [[en:hardware:homelab:controller]], [HW] [[en:hardware:homelab:digi]], [ELC] [[en:electronics:led_resistor]], [AVR] [[en:avr:registers]], [AVR] [[en:avr:io]], [LIB] [[en:software:homelab:library:pin]]//+//Necessary knowledge:  
 +[HW][[en:hardware:homelab:digi]],  
 +[ELC][[en:electronics:led_resistor]], 
 +[AVR][[en:avr:registers]], [AVR] [[en:avr:io]],  
 +[LIB][[en:software:homelab:library:bit]], [LIB][[en:software:homelab:library:pin]]//
  
 ===== Theory ===== ===== Theory =====
Line 22: Line 26:
 ===== HomeLab Practice ===== ===== HomeLab Practice =====
  
-The HomeLab controller control module has one single red LED, whose anode is connected through resistor to a +5 V power supply and the cathode is connected to the ATmega128 pin number PB7. In order to switch on and off this LED, PB7 should be defined as the output pin and set low or high accordingly. Which means if the pin is set high, the LED is turned off and if the pin is set low, the LED is turned on. Basically it would be possible to connect the LED also so that the anode is connected to the pin of microcontroller, and the cathode is connected to the earth (somewhere there has to be a resistor too) – in that case when the pin is set as high, the LED shines and when the pin is set as low the LED is switched off.+The HomeLab controller control module has one single indicator LED, whose anode is connected through resistor to a power supply and the cathode is connected to the controllers pin. In order to switch on and off this LED, LED pin should be defined as the output and set low or high accordingly. Which means if the pin is set high, the LED is turned off and if the pin is set low, the LED is turned on. Basically it would be possible to connect the LED also so that the anode is connected to the pin of microcontroller, and the cathode is connected to the earth (somewhere there has to be a resistor too) – in that case when the pin is set as high, the LED shines and when the pin is set as low the LED is switched off.
  
 All practical examples for the HomeLab kit, LED switching included, use HomeLab’s pin library. Pin library includes data type //pin//, which contains addresses of pin related registers and pin bitmask. If to create a pin type variable in the program and then initialize it by using macro function PIN, the pin can be used freely with this variable (pin) through whole program without being able to use registers.   All practical examples for the HomeLab kit, LED switching included, use HomeLab’s pin library. Pin library includes data type //pin//, which contains addresses of pin related registers and pin bitmask. If to create a pin type variable in the program and then initialize it by using macro function PIN, the pin can be used freely with this variable (pin) through whole program without being able to use registers.  
-Here are 2 example programs, which are doing exactly the same thing, but one is created on the basis of HomeLab’s library, the other is not. +Here are 2 example programs, which are doing exactly the same thing, but one is created on the basis of HomeLab’s library, the other is not. The debug LED, led_debug in HomeLab library, has been described as PB7 (HomeLab I & II) and PQ2 (HomeLab III). The Debug LED is physically located in the Controller module.
  
 <code c> <code c>
en/examples/digi/led.1446646723.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0