Monday, February 24, 2014

Active High and Active Low ????

 
 
 
Differences between active high and active low
 
 
Example circuit of active high and active low



Example of Source Code to Differentiate Between Active High and Active Low
 
 


//Differentiate between active high and active low
#include <18f4550.h>
#fuses HS, NOWDT, NOLVP, NOPROTECT
#use delay(clock=20M)
#define LED1   PIN_D0
#define LED2   PIN_D1
#define LED3   PIN_D2
#define LED4   PIN_D3
void main()
{
   set_tris_d(0x00); //Set PORTD as output
   output_d(0x00); //Initialize PORTD  
   while(true)
   {
      //Active Low
      output_low(LED1); //LED1 will turn ON     

      output_low(LED2); //LED2 will turn ON     
      output_low(LED3); //LED3 will turn OFF     
      output_low(LED4); //LED4 will turn OFF     
      delay_ms(500);     
      //Active high
      output_high(LED1); //LED1 will turn OFF     

      output_high(LED2); //LED2 will turn OFF     
      output_high(LED3); //LED3 will turn ON     
      output_high(LED4); //LED4 will turn ON     
      delay_ms(500); 
   }
}




 
 
 


No comments: