Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
BEE3931 PC INTERFACING
MAULANA ZULFIKAR BIN ASRIL
EC12051
lABSTRACT
Resistors are electrical components that resist
or regulate the flow of current in an electronic
circuit. Resistors are mainly used to protect
other electronic components from being
damaged due to high current. Besides, resistors
are also used to provide a specific voltage for an
active device. Other than variable resistors, all
resistors possess their own preset resistance
value. This value can be determined by the
bands on a resistor. Resistor can have 4 or 5
depending on the type. The color code on a
resistor is used to indicate its resistance value.
Manually determining the resistance value of a
resistor may be tiresome and time-consuming
sometimes. Hence, automatic resistance value
calculator can be used to make the task of
finding out the resistor value much simpler.
INTRODUCTION
We designed an application program using
Borland C++ Builder 6, which allow user to
calculate and determine the value of 4 band
and 5 band resistor. Borland C++ Builder 6 is a
programming environment for Microsoft
Windows. This application works by selecting
the color code corresponding to the resistor
whose value we want to determine, then
obtaining the resistor value clicking Calculator.
This program can be used to determine 4 band
and 5 band resistor depending on the option
chosen.
PROCEDURE
Before writing the coding for the
application program, an application interface
chart
as
shown
below.
4 Band selection
5 Band selection
RESULTS
Application screenshoot:
LABSHEET 1
BEE3931 PC INTERFACING
MAULANA ZULFIKAR BIN ASRIL
EC12051
DISCUSSION
1. The design of this application was done
according
to
the
labsheets
specification, while the coding was
done individually, with the guidance of
our lecturer.
2. There were some initial mistake or
error done when first developing the
application coding, but they were
successfully resolved at the end.
3. This application is user-friendly in that it
is easy to use. The step to use this
application is as listed below.
CONCLUSION
The creation of an automatic resistor value
calculator application is an easier way to
determine a resistors resistance value,
compared to traditional manual methods.
This application not only saves time, but
effort as well, when trying to determine the
resistors value. In addition, hassle is also
reduced since users do not need to
remember or refer to the resistor color
value chart. The use of the programming
software Borland C++ Builder 6 is fairly
simple and straight-forward when designing
and developing this application.
ACKNOWLEDGEMENT
I would like to thank my BEE3931 PC
INTERFACINGs lecturer, En. Mohd Falfazli
Bin Mat Jusoh for teaching me the basics of
PC Interfacing and how to use the Borland
C++ Builder 6 software, as well as his
guidance during the designing and
developing stage of this application
program. Besides, I also would like to thank
REFERENCES
a) BEE3931 notes from En, Mohd Falfazli
Bin Mat Jusoh
b) https://www.yevol.com/bcb/lesson24.h
tm
LABSHEET 1
BEE3931 PC INTERFACING
MAULANA ZULFIKAR BIN ASRIL
EC12051
void __fastcall
*Sender)
TForm1::FormCreate(TObject
{
Appendix
//--------------------------------------------------------------------------
Edit1->Text="0";
Edit2->Text="0";
Edit3->Text="0";
Edit4->Text="0";
#include <vcl.h>
Edit5->Text="0";
#pragma hdrstop
Panel1->Caption="0";
Panel2->Caption="0";
#include "hafiz.h"
Panel3->Caption="0";
//--------------------------------------------------------------------------
Panel4->Caption="0";
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//-------------------------------------------------------------------------__fastcall
Owner)
TForm1::TForm1(TComponent*
: TForm(Owner)
Panel5->Caption="0";
Panel6->Caption="0";
Shape2->Visible=false;
Shape3->Visible=false;
Shape4->Visible=false;
Shape5->Visible=false;
Shape6->Visible=false;
Button1->Caption="Calculator";
Button4->Caption="0 Black";
Button5->Caption="1 Brown";
//--------------------------------------------------------------------------
Button6->Caption="2 Red";
Button7->Caption="3 Orange";
Button32->Caption="8 Silver";
Button8->Caption="4 Yellow";
Button33->Caption="9 White";
Button9->Caption="5 Green";
Button34->Caption="0 Black";
Button10->Caption="6 Blue";
Button35->Caption="1 Brown";
Button11->Caption="7 Purple";
Button36->Caption="2 Red";
Button12->Caption="8 Silver";
Button37->Caption="3 Orange";
Button13->Caption="9 White";
Button38->Caption="4 Yellow";
Button14->Caption="0 Black";
Button39->Caption="5 Green";
Button15->Caption="1 Brown";
Button40->Caption="6 Blue";
Button16->Caption="2 Red";
Button41->Caption="7 Purple";
Button17->Caption="3 Orange";
Button42->Caption="8 Silver";
Button18->Caption="4 Yellow";
Button43->Caption="10 Gold";
Button19->Caption="5 Green";
Button44->Caption="1 Brown";
Button20->Caption="6 Blue";
Button45->Caption="2 Red";
Button21->Caption="7 Purple";
Button46->Caption="3 Green";
Button22->Caption="8 Silver";
Button47->Caption="4 Blue";
Button23->Caption="9 White";
Button48->Caption="5 Purple";
Button24->Caption="0 Black";
Button49->Caption="6 Grey";
Button25->Caption="1 Brown";
Button50->Caption="7 Gold";
Button26->Caption="2 Red";
Button51->Caption="8 Silver";
Button27->Caption="3 Orange";
Shape1->Brush->Color=clSilver;
Button28->Caption="4 Yellow";
Button1->Caption="Calculator";
Button29->Caption="5 Green";
Button2->Caption="Reset";
Button30->Caption="6 Blue";
Button3->Caption="Close";
Button31->Caption="7 Purple";
RadioButton1->Caption="4 Band";
LABSHEET 1
BEE3931 PC INTERFACING
MAULANA ZULFIKAR BIN ASRIL
EC12051
RadioButton2->Caption="5 Band";
Label4->Caption="Multiplier";
Label10->Caption="Total";
Label5->Caption="Tolerance";
Label1->Caption="Band 1";
Label2->Caption="Band 2";
Label3->Caption="Band 3";
//--------------------------------------------------------------------------
Label4->Caption="Multiplier";
Label5->Caption="Tolerance";
void
__fastcall
TForm1::RadioButton1Click(TObject *Sender)
Label7->Caption="Code No";
Shape2->Visible=false;
Label8->Caption="Value";
Shape3->Visible=true;
Label9->Caption="Ohm";
Shape4->Visible=true;
GroupBox2->Caption="Band1";
Shape5->Visible=true;
GroupBox3->Caption="Band2";
Shape6->Visible=true;
GroupBox4->Caption="Band3";
Shape2->Brush->Color=clCream;
GroupBox5->Caption="Multiplier";
Shape3->Brush->Color=clCream;
GroupBox1->Caption="Tolerance";
Shape4->Brush->Color=clCream;
GroupBox1->Enabled=false;
Shape5->Brush->Color=clCream;
GroupBox2->Enabled=false;
GroupBox1->Enabled=true;
GroupBox3->Enabled=false;
GroupBox2->Enabled=false;
GroupBox4->Enabled=false;
GroupBox3->Enabled=true;
GroupBox5->Enabled=false;
GroupBox4->Enabled=true;
Label2->Caption="Band 1";
GroupBox5->Enabled=true;
Label3->Caption="Band 2";
Edit1->Text="0";
Panel1->Caption="0";
GroupBox5->Enabled=true;
Label1->Caption="";
Label1->Caption="Band 1";
Label2->Caption="Band 1";
Label2->Caption="Band 2";
Label3->Caption="Band 2";
Label3->Caption="Band 3";
Label4->Caption="Multiplier";
Label4->Caption="Multiplier";
Label5->Caption="Tolerance";
Label5->Caption="Tolerance";
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
void
__fastcall
TForm1::RadioButton2Click(TObject *Sender)
Shape2->Visible=true;
Edit1->Text="0";
Shape3->Visible=true;
Panel1->Caption="0";
Shape4->Visible=true;
Shape2->Brush->Color=clBlack;
Shape5->Visible=true;
Shape6->Visible=true;
Shape2->Brush->Color=clCream;
//--------------------------------------------------------------------------
Shape3->Brush->Color=clCream;
Shape4->Brush->Color=clCream;
Shape5->Brush->Color=clCream;
Shape6->Brush->Color=clCream;
Edit1->Text="1";
GroupBox1->Enabled=true;
Panel1->Caption="100";
GroupBox2->Enabled=true;
Shape2->Brush->Color=clMaroon;
GroupBox3->Enabled=true;
GroupBox4->Enabled=true;
LABSHEET 1
BEE3931 PC INTERFACING
MAULANA ZULFIKAR BIN ASRIL
EC12051
//-------------------------------------------------------------------------void __fastcall TForm1::Button6Click(TObject
*Sender)
{
Shape2->Brush->Color=clYellow;
}
//--------------------------------------------------------------------------
Edit1->Text="2";
Panel1->Caption="200";
Shape2->Brush->Color=clRed;
Edit1->Text="5";
Panel1->Caption="500";
//--------------------------------------------------------------------------
Shape2->Brush->Color=clGreen;
}
//--------------------------------------------------------------------------
Edit1->Text="3";
Panel1->Caption="300";
Shape2->Brush->Color=clAqua;
Edit1->Text="6";
Panel1->Caption="600";
//--------------------------------------------------------------------------
Shape2->Brush->Color=clBlue;
}
//--------------------------------------------------------------------------
Edit1->Text="4";
Panel1->Caption="400";
Edit1->Text="7";
Panel2->Caption="0";
Panel1->Caption="700";
Shape3->Brush->Color=clBlack;
Shape2->Brush->Color=clPurple;
//--------------------------------------------------------------------------
Edit2->Text="1";
Edit1->Text="8";
Panel2->Caption="10";
Panel1->Caption="800";
Shape3->Brush->Color=clMaroon;
Shape2->Brush->Color=clSilver;
//--------------------------------------------------------------------------
Edit2->Text="2";
Edit1->Text="9";
Panel2->Caption="20";
Panel1->Caption="900";
Shape3->Brush->Color=clRed;
Shape2->Brush->Color=clWhite;
//--------------------------------------------------------------------------
Edit2->Text="3";
Edit2->Text="0";
Panel2->Caption="30";
LABSHEET 1
BEE3931 PC INTERFACING
MAULANA ZULFIKAR BIN ASRIL
EC12051
Shape3->Brush->Color=clAqua;
Edit2->Text="6";
Panel2->Caption="60";
//--------------------------------------------------------------------------
Shape3->Brush->Color=clBlue;
}
//--------------------------------------------------------------------------
Edit2->Text="4";
Panel2->Caption="40";
Shape3->Brush->Color=clYellow;
Edit2->Text="7";
Panel2->Caption="70";
//--------------------------------------------------------------------------
Shape3->Brush->Color=clPurple;
}
//--------------------------------------------------------------------------
Edit2->Text="5";
Panel2->Caption="50";
Shape3->Brush->Color=clGreen;
Edit2->Text="8";
Panel2->Caption="80";
//--------------------------------------------------------------------------
Shape3->Brush->Color=clSilver;
}
//--------------------------------------------------------------------------
Edit2->Text="9";
Edit3->Text="2";
Panel2->Caption="90";
Panel3->Caption="2";
Shape3->Brush->Color=clWhite;
Shape4->Brush->Color=clRed;
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
Edit3->Text="0";
Edit3->Text="3";
Panel3->Caption="0";
Panel3->Caption="3";
Shape4->Brush->Color=clBlack;
Shape4->Brush->Color=clAqua;
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
Edit3->Text="1";
Edit3->Text="4";
Panel3->Caption="1";
Panel3->Caption="4";
Shape4->Brush->Color=clMaroon;
Shape4->Brush->Color=clYellow;
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
LABSHEET 1
BEE3931 PC INTERFACING
MAULANA ZULFIKAR BIN ASRIL
EC12051
void __fastcall TForm1::Button29Click(TObject
*Sender)
//--------------------------------------------------------------------------
Edit3->Text="5";
Panel3->Caption="5";
Shape4->Brush->Color=clGreen;
}
//--------------------------------------------------------------------------
{
Edit3->Text="8";
Panel3->Caption="8";
Shape4->Brush->Color=clSilver;
}
//--------------------------------------------------------------------------
Edit3->Text="6";
Panel3->Caption="6";
Shape4->Brush->Color=clBlue;
}
//--------------------------------------------------------------------------
{
Edit3->Text="9";
Panel3->Caption="9";
Shape4->Brush->Color=clWhite;
}
//--------------------------------------------------------------------------
Edit3->Text="7";
Panel3->Caption="7";
Shape4->Brush->Color=clPurple;
}
{
Edit4->Text="0";
Panel4->Caption="1 ";
Shape5->Brush->Color=clBlack;
}
//--------------------------------------------------------------------------
Panel4->Caption="10";
Shape5->Brush->Color=clMaroon;
Edit4->Text="3";
Panel4->Caption="1000";
//--------------------------------------------------------------------------
Shape5->Brush->Color=clAqua;
}
//--------------------------------------------------------------------------
{
Edit4->Text="2";
Panel4->Caption="100";
Shape5->Brush->Color=clRed;
Edit4->Text="4";
//--------------------------------------------------------------------------
Panel4->Caption="10000";
Shape5->Brush->Color=clYellow;
//--------------------------------------------------------------------------
Close();
}
LABSHEET 1
BEE3931 PC INTERFACING
MAULANA ZULFIKAR BIN ASRIL
EC12051
{
Edit4->Text="5";
//--------------------------------------------------------------------------
Panel4->Caption="100000";
Shape5->Brush->Color=clGreen;
//--------------------------------------------------------------------------
Edit4->Text="8";
Panel4->Caption="0.01";
Shape5->Brush->Color=clSilver;
}
//--------------------------------------------------------------------------
Panel4->Caption="1000000";
Shape5->Brush->Color=clBlue;
//--------------------------------------------------------------------------
Edit4->Text="10";
Panel4->Caption="0.1";
Shape5->Brush->Color=clFuchsia;
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
{
Edit5->Text="1";
Panel5->Caption="+/-1%";
Shape6->Brush->Color=clMaroon;
}
//--------------------------------------------------------------------------
}
//--------------------------------------------------------------------------
Edit5->Text="2";
Panel5->Caption="+/-2%";
Shape6->Brush->Color=clRed;
}
//--------------------------------------------------------------------------
}
//--------------------------------------------------------------------------
Edit5->Text="4";
Panel5->Caption="+/-0.25%";
Shape6->Brush->Color=clBlue;
}
LABSHEET 1
BEE3931 PC INTERFACING
MAULANA ZULFIKAR BIN ASRIL
EC12051
Panel5->Caption="+/-0.05%";
Shape6->Brush->Color=clSkyBlue;
}
//--------------------------------------------------------------------------
Edit3->Text="0";
Edit4->Text="0";
Edit5->Text="0";
Panel1->Caption="0";
Panel2->Caption="0";
Panel3->Caption="0";
Panel4->Caption="0";
Panel5->Caption="0";
Panel6->Caption="0";
Shape2->Brush->Color=clCream;
Shape4->Brush->Color=clCream;
Edit5->Text="8";
Shape5->Brush->Color=clCream;
Panel5->Caption="+/-10%";
Shape6->Brush->Color=clCream;
Shape6->Brush->Color=clSilver;
RadioButton1->Checked=false;
RadioButton2->Checked=false;
//--------------------------------------------------------------------------
Shape3->Brush->Color=clCream;
}
//--------------------------------------------------------------------------
Value1=Panel1->Caption.ToDouble();
Value2=Panel2->Caption.ToDouble();
Value3=Panel3->Caption.ToDouble();
Value4=Panel4->Caption.ToDouble();
Total=(Value1+Value2+Value3)*Value4;
Panel6->Caption=Total;
}
//--------------------------------------------------------------------------