Rabu, 27 Juni 2012

multiplekser 4051 berbasis mikrokontroler atmega8535

Multiplekser 4051 berbasis mikrokontroler Atmega8535

8-CHANNEL ANALOG MULTIPLEXERS/DEMULTIPLEXERS




Nach ni… IC 4051 dapat difungsikan sebagai multiplekser 8 input ke 1 output, dengan menggunakan 3 pin kontrol…yang terdapat pada pin 9, 10 dan 11.
Untuk lebih jelasnya nich…pin description ic 4051 ato download datasheetnya diwww.alldatasheet.com



Pemrograman Multiplekser 4051 Berbasis Atmega8535 dengan BASCOM AVR
Skema simulasi dengan proteus oleh fahmizal_note:


Dari skema diatas dapet saya jelaskan sebagai berikut…pin kontrol multiplekser dihubung dengan portc.0, portc.1 dan portc.2… nach output dari multiplekser masuk ke ADC 0 mikro Atmega 8535…. rangkaian potensio sebagai masukan tegangan multiplekser yang akan diseleksi masuk ke ADC 0 melalu 3 pin kontrol… nach selanjutnya tinggal merancang program akses fungsi dari multiplekser tersebut…. berikut ni gan ane share sample prognya menggunakan BASCOM AVR…
$regfile = “m8535.dat”
$crystal = 12000000
‘—————————inisialisasi adc————————————
Config Adc = Single , Prescaler = Auto
‘—————————inisialisasi lcd————————————
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.2 , Rs = Portb.0
Config Lcd = 16 * 2 : Cursor Off
Config Portc = Output
Dim S1 As Integer
Dim S2 As Integer
Dim S3 As Integer
Dim S4 As Integer
Dim S5 As Integer
Dim S6 As Integer
Dim S7 As Integer
Dim S8 As Integer
Do
Portc = &B00000000
Start Adc
S1 = Getadc(0) : S1 = S1 / 5
Stop Adc
Portc = &B00000001
Start Adc
S2 = Getadc(0) : S2 = S2 / 5
Stop Adc
Portc = &B00000010
Start Adc
S3 = Getadc(0) : S3 = S3 / 5
Stop Adc
Portc = &B00000011
Start Adc
S4 = Getadc(0) : S4 = S4 / 5
Stop Adc
Portc = &B00000100
Start Adc
S5 = Getadc(0) : S5 = S5 / 5
Stop Adc
Portc = &B00000101
Start Adc
S6 = Getadc(0) : S6 = S6 / 5
Stop Adc
Portc = &B00000110
Start Adc
S7 = Getadc(0) : S7 = S7 / 5
Stop Adc
Portc = &B00000111
Start Adc
S8 = Getadc(0) : S8 = S8 / 5
Stop Adc
Locate 1 , 1 : Lcd S8
Locate 1 , 5 : Lcd S7
Locate 1 , 9 : Lcd S6
Locate 1 , 13 : Lcd S5
Locate 2 , 1 : Lcd S4
Locate 2 , 5 : Lcd S3
Locate 2 , 9 : Lcd S2
Locate 2 , 13 : Lcd S1
Waitms 100 : Cls
Loop
End


:

0 komentar:

Posting Komentar