Relay Circuit / CTS Source Code
File:
/*
// cts_rly.c
// 10/2003
// (C) 2003 Virtual Integrated Design
*/
#include <16C54.h>
#define address 0x01
#byte PORTB = 0x06 // Port B
#use delay(clock=4000000) //4Mhz
#use RS232(BAUD=19200, XMIT=PIN_A1, RCV=PIN_A0)
void xmit_19200_4mhz( char c ){ putc(c); }
char receive_19200_4mhz( void ){ return getc(); }
void main()
{
unsigned char x=0, y=0;
set_tris_a(0b0100); // 2=input 0,3,4=outputs
set_tris_b(0x00); // all output
while(1)
{
x=receive_19200_4mhz();
if(x==address)
{
y = receive_19200_4mhz();
PORTB = y;
xmit_19200_4mhz(x);
xmit_19200_4mhz(y);
output_low(PIN_A3); // Led on
}
else
{
output_high(PIN_A3); // Led off
}
}
}
Hex File:
:10000000530A050A2C0A290A4F0A080C2700090579
:100010000902050005060A0A6D00E7051D0AE70446
:100020001D0A0304050603052D03C7051D0AC704A1
:10003000E702110A0D022800280A0B0CE706030C40
:100040002800E802210AE7060F0AC706170A110A64
:100050002A0A010A080200082904090205002504E9
:10006000080C2F00000000000000EF05460AEF0416
:100070002E030306250503072504CF05460ACF04F2
:10008000EF02380A00000000000025050B0C2800D4
:10009000E802480AEF06370ACF063F0A520A0D0265
:1000A0002E00020A00086400FF0C2900290409023E
:1000B00005002505FF0C2A006B006C00040C0500F0
:1000C0002900000C06002A00290908022B00CB0297
:1000D000790A290908022C000C0226000B022D00C7
:1000E0004F090C022D004F0969040902050065043F
:0E00F0007D0A6904090205006505640A030023
:0203FE00000AF3
:00000001FF
;PIC16C54
Home |
Applications
|
Industry Links
|
C++ Builder Stop
|
Micro Stop
|
Hex to Ascii Chart