LTIND-A

From Curuxa

Just an LED and a resistor.

This module is usually employed to indicate some kind of status, as a very simple way to get information from inside a microcontroller or circuit.

Contents

Electronic circuit

Schematic

Bill of materials:

  • 1x LED
  • 1x 470Ω 1/4W resistor
  • 3x Straight female headers (usually sold as 40-pin strips)
  • Some thin wire
  • Some heat shrink tubing


The LED will light when the microcontroller data pin is set as a digital output at logic "1".

The LED will not light when the data pin is set at a logic "0", or when it's working as a digital or analog input.

You can use the LED color you want.

You might want to change the resistor value, depending on the LED type and brightness you want.

You can also build a short version without wires.

This Module only supports single-color LEDs. If you want to use multicolor or very bright LEDs take a look at other Modules.

Wiring

Printable version: Single, Quad

Construction

Long version

LTIND-A LTIND-A LTIND-A LTIND-A LTIND-A LTIND-A

Short version (no wire)

LTIND-A LTIND-A LTIND-A LTIND-A LTIND-A LTIND-A LTIND-A

Test

C

The following code can be compiled using SDCC.

/*==================================================================
* Sample program for LTIND-A using an MBP18
*
* This program configures all available pins as digital outputs.
* Plug Module LTIND-A to any pin. It will light up and then
* stop every second. RA5 is an input-only pin, so the LED will
* not light there
* Note: PIC16F88 runs by default at 31.25kHz (internal oscillator)
*
* http://curuxa.org
*=================================================================*/
 
#include <pic16f88.h>
 
typedef unsigned int config;
config at _CONFIG1 __CONFIG = _CP_OFF & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO;
 
//Simple delay for an unspecified amount of time
void Delay(){
    long i;
 
    for (i=0; i<200; i++) {
        //do nothing
    }
}
 
void main(){
	//set all pins as digital, instead of analog inputs
	ANSEL=0;
 
	//set all digital pins as outputs
	TRISA=0;
	TRISB=0;
 
	while(1){
	    //Turn LED on
		PORTA=0b11111111;
		PORTB=0b11111111;
		Delay();
 
        //Turn LED off
		PORTA=0;
		PORTB=0;
		Delay();
	}
}