Virtual Integrated Design

RS232 Activity Indicator

 

RS232 indicator circuit

 


#pragma option +v

// txrxled.c
// (C) Virtual Integrated Design

#include <12c509.h>
#include <delay12.h>

long x=50000;
long y=50000;

void main(void)
{
  GPIO=0x3; // Preset
 __OPTION(0xDF); // GP2 output
 __TRIS(0x3,GPIO); // 0,1 input 2,4 output

while(1)
 {
   if(!GPIO.0) // RX active
  {
   GPIO.2=0; // Turn on RX LED
   x=7500; // Reset RX counter
  }
  //--------------------------------------------------
   if(GPIO.0) // RX inactive
  {
   x--;
   Delay_10xUs_4MHz(1); // delay12.lib (10Us)
   if(x==0)GPIO.2=1; // Turn off RX LED
  }
   if(!GPIO.1) // TX active
  {
   GPIO.4=0; // Turn on TX LED
   y=7500; // Reset TX counter
  }
  //--------------------------------------------------
  if(GPIO.1) // TX inactive
  {
   y--;
   Delay_10xUs_4MHz(1); // delay12.lib (10Us)
   if(y==0)GPIO.4=1; // Turn off TX LED
  }
 }
}
//****************************************************
#include <delay12.lib>

 

:080000003D0A030C2600DF0C91
:080008000200030C06000606CD
:080010000E0A46044C0C290005
:080018001D0C2A0006071B0A5B
:0800200029024306EA00E90091
:08002800010CA30431090902D7
:080030000A01430646052606FD
:08003800220A86044C0C2D0085
:080040001D0C2E0026072F0AFB
:080048002D024306EE00ED005D
:08005000010CA30431090D02AB
:080058000E0143068605070AAC
:08006000000800002700000069
:08006800000000000000000090
:0800700000000000E702330A62
:080078000008500C2900C30C24
:080080002A00500C2D00C30CF6
:060088002E00A304010A92
:00000001FF

 

Free RS232

Home | Applications | Industry Links | C++ Builder Stop | Micro Stop | Hex to Ascii Chart