Anda di halaman 1dari 8

Setup Modul Data Acquisition ADAM

Ada tiga modul yang telah terhubung secara parallel dengan komunikasi RS-485, yakinkan
koneksi diantara ketiga modul saling terhubung diantara pin (data+) dan (data-) dan converter
USB to RS-485 menuju computer.
Sambungkan kabel USB dari modul converter ke port USB di PC, kemudian jalankan aplikasi
utility ADAM 4000/5000 di PC untuk melihat konfigurasi dan seting terhadap modul.
Yakinkna masing-masing modul telah di set sebagai berikut:

ADAM 4080 pada alamat 01 sebagai modul Digital Output dua bit.
ADAM 4021 sebagai analog output (tegangan 0-10 Volt) pada alamat 02.
ADAM 4018 sebagai analog input (tegangan +/- 2.5 Volt) pada alamat 03.

Dengan menggunakan perintah terminal lakukan ujicoba mengirim protocol komunikasi atau
command ke modul, dengan format sebagai berikut:

ADAM 4080:
o Kirim : @01DO01<cr>
Bit pada out D0 akan ON dan bit pada out D1 akan OFF.
o Respon : !01<cr>
Jawaban dari modul jika tidak terjadi kesalahan kirim command.
ADAM 4021:
o Kirim : #0202.500<cr>
Mengeluarkan tegangan 2.5 Volt
o Respon : ><cr>
Jika tidak terjadi kesalahan.
ADAM 4018:
o Kirim : #030<cr>
Membaca tegangan pada chanel 0
o Respon : >+1.2500<cr>
Tegangan terbaca adalah +1.250 Volt.

1|Page
Wiring Modul ADAM:

Project :

2|Page
Rancang suatu system Mesin Pengering, dengan user requirement sebagai berikut:
o Untuk menjalankan system menggunakan push button start, dan saat itu MC akan
terhubung. Untuk mematikan system ditekan push button stop.
o Untuk mengatur panas digunanakan slider.
o Monitoring suhu digunakan thermocouple dan ditampilkan pada display.
Rancang system dengan menggunakan Bahasa pemrograman Visual Basic.
Pada lampiran diberikan contoh program untuk berkomunikasi dengan modul ADAM
Buatlah Laporan berupa tampilan panel serta source code yang telah dirancang.
MC disimulasikan dengan Digital Output, sensor suhu menggunakan analog input. Slider
menggunakan Analog Output.

LAMPIRAN Contoh Program


FORM:

3|Page
SOURCE CODE:
Dim data As String

Dim level As Integer

Dim flag As Boolean

Private Sub Command1_Click()

If MSComm1.PortOpen = False Then MSComm1.PortOpen = True

Timer1.Enabled = True

End Sub

Private Sub Command2_Click()

If MSComm1.PortOpen = True Then MSComm1.PortOpen = False

End Sub

Private Sub Command3_Click()

If MSComm1.PortOpen = True Then MSComm1.PortOpen = False

Timer1.Enabled = False

Unload Me

End Sub

Private Sub Form_Load()

With MSComm1

.Settings = "9600,n,8,1"

.RThreshold = 1

.InputLen = 1

.CommPort = Text1.Text

End With

End Sub

Private Sub MSComm1_OnComm()

data = data + MSComm1.Input

4|Page
If InStr(data, vbCr) Then

Text2.Text = Mid$(data, 3, 5)

level = Val(Text2.Text)

ProgressBar1.Value = level

data = ""

End If

End Sub

Private Sub Timer1_Timer()

If MSComm1.PortOpen = True Then

flag = Not flag

If flag = True Then Shape2.FillColor = vbWhite

If flag = False Then Shape2.FillColor = vbGreen

MSComm1.Output = "#030" + vbCr

End If

If MSComm1.PortOpen = False Then Shape2.FillColor = vbWhite

End Sub

5|Page
#AAN
Name Read Analog Input from Channel N
Description The command will return the input value from one of the eight channels of a
specified (AA) module in the currently configured data format.

