Forum » Elektrotehnika in elektronika » Krmiljenje grelca z AtMega8
Krmiljenje grelca z AtMega8
janichar ::
Lep pozdrav!
Zadal sem si napisati program v Bascomu z naslednjimi funkcijami.
Na izhodu krmilnika bo preko tranzistorja in releja priključen manjši grelec, ki bo ogreval prostor. Na vhodu bosta dve tipki, s katerimi bi povečeval in zmanjševal temperaturo grelca. Na vhod bo še priključen NTK upor, ki bo meril temperaturo, ki se bo prikazovala na displayu.
Nekako mi je s pomočjo uspelo definirati vhodno izhodne spremenljivke za moj AtMega8:
Config Portd = 128
Portd = 127
Config Portc = &B01001111
Portc = &B00010000
'************************Definicija LCD zaslona*********************************
Config Lcdpin = Pin , Db4 = Portb.3 , Db5 = Portb.2 , Db6 = Portb.1 , Db7 = Portb.0 , E = Portb.4 , Rs = Portc.6
Config Lcd = 16 * 2
'************************Definicija vhodnih spremenljivk************************
'************************Digitalni vhodi****************************************
Dim In1 As Bit
Dim In2 As Bit
Dim In3 As Bit
Dim In4 As Bit
Dim In5 As Bit
Dim In6 As Bit
Dim In7 As Bit
Dim In8 As Bit
In1 Alias Pinc.4
In2 Alias Pind.0
In3 Alias Pind.1
In4 Alias Pind.2
In5 Alias Pind.3
In6 Alias Pind.4
In7 Alias Pind.5
In8 Alias Pind.6
'************************Digitalni izhodi***************************************
Dim Re1 As Bit
Dim Re2 As Bit
Dim Re3 As Bit
Dim Re4 As Bit
Dim Re5 As Bit
Re1 Alias Portd.7
Re2 Alias Portc.0
Re3 Alias Portc.1
Re4 Alias Portc.2
Re5 Alias Portc.3
'************************Analogni vhodi*****************************************
Config Adc = Free , Prescaler = Auto , Reference = Avcc
Start Adc
Dim A1 As Word
Dim A2 As Word
Dim A3 As Word
Dim A4 As Word
Dim A5 As Word
Dim A6 As Word
Dim A7 As Word
Dim A8 As Word
'************************Ostale spremenljivkje****************************************
Dim Z As Word
Dim S As Byte
'********************************Program****************************************
Cls
Prosim za pomoč.
Zadal sem si napisati program v Bascomu z naslednjimi funkcijami.
Na izhodu krmilnika bo preko tranzistorja in releja priključen manjši grelec, ki bo ogreval prostor. Na vhodu bosta dve tipki, s katerimi bi povečeval in zmanjševal temperaturo grelca. Na vhod bo še priključen NTK upor, ki bo meril temperaturo, ki se bo prikazovala na displayu.
Nekako mi je s pomočjo uspelo definirati vhodno izhodne spremenljivke za moj AtMega8:
Config Portd = 128
Portd = 127
Config Portc = &B01001111
Portc = &B00010000
'************************Definicija LCD zaslona*********************************
Config Lcdpin = Pin , Db4 = Portb.3 , Db5 = Portb.2 , Db6 = Portb.1 , Db7 = Portb.0 , E = Portb.4 , Rs = Portc.6
Config Lcd = 16 * 2
'************************Definicija vhodnih spremenljivk************************
'************************Digitalni vhodi****************************************
Dim In1 As Bit
Dim In2 As Bit
Dim In3 As Bit
Dim In4 As Bit
Dim In5 As Bit
Dim In6 As Bit
Dim In7 As Bit
Dim In8 As Bit
In1 Alias Pinc.4
In2 Alias Pind.0
In3 Alias Pind.1
In4 Alias Pind.2
In5 Alias Pind.3
In6 Alias Pind.4
In7 Alias Pind.5
In8 Alias Pind.6
'************************Digitalni izhodi***************************************
Dim Re1 As Bit
Dim Re2 As Bit
Dim Re3 As Bit
Dim Re4 As Bit
Dim Re5 As Bit
Re1 Alias Portd.7
Re2 Alias Portc.0
Re3 Alias Portc.1
Re4 Alias Portc.2
Re5 Alias Portc.3
'************************Analogni vhodi*****************************************
Config Adc = Free , Prescaler = Auto , Reference = Avcc
Start Adc
Dim A1 As Word
Dim A2 As Word
Dim A3 As Word
Dim A4 As Word
Dim A5 As Word
Dim A6 As Word
Dim A7 As Word
Dim A8 As Word
'************************Ostale spremenljivkje****************************************
Dim Z As Word
Dim S As Byte
'********************************Program****************************************
Cls
Prosim za pomoč.
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | Vprašanje o dual channel RAMu?Oddelek: Kaj kupiti | 2239 (1068) | Mitja358 |
» | Microchip MPLAB icd 2 (pic16f876a)Oddelek: Programiranje | 1181 (1058) | Highlag |
» | vrsta diska in ramov?Oddelek: Pomoč in nasveti | 1120 (957) | JayKay |
» | Leteče luči; AT90S2313, AT89C2051Oddelek: Elektrotehnika in elektronika | 2475 (2296) | Red_Mamba |
» | koliko rama še lahko dokupim?Oddelek: Strojna oprema | 1247 (1183) | Sami |