The PC has an incomparable history of success, and is now unimaginable in many fields of everyday life.
PC know-how isa matter of course nowadays, and PCs have resulted in standards (hardware components, operating systems, HMI (Human Machine Interface), communication etc.) which – as a result of permanently increasing performance accompanied by reduced prices – make them interesting for an increasingly wide range of applications.
In the case of Automation technology, the few PC applications at the beginning – especially for visualization purposes – have now developed into comprehensive applications for complex tasks.
This is basically the result of two aspects.
· PCs offer new possibilities with respect to flexibility, cost reduction and reduction In time-to-market associated with enormous increase in performance
· On the one hand, PC technologies permit new applications within a standardized environment, and, on the other, permit simple interface of such PC-based solutions to the office world.
2. Advantages of PC-Based Automation?· Combining Operating, Control, Monitoring In One Solution.
· Cost Saving Through Integration.
· Simple communication resulting from integral network ports
· Simple use of business software (e.g. MS Office) and own software(C++/VB..)
· Standardized means better selection
· High investment security
· High system availability
3. ARM-AUTO System DescriptionA. PRINCIPLE OF OPERATION
Since any PC- based Automation Systems needs beside the PC a slot PLC which is very expensive for small automation projects the Arm-Auto automation card was introduced as a substitution for the PLC Slot Card (A PCI compatible card ) the whole automation process is carried out by the PC as the user interface and the Arm-Auto Automation Card As A server( For Testing purpose I used Keil LPC2138 Evaluation board As automation Card ).
The Command signal from the PC Control Software is received at the Automation Card unit where it is decoded over a specified format and the microcontroller-based system through It’s I/O ports activate appropriate function operation.
For the input Monitoring the PC Automation Software is updating is inputs image every 1 Sec For All analog and digital inputs by requesting the input statuses for digital inputs and inputs values for analog inputs from the Automation Card, the Automation Card read That Values and forward them to the PC software through Serial Communication
When the operator need to activate an actuator (motor, valve, etc.) the PC automation Software Sends the proper signal to the Automation Card to activate the relevant actuator.
B. ADVANTAGES OF THIS SYSTEM
The technology is a very low cost solution for limited budget automation project it very flexible design and customizable PC automation software cost is nothing compared to other professional systems in the market you can connect the outputs to solid state relays or magnetic mechanical relays to activate various actuators
You can connect the inputs to various analog and digital sensors you can monitor, operate the process from the same device all that made it is a very suitable choice for limited budget automation system.
/******************************************************************************/
/* ARM-Auto */
/* */
/******************************************************************************/
/* */
/* BLINKY.C: ARM-AUTO */
/* */
/* Flexible PC Based Automation Solution */
/******************************************************************************/
#include <stdio.h> /* standard I/O .h-file */
#include <LPC213x.H> /* LPC213x definitions */
#include <math.h>
void loop (void);
extern void init_serial (void);
void read_input(unsigned int);
/* Initialize Serial Interface */
char x;
int volatile timeval;
short tval;
signed char cval;
void ad1 (void)
{ /* ADC Channel #1 function */
unsigned int cnt;
unsigned int val;
AD0CR = 0x00200401;
AD0CR |= 0x01200000; /* Start A/D Conversion */
do {
val = AD0DR; /* Read A/D Data Register */
} while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */
AD0CR &= ~0x01000000; /* Stop A/D Conversion */
val = (val >> 6) & 0x03FF; /* Extract AIN1 Value */
printf ("\n0X%03X", val);
/* Output A/D Conversion Result */
}
void ad2 (void)
{ /* ADC Channel #2 function */
unsigned int cnt;
unsigned int val;
AD0CR = 0x00200402;
AD0CR |= 0x01200000; /* Start A/D Conversion */
do {
val = AD0DR; /* Read A/D Data Register */
} while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */
AD0CR &= ~0x01000000; /* Stop A/D Conversion */
val = (val >> 6) & 0x03FF; /* Extract AIN2 Value */
printf ("\n0X%03X", val);
/* Output A/D Conversion Result */
}
void ad3 (void)
{ /* ADC Channel #3 function */
unsigned int cnt;
unsigned int val;
AD0CR = 0x00200404;
AD0CR |= 0x01200000; /* Start A/D Conversion */
do {
val = AD0DR; /* Read A/D Data Register */
} while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */
AD0CR &= ~0x01000000; /* Stop A/D Conversion */
val = (val >> 6) & 0x03FF; /* Extract AIN3 Value */
printf ("\n0X%03X", val);
/* Output A/D Conversion Result */
}
void ad4 (void)
{ /* ADC Channel #4 function */
unsigned int cnt;
unsigned int val;
AD0CR = 0x00200408;
AD0CR |= 0x01200000; /* Start A/D Conversion */
do {
val = AD0DR; /* Read A/D Data Register */
} while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */
AD0CR &= ~0x01000000; /* Stop A/D Conversion */
val = (val >> 6) & 0x03FF; /* Extract AIN4 Value */
printf ("\n0X%03X", val);
/* Output A/D Conversion Result */
}
void ad5 (void)
{ /* ADC Channel #5 function */
unsigned int cnt;
unsigned int val;
AD0CR = 0x00200410;
AD0CR |= 0x01200000; /* Start A/D Conversion */
do {
val = AD0DR; /* Read A/D Data Register */
} while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */
AD0CR &= ~0x01000000; /* Stop A/D Conversion */
val = (val >> 6) & 0x03FF; /* Extract AIN5 Value */
printf ("\n0X%03X", val);
/* Output A/D Conversion Result */
}
void ad6 (void)
{ /* ADC Channel #6 function */
unsigned int cnt;
unsigned int val;
AD0CR = 0x00200420;
AD0CR |= 0x01200000; /* Start A/D Conversion */
do {
val = AD0DR; /* Read A/D Data Register */
} while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */
AD0CR &= ~0x01000000; /* Stop A/D Conversion */
val = (val >> 6) & 0x03FF; /* Extract AIN6 Value */
printf ("\n0X%03X", val);
/* Output A/D Conversion Result */
}
void ad7 (void)
{ /* ADC Channel #7 function */
unsigned int cnt;
unsigned int val;
AD0CR = 0x00200440;
AD0CR |= 0x01200000; /* Start A/D Conversion */
do {
val = AD0DR; /* Read A/D Data Register */
} while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */
AD0CR &= ~0x01000000; /* Stop A/D Conversion */
val = (val >> 6) & 0x03FF; /* Extract AIN7 Value */
printf ("\n0X%03X", val);
/* Output A/D Conversion Result */
}
void ad8 (void)
{ /* ADC Channel #8 function */
unsigned int cnt;
unsigned int val;
AD0CR = 0x00200480;
AD0CR |= 0x01200000; /* Start A/D Conversion */
do {
val = AD0DR; /* Read A/D Data Register */
} while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */
AD0CR &= ~0x01000000; /* Stop A/D Conversion */
val = (val >> 6) & 0x03FF; /* Extract AIN8 Value */
printf ("\n0X%03X", val);
/* Output A/D Conversion Result */
}
void sendstr (char *p) { /* Write string */
while (*p) {
putchar (*p++);
}
}
int main (void) {
unsigned int n;
IODIR1 = 0x00FF0000; /* P1.16..23 defined as Outputs */
// AD0CR = 0x00200402; /* Setup A/D: 10-bit AIN0 @ 3MHz */
PINSEL0 = 0x00000f00;
PINSEL1 = 0x15440000; /* enable ADC */
PINSEL2 = 0x00000000;
init_serial(); /* Initialize Serial Interface */
while (1) {
x=getchar(); /* Getting Commands part */
if(x==0x01) /* Set Output 1 = P1.16 */
{
IOSET1=0x00010000;
}
if(x==0x02)
{
IOSET1=0x00020000; /* Set Output 2 = P1.17 */
}
if(x==0x03)
{
IOSET1=0x00040000; /* Set Output 3 = P1.18 */
}
if(x==0x04)
{
IOSET1=0x00080000; /* Set Output 4 = P1.19 */
}
if(x==0x05)
{
IOSET1=0x00100000; /* Set Output 5 = P1.20 */
}
if(x==0x06)
{
IOSET1=0x00200000; /* Set Output 6 = P1.21 */
}
if(x==0x07)
{
IOSET1=0x00400000; /* Set Output 7 = P1.22 */
}
if(x==0x08)
{
IOSET1=0x00800000; /* Set Output 8 = P1.23 */
}
if(x==0x09)
{
IOCLR1=0x00010000; /* Clear Output 1 = P1.16 */
}
if(x==0x0a)
{
IOCLR1=0x00020000; /* Clear Output 2 = P1.17 */
}
if(x==0x0b)
{
IOCLR1=0x00040000; /* Clear Output 3 = P1.18 */
}
if(x==0x0c)
{
IOCLR1=0x00080000; /* Clear Output 4 = P1.19 */
}
if(x==0x0d)
{
IOCLR1=0x00100000; /* Clear Output 5 = P1.20 */
}
if(x==0x0e)
{
IOCLR1=0x00200000; /* Clear Output 6 = P1.21 */
}
if(x==0x0f)
{
IOCLR1=0x00400000; /* Clear Output 7 = P1.22 */
}
if(x==0x10)
{
IOCLR1=0x00800000; /* Clear Output 8 = P1.23 */
}
if(x==0x11)
{
read_input(0x01000000);
}
if(x==0x12)
{
read_input(0x02000000);
}
if(x==0x13)
{
read_input(0x04000000);
}
if(x==0x14)
{
read_input(0x08000000);
}
if(x==0x15)
{
read_input(0x10000000);
}
if(x==0x16)
{
read_input(0x20000000);
}
if(x==0x17)
{
read_input(0x40000000);
}
if(x==0x18)
{
read_input(0x80000000);
}
if(x==0x19)
{
read_input(0x01000000);
read_input(0x02000000);
read_input(0x04000000);
read_input(0x08000000);
read_input(0x10000000);
read_input(0x20000000);
read_input(0x40000000);
read_input(0x80000000);
}
if(x==0x1b)
{
ad1();
}
if(x==0x1c)
{
ad2();
}
if(x==0x1d)
{
ad3();
}
if(x==0x1e)
{
ad4();
}
if(x==0x1f)
{
IOCLR1=0x00FF0000;/*Clear all Outputs*/
}
}
}
void read_input(unsigned int input) /*Function to Get The Status Of Input Pins*/
{
unsigned int state,value;
unsigned char st;
state=IOPIN1;
value=state & input;
if(value==0)
{
st=0x00;
putchar(st);
}
if (value!=0)
{
st=0x01;
putchar(st);
}
}
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include<ctype.h>;
#include "Unit1.h"
#include "Unit2.h"
#include "Unit3.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "ComPort"
#pragma resource "*.dfm"
TForm1 *Form1;
bool state;
int t=0,i=0;
int v[8];
bool n1,n2,n3,n4;
String a[8],va[8],b[8];
String h1,h2,h3,h4,h5,h6,h7,h8;
int per1,per2,per3,per4;
double le1,le2,le3,le4,le5,le6,le7,le8;
int dig1,dig2,dig3,dig4,dig5,dig6,dig7,dig8;
int pos1,pos2,pos3,pos4,pos5,pos6,pos7,pos8;
String out1,out2,out3,out4,out5,out6,out7,out8;
String in1,in2,in3,in4,in5,in6,in7,in8;
char *m="Connected",*n="Disconnected",*o="Emergency Stop";
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
day->Color=Form1->Color;
time->Color=Form1->Color;
date->Color=Form1->Color;
Timer1->Enabled=False;
restart->Enabled=false;
stop->Enabled=false;
o9->Enabled=False;
o10->Enabled=False;
o11->Enabled=False;
o12->Enabled=False;
o13->Enabled=False;
o14->Enabled=False;
o15->Enabled=False;
o16->Enabled=False;
o1->Enabled=False;
o2->Enabled=False;
o3->Enabled=False;
o4->Enabled=False;
o5->Enabled=False;
o6->Enabled=False;
o7->Enabled=False;
o8->Enabled=False;
Button10->Enabled=False;
st1->SimpleText="Disconnected";
Form1->st1->Panels->Items[1]->Text="COM1" ;
date->SelText=DateToStr(Date());
}
//---------------------------------------------------------------------------
void __fastcall TForm1::customizeClick(TObject *Sender)
{
Form2->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o1Click(TObject *Sender)
{
s1->Brush->Color=clLime;
o1->Enabled=False;
o9->Enabled=True;
cp1->WriteByte(0x01);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o2Click(TObject *Sender)
{
s2->Brush->Color=clLime;
o2->Enabled=False;
o10->Enabled=True;
cp1->WriteByte(0x02);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o3Click(TObject *Sender)
{
s3->Brush->Color=clLime;
o3->Enabled=False;
o11->Enabled=True;
cp1->WriteByte(0x03);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o4Click(TObject *Sender)
{
s4->Brush->Color=clLime;
o4->Enabled=False;
o12->Enabled=True;
cp1->WriteByte(0x04);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o5Click(TObject *Sender)
{
s5->Brush->Color=clLime;
o5->Enabled=False;
o13->Enabled=True;
cp1->WriteByte(0x05);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o6Click(TObject *Sender)
{
s6->Brush->Color=clLime;
o6->Enabled=False;
o14->Enabled=True;
cp1->WriteByte(0x06);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o7Click(TObject *Sender)
{
s7->Brush->Color=clLime;
o7->Enabled=False;
o15->Enabled=True;
cp1->WriteByte(0x07);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o8Click(TObject *Sender)
{
s8->Brush->Color=clLime;
o8->Enabled=False;
o16->Enabled=True;
cp1->WriteByte(0x08);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o9Click(TObject *Sender)
{
s1->Brush->Color=clRed;
o9->Enabled=False;
o1->Enabled=True;
cp1->WriteByte(0x09);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o10Click(TObject *Sender)
{
s2->Brush->Color=clRed;
o10->Enabled=False;
o2->Enabled=True;
cp1->WriteByte(0x0a);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o11Click(TObject *Sender)
{
s3->Brush->Color=clRed;
o11->Enabled=False;
o3->Enabled=True;
cp1->WriteByte(0x0b);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o12Click(TObject *Sender)
{
s4->Brush->Color=clRed;
o12->Enabled=False;
o4->Enabled=True;
cp1->WriteByte(0x0c);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o13Click(TObject *Sender)
{
s5->Brush->Color=clRed;
o13->Enabled=False;
o5->Enabled=True;
cp1->WriteByte(0x0d);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o14Click(TObject *Sender)
{
s6->Brush->Color=clRed;
o14->Enabled=False;
o6->Enabled=True;
cp1->WriteByte(0x0e);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o15Click(TObject *Sender)
{
s7->Brush->Color=clRed;
o15->Enabled=False;
o7->Enabled=True;
cp1->WriteByte(0x0f);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::o16Click(TObject *Sender)
{
s8->Brush->Color=clRed;
o16->Enabled=False;
o8->Enabled=True;
cp1->WriteByte(0x10);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click(TObject *Sender)
{
o1->Enabled=true;
o2->Enabled=true;
o3->Enabled=true;
o4->Enabled=true;
o5->Enabled=true;
o6->Enabled=true;
o7->Enabled=true;
o8->Enabled=true;
st1->SetTextBuf(m);
customize->Enabled=False;
Button9->Enabled=False;
Button10->Enabled=True;
cp1->Open();
Timer1->Enabled=True;
ind1->Brush->Color=clLime;
ind2->Brush->Color=clMaroon;
o1->Enabled=true;
o2->Enabled=true;
o3->Enabled=true;
o4->Enabled=true;
o5->Enabled=true;
o6->Enabled=true;
o7->Enabled=true;
o8->Enabled=true;
stop->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button10Click(TObject *Sender)
{
Timer1->Enabled=False;
Timer2->Enabled=False;
Timer3->Enabled=false;
Timer4->Enabled=false;
Timer5->Enabled=false;
Timer6->Enabled=false;
stop->Enabled=false;
an1->Brush->Color=clMaroon ;
an2->Brush->Color=clMaroon ;
an3->Brush->Color=clMaroon ;
an4->Brush->Color=clMaroon ;
cp1->WriteByte(0x1f);
st1->SetTextBuf(n);
customize->Enabled=True;
Button10->Enabled=False;
Button9->Enabled=True;
cp1->Close();
ind1->Brush->Color=clGreen;
ind2->Brush->Color=clRed;
o1->Enabled=False;
o2->Enabled=False;
o3->Enabled=False;
o4->Enabled=False;
o5->Enabled=False;
o6->Enabled=False;
o7->Enabled=False;
o8->Enabled=False;
o9->Enabled=False;
o10->Enabled=False;
o11->Enabled=False;
o12->Enabled=False;
o13->Enabled=False;
o14->Enabled=False;
o15->Enabled=False;
o16->Enabled=False;
s1->Brush->Color=clRed;
s2->Brush->Color=clRed;
s3->Brush->Color=clRed;
s4->Brush->Color=clRed;
s5->Brush->Color=clRed;
s6->Brush->Color=clRed;
s7->Brush->Color=clRed;
s8->Brush->Color=clRed;
stop->Enabled=false;
restart->Enabled=false;
Panel1->Color=clSilver;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormActivate(TObject *Sender)
{
st1->SimpleText="Disconnected";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
t++;
if(t==1)
{
cp1->WriteByte(0x1b);
}
if(t==2)
{
cp1->WriteByte(0x1c);
}
if(t==3)
{
cp1->WriteByte(0x1d);
}
if(t==4)
{
cp1->WriteByte(0x1e);
}
if(t==5)
{
pr1->Clear();
pr2->Clear();
pr3->Clear();
pr4->Clear();
a1->Clear();
a1->SelText=in1;
p1->Position=pos1;
per1=(pos1/1023.0)*100;
pr1->SelText=IntToStr(per1);
t1->Position=per1;
a2->Clear();
a2->SelText=in2;
p2->Position=pos2;
per2=(pos2/1023.0)*100;
pr2->SelText=IntToStr(per2);
t2->Position=per2;
a3->Clear();
a3->SelText=in3;
p3->Position=pos3;
per3=(pos3/1023.0)*100;
pr3->SelText=IntToStr(per3);
t3->Position=per3;
a4->Clear();
a4->SelText=in4 ;
p4->Position=pos4;
per4=(pos4/1023.0)*100;
pr4->SelText=IntToStr(per4);
t4->Position=per4;
if(per1>=prec1)
{
Timer3->Enabled=true;
ala1->Clear();
ala1->Color=clRed;
ala1->SelText=l1->Caption;
ala1->SelText=" Maximum Level Exceeded ";
}
if(per2>=prec2)
{
Timer4->Enabled=true;
ala2->Clear();
ala2->Color=clRed;
ala2->SelText=l2->Caption;
ala2->SelText=" Maximum Level Exceeded ";
}
if(per3>=prec3)
{
Timer5->Enabled=true;
ala3->Clear();
ala3->Color=clRed;
ala3->SelText=l3->Caption;
ala3->SelText=" Maximum Level Exceeded ";
}
if(per4>=prec4)
{
Timer6->Enabled=true;
ala4->Clear();
ala4->Color=clRed;
ala4->SelText=l4->Caption;
ala4->SelText=" Maximum Level Exceeded ";
}
if(per1<prec1)
{
Timer3->Enabled=false;
ala1->Clear();
ala1->Color=Form1->Color;
an1->Brush->Color=clMaroon ;
}
if(per2<prec2)
{
Timer4->Enabled=false;
ala2->Clear();
ala2->Color=Form1->Color;
an2->Brush->Color=clMaroon ;
}
if(per3<prec3)
{
Timer5->Enabled=false;
ala3->Clear();
ala3->Color=Form1->Color;
an3->Brush->Color=clMaroon ;
}
if(per4<prec4)
{
Timer6->Enabled=false;
ala4->Clear();
ala4->Color=Form1->Color;
an4->Brush->Color=clMaroon;
}
}
if(t==6)
{
cp1->WriteByte(0x11);
}
if(t==7)
{
cp1->WriteByte(0x12);
}
if(t==8)
{
cp1->WriteByte(0x13);
}
if(t==9)
{
cp1->WriteByte(0x14);
}
if(t==10)
{
cp1->WriteByte(0x15);
}
if(t==11)
{
cp1->WriteByte(0x16);
}
if(t==12)
{
cp1->WriteByte(0x17);
}
if(t==13)
{
cp1->WriteByte(0x18);
}
if(t==14)
{
if(dig1==0x00)
{
Shape1->Brush->Color=clRed;
}
if(dig1==0x01)
{
Shape1->Brush->Color=clLime;
}
if(dig2==0x00)
{
Shape2->Brush->Color=clRed;
}
if(dig2==0x01)
{
Shape2->Brush->Color=clLime;
}
if(dig3==0x00)
{
Shape3->Brush->Color=clRed;
}
if(dig3==0x01)
{
Shape3->Brush->Color=clLime;
}
if(dig4==0x00)
{
Shape4->Brush->Color=clRed;
}
if(dig4==0x01)
{
Shape4->Brush->Color=clLime;
}
if(dig5==0x00)
{
Shape5->Brush->Color=clRed;
}
if(dig5==0x01)
{
Shape5->Brush->Color=clLime;
}
if(dig6==0x00)
{
Shape6->Brush->Color=clRed;
}
if(dig6==0x01)
{
Shape6->Brush->Color=clLime;
}
if(dig7==0x00)
{
Shape7->Brush->Color=clRed;
}
if(dig7==0x01)
{
Shape7->Brush->Color=clLime;
}
if(dig8==0x00)
{
Shape8->Brush->Color=clRed;
}
if(dig8==0x01)
{
Shape8->Brush->Color=clLime;
}
t=0;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::cp1RxChar(TObject *Sender)
{
if(t==1)
{
h1=cp1->ReadString();
out1=Trim(h1);
pos1=StrToInt(out1);
le1=pos1*0.0032*pa1;
in1=FloatToStr(le1);
}
if(t==2)
{
h2=cp1->ReadString();
out2=Trim(h2);
pos2=StrToInt(out2) ;
le2=pos2*0.0032*pa2;
in2=FloatToStr(le2);
}
if(t==3)
{
h3=cp1->ReadString();
out3=Trim(h3);
pos3=StrToInt(out3) ;
le3=pos3*0.0032*pa3;
in3=FloatToStr(le3);
}
if(t==4)
{
h4=cp1->ReadString();
out4=Trim(h4);
pos4=StrToInt(out4) ;
le4=pos4*0.0032*pa4;
in4=FloatToStr(le4);
}
if(t==6)
{
dig1=cp1->ReadByte();
}
if(t==7)
{
dig2=cp1->ReadByte();
}
if(t==8)
{
dig3=cp1->ReadByte();
}
if(t==9)
{
dig4=cp1->ReadByte();
}
if(t==10)
{
dig5=cp1->ReadByte();
}
if(t==11)
{
dig6=cp1->ReadByte();
}
if(t==12)
{
dig7=cp1->ReadByte();
}
if(t==13)
{
dig8=cp1->ReadByte();
}
Timer1->Enabled=True;
}
void __fastcall TForm1::Timer2Timer(TObject *Sender)
{
state=!state;
if(state==true)
{
ind1->Brush->Color=clLime ;
Beep();
}
if(state==false)
{
ind1->Brush->Color=clGreen;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::stopClick(TObject *Sender)
{
Timer2->Enabled=true;
Panel1->Color=clRed;
stop->Enabled=false;
restart->Enabled=True;
st1->SetTextBuf(o);
cp1->WriteByte(0x1f);
o9->Enabled=False;
o10->Enabled=False;
o11->Enabled=False;
o12->Enabled=False;
o13->Enabled=False;
o14->Enabled=False;
o15->Enabled=False;
o16->Enabled=False;
o1->Enabled=False;
o2->Enabled=False;
o3->Enabled=False;
o4->Enabled=False;
o5->Enabled=False;
o6->Enabled=False;
o7->Enabled=False;
o8->Enabled=False;
s1->Brush->Color=clRed;
s2->Brush->Color=clRed;
s3->Brush->Color=clRed;
s4->Brush->Color=clRed;
s5->Brush->Color=clRed;
s6->Brush->Color=clRed;
s7->Brush->Color=clRed;
s8->Brush->Color=clRed;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::restartClick(TObject *Sender)
{
Timer2->Enabled=false;
Panel1->Color=clSilver;
stop->Enabled=true;
restart->Enabled=false;
o1->Enabled=true;
o2->Enabled=true;
o3->Enabled=true;
o4->Enabled=true;
o5->Enabled=true;
o6->Enabled=true;
o7->Enabled=true;
o8->Enabled=true;
st1->SetTextBuf(m);
ind1->Brush->Color=clLime;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer3Timer(TObject *Sender)
{
n1=!n1;
if(n1==true)
{
an1->Brush->Color=clRed ;
Beep();
}
if(n1==false)
{
an1->Brush->Color=clMaroon;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer4Timer(TObject *Sender)
{
n2=!n2;
if(n2==true)
{
an2->Brush->Color=clRed ;
Beep();
}
if(n2==false)
{
an2->Brush->Color=clMaroon;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer5Timer(TObject *Sender)
{
n3=!n3;
if(n3==true)
{
an3->Brush->Color=clRed ;
Beep();
}
if(n3==false)
{
an3->Brush->Color=clMaroon;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer6Timer(TObject *Sender)
{
n4=!n4;
if(n4==true)
{
an4->Brush->Color=clRed ;
Beep();
}
if(n4==false)
{
an4->Brush->Color=clMaroon;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer7Timer(TObject *Sender)
{
time->Clear();
time->SelText=TimeToStr(Time());
}
//---------------------------------------------------------------------------
Comments
Please log in or sign up to comment.