Syntax #AAN(cr)
# is a delimiter character.
AA (range 00-FF) represents the 2-character hexadecimal address of the analog input
module.
N identifies the channel you want to read. The value can range from 0 to 7 for 4017, 4018,
4018M, 4019. (the range of 4015 isfrom 0 to 5)
(cr) is the terminating character, carriage return (0Dh).

6|Page
Response >(data)(cr)
There is no response if the module detects a syntax error or communication error or if the
specified address does not exist.
> is a delimiter character.
(data) is the input value of the channel number N. Data consists of a + or - sign followed by
five decimal digits with a fixed decimal point.
(cr) is the terminating character, carriage return (0Dh).

Example command: #120(cr)


response: >+1.4567(cr)
The command requests the analog input module at address 12h to return the input value of
channel 0.
The analog input module responds that the input value of channel 0 is equal to +1.4567 volts.

#AA
Name Analog Data Out
Description Send a value to the addressed analog output module. Upon receipt, the analog
output module will output this value.

Syntax #AA(data)(cr)
# is a delimiter character.
AA (range 00-FF) represents the 2-character hexadecimaladdress of an analog output module.
(data) is the value that has to be output through the analog output module. Range and value
depend on the modules configured data format. Possible formats are: engineering units, % of
FSR or hexadecimal. (See also Appendix B, Data Formats and I/O Ranges.)
(cr) is the terminating character, carriage return (0Dh).

Response >(cr) if the command was valid.


?AA(cr) if a value was sent that is out of range. Note that when the analog output module
receives such a value, it will try touse a value that is close to the one received, but within the
modules configured range. There is no response if the module detects a syntax error or
communication error or if the specified address does not exist.
> delimiter character.
? delimiter character indicating the command was invalid.
AA (range 00-FF) represents the 2-character hexadecimal address of an analog output
module.
(cr) is the terminating character, carriage return (0Dh).
#AA
Example command: #3315.000(cr)
response: >(cr)
The command sends the value 15 mA to the analog output module at address 33h that is
configured for engineering units.
The analog output module responds that the command was valid. Its output value will be 15
mA.
command: #0A+030.00(cr)
response: >(cr)

7|Page
The module is configured for a 4 to 20 mA output range and a percent of span data format. The
command sends the value 8.8 mA (4 mA + 0.30 x 16 mA = 8.8 mA) 30% of the span to the
analog output module at address 0Ah.
The analog output module responds that the command was valid. Its output value is set to 8.8
mA.
command: #1B7FF(cr)
response: >(cr)
The command sends the hexadecimal value 7FF to the analog output module at address 1Bh.
The module is configured for a 0 to 20 mA output range and a hexadecimal data format. It will
output 10 mA ((7FFH/FFFH) x 20 mA = 10 mA).

@AADO
Name Set Digital Output
Description Set the values of the modules two digital outputs (ON or OFF).

Syntax @AADO(data)(cr)
@ is a delimiter character.
AA (range 00-FF) represents the 2-character hexadecimal address of a counter module.
DO is the Set Digital Output command
(data) is the two-character parameter that sets the state for the
two digital output bits of the module, as shown below:
00 all D/O bits are OFF
01 bit 0 is ON, bit 1 is OFF
02 bit 0 is OFF, bit 1 is ON
03 all bits are ON
(cr) represents terminating character, carriage return (0Dh)
Response !AA(cr) if the command was valid
?AA(cr) if an invalid parameter was entered
There is no response if the module detects a syntax error or communication error or if the
specified address does not exists.
! delimiter character indicating a valid command was received
? delimiter character indicating the command was invalid
AA represents the 2-character hexadecimal address of the responding counter module.
(cr) represents terminating character, carriage return (0Dh)
Example command: @05DO01(cr)
response: !05(cr)
The counter module at address 05h is instructed to set digital output channel 1 to ON and
digital output channel 2 to OFF.The module confirms the settings.

8|Page

Anda mungkin juga menyukai