Application Note

Tracer-E: Using the LED Logic State Probe

Need a way to monitor the state of a signal or software states?  Do you need something that your customers can visually report without major effort?

The solution is to use the LED logic state probe on the Tracer-E to provide state values of certain digital I/Os, or let software manipulate the LED logic state probe for software and/or system status indication.

The LED logic state probe can be configured by the upper bits in the General Setup High Byte Register at tracere_base_address + 15.  The General Setup High Byte Register is a read/write register so that the register can be easily read, masked and written.

The LED logic state probe can be configured in 16 possible ways as shown in the table below.

 

LED[3:0]

=

LED drive source. 

 0000 = base address decode (default) *

 0001 = Counter/Timer 0 Input (CI0)

 0010 = Counter/Timer 1 Input (CI1)

 0011 = Counter/Timer 2 Input (CI2)

 0100 = Counter/Timer 0 Output 

 0101 = Counter/Timer 1 Output

 0110 = Counter/Timer 2 Output

 0111 = Interrupt Source A (ISA) *

 1000 = IRQ_IN0

 1001 = IRQ_IN1

 1010 = IRQ_IN2

 1011 = none

 1100 = Interrupt Source B (ISB) *

 1101 = Interrupt Source C (ISC) *

 1110 = LED off always

 1111 = LED on always

 

    * LED minimum pulse size is  

       approximately 0.016 seconds

 

The default mode, base address decode, will blip the LED display when any valid PC/104 read/write cycle to the Tracer-E is performed. 

 

The LED can be connected to monitor several IRQ lines, counter/timer inputs and outputs. 

 

 

 

When you are in the early stages of hardware development, use the LED to monitor interrupt sources.  By initially removing jumpers from J10, J8 or J6 one can confirm interrupt sources before software interrupt service routines are implemented.

 

Below is a partial software example illustrating how to use the LED logic state probe to show overall CPU loading.  When the LED is off, the CPU is busy running the main line tasks.  When the LED is on the CPU is not busy (i.e. waiting for main loop timer time-out or RT-kernel to allow execution).  Therefore, the dimmer the LED, the more the CPU is loaded.

 

const unsigned char LED_BASE_ADDRESS = 0x0;

const unsigned char LED_ON_ALWAYS =  0xE;

const unsigned char LED_OFF_ALWAYS = 0xF;

 

int tracere_base_address;

 

/*---===---===---===---===---===---===---===---===*/

void TracerE_Set_LED_State_Probe( int led_value )

{

     unsigned char scratch;

     if ( (value >= 0) && (value <= 15) )

     {

           scratch = inportb( tracere_base_address+15 );

           scratch = (scratch & 0x0F) | (value<<4);

           outportb( tracere_base_address+15, scratch );

     }

}

/*---===---===---===---===---===---===---===---===*/

void main( )

{

     /* your initialization code here */

     tracere_base_address = 0x300;

 

     while( 1 )  /* continuously looping main line */

     {

           TracerE_Set_LED_State_Probe( LED_ON_ALWAYS);

 

           /* wait for your main loop timer */

 

          TracerE_Set_LED_State_Probe( LED_OFF_ALWAYS);

 

          /* perform your system tasks here */

 

     }

}

 

Tracer-E

Tracer-E pc104 digital i/o board product manual

Your BEST VALUE Provider of RUGGEDIZED PC/104 COTS, Contract Electrical Engineering and FPGA Design Services

Apex Embedded Systems
116 Owen Road
Monona, WI 53716
Phone: 608-256-0767
Fax: 608-256-0765
Web site: http://www.apexembeddedsystems.com
E-mail: cutomer.service@apexembeddedsystems.com