Buka notepad, lalu copy paste kode berikut dengan nama file masing-masing…
1. index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simulasi Perhitungan Rangkaian NAND TTL</title>
</head>
<body>
<center>
<h3>Program Simulasi Perhitungan Rangkaian NAND TTL</h3>
<img src="NANDTTL.jpg" /> <br /><br /><br /><br />
<form method="get" action="proses.php">
<table>
<tr>
<td><b>Tegangan Input A (VA)</b></td>
<td>
<input name="inputA" type="text" />Volt
</td>
</tr>
<tr>
<td><b>Tegangan Input B (VB)</b></td>
<td>
<input name="inputB" type="text" />Volt
</td>
</tr>
<tr>
<td><b>VCC</b></td>
<td>
<input name="vcc" type="text" />Volt
</td>
</tr>
<tr>
<td><b>RC (Hambatan C)</b></td>
<td>
<input name="rc" type="text" />Ohm
</td>
</tr>
<tr>
<td><b>IC (Arus C)</b></td>
<td>
<input name="ic" type="text" />Ampere
</td>
</tr>
<tr>
<td><b>Beta</b></td>
<td>
<input name="beta" type="text" required="required" />
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="Submit" /></td>
</tr>
<tr>
<td colspan="2" align="center"><i>Oleh : Aditya Rizki Yudiantika (07/252677/TK/33045)</i></td>
</tr>
<tr>
<td colspan="2" align="center"><i>Email : buluhijau@gmail.com</i></td>
</tr>
</table>
</form>
</center>
</body>
</html>
2. proses.php
<html>
<head>
<title>Hasil Perhitungan Rangkaian NAND TTL</title>
</head>
<body>
<center>
<?php
$va = $_GET['inputA'];
$vb = $_GET['inputB'];
$vcc = $_GET['vcc'];
$rc = $_GET['rc'];
$ic = $_GET['ic'];
$beta = $_GET['beta'];
$ib = $ic/$beta;
$vce = $vcc - $ic * $rc;
if ($va < 0.7 && $vb < 0.7)
{
$hasil = "HIGH";
}
if ($va > 0.7 && $vb < 0.7)
{
$hasil = "HIGH";
}
if ($va < 0.7 && $vb > 0.7)
{
$hasil = "HIGH";
}
if ($va > 0.7 && $vb > 0.7)
{
$hasil = "LOW";
}
echo "<h3>Hasil Perhitungan Rangkaian NAND TTL</h3>";
echo "<img src='NANDTTL.jpg' /> <br /><br /><br /><br />";
echo "<b>Diketahui sbb :</b><br>";
echo "Tegangan input A (VA) : $va volt<br>";
echo "Tegangan input B (VB) : $vb volt<br>";
echo "Tegangan Vcc : $vcc volt<br>";
echo "Rc : $rc ohm<br>";
echo "Ic : $rc ohm<br>";
echo "Beta : $beta<br><br>";
echo "<b>Hasil Perhitungan</b><br>";
echo "Nilai arus Ib = Ic / beta = $ic / $beta = $ib Ampere<br>";
echo "Nilai tegangan Vce = Vcc - (Ic * Rc) = $vce Volt<br>";
if ($vce <= 0)
{
echo "Transistor saturasi <br>";
}
else
{
echo "Transistor linier, bukan saklar.<br>";
}
echo "Output yang dihasilkan adalah = <b>$hasil</b><br>";
echo "<br><a href='index.php'>>>KEMBALI</a><br>";
echo "<br><i>Oleh : Aditya Rizki Yudiantika (07/252677/TK/33045)</i><br>";
echo "<i>Email : buluhijau@gmail.com</i><br>";
?>
</center>
</body>
</html>
3. Jangan lupa letakkan kedua file di atas ke dalam satu folder server PHP
4. Silakan cari bug sebanyak mungkin, lalu kirimkan diskusikan / email ke developer bersangkutan
*penulis masih bingung konsep saturasi dan keadaan linier (bukan saklar)
Tidak ada komentar:
Posting Komentar