muratmert4
Usta Üye
Herkeze merhaba. Pic ile amatör olarak uğraşıyorum ldmicro ve parsic kullandım.Protonda yeniyim. Pic16f877 ile okulun iklimlendirme soğutma bölümüne bir uygulama için kart yaptım fakat bellek yetersiz geldi. Pic18f452 getirttim ve protona sayesinde başladım. Protonda PLC gibi makrolar oluşturmak istiyorum. Basit bir uygulama yaptım. PLC18.INC oluşturdum. 8 ad. dijital giriş (DI1-DI8), 8 ad. analog giriş (AI1-AI2), 8 ad. dijital çıkış ( O1-O8 ), 20 ad. MB (memory bit), 20 ad. MW (memory word) oluşturdum. Timerleri oluşturamadım bununla ilgili yardımcı olurmusunuz? inc dosyasına port çoğullayıcıları da deneyerek ekleyeceğim. Tamamlayınca da burada yayımlarım yardımlarınızı bekliyorum. Kolay gelsin. Proteus 7,4 sp3 kullanıyorum. dosya eki aşağıdadır.
PLC18.INC
Kod:
'****************************************************************
'* Name : PLC18.INC *
'* Author : *
'* Notice : *
'* : All Rights Reserved *
'* Date : 10.02.2009 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
Device = 18F452
XTAL = 20
ALL_DIGITAL = TRUE
Input PORTB
Output PORTD
PORTD=0
PLC:
'DIJITAL GIRISLER
Symbol DI1 = PORTB.0
Symbol DI2 = PORTB.1
Symbol DI3 = PORTB.2
Symbol DI4 = PORTB.3
Symbol DI5 = PORTB.4
Symbol DI6 = PORTB.5
Symbol DI7 = PORTB.6
Symbol DI8 = PORTB.7
'DIJITAL CIKISLAR
Symbol O1 = PORTD.0
Symbol O2 = PORTD.1
Symbol O3 = PORTD.2
Symbol O4 = PORTD.3
Symbol O5 = PORTD.4
Symbol O6 = PORTD.5
Symbol O7 = PORTD.6
Symbol O8 = PORTD.7
'ANALOG GİRŞLER
Declare ADIN_RES 10
Declare ADIN_TAD FRC
Declare ADIN_DELAY 50
TRISA = %11111111
ADCON1 = %10000000
Dim AI1 As Word
Dim AI2 As Word
Dim AI3 As Word
Dim AI4 As Word
Dim AI5 As Word
Dim AI6 As Word
Dim AI7 As Word
Dim AI8 As Word
AI1 = ADIn 0
AI2 = ADIn 1
AI3 = ADIn 2
AI4 = ADIn 3
AI5 = ADIn 4
AI6 = ADIn 5
AI7 = ADIn 6
AI8 = ADIn 7
'MB MEMORY BIT'LERI
Dim MB1 As Bit
Dim MB2 As Bit
Dim MB3 As Bit
Dim MB4 As Bit
Dim MB5 As Bit
Dim MB6 As Bit
Dim MB7 As Bit
Dim MB8 As Bit
Dim MB9 As Bit
Dim MB10 As Bit
Dim MB11 As Bit
Dim MB12 As Bit
Dim MB13 As Bit
Dim MB14 As Bit
Dim MB15 As Bit
Dim MB16 As Bit
Dim MB17 As Bit
Dim MB18 As Bit
Dim MB19 As Bit
Dim MB20 As Bit
'MW MEMORY WORD'LERI
Dim MW1 As Word
Dim MW2 As Word
Dim MW3 As Word
Dim MW4 As Word
Dim MW5 As Word
Dim MW6 As Word
Dim MW7 As Word
Dim MW8 As Word
Dim MW9 As Word
Dim MW10 As Word
Dim MW11 As Word
Dim MW12 As Word
Dim MW13 As Word
Dim MW14 As Word
Dim MW15 As Word
Dim MW16 As Word
Dim MW17 As Word
Dim MW18 As Word
Dim MW19 As Word
Dim MW20 As Word
'RTC VE SERİ EEPROM
SCL_PIN = PORTC.3
SDA_PIN = PORTC.4
'SERI ILETISIM
SERIAL_BAUD = 9600
RSOUT_PIN = PORTC.6
RSOUT_MODE = TRUE
RSOUT_PACE = 1
RSIN_PIN = PORTC.7
RSIN_MODE = TRUE
HSERIAL_BAUD = 9600
HSERIAL_RCSTA = %10010000
HSERIAL_TXSTA = %00100100
HSERIAL_CLEAR = On
'PWM / ANALOG CIKIS
CCP1_PIN = PORTC.2
CCP2_PIN = PORTC.1
PLC18.INC
Kod:
'****************************************************************
'* Name : PLC18.INC *
'* Author : *
'* Notice : *
'* : All Rights Reserved *
'* Date : 10.02.2009 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
Device = 18F452
XTAL = 20
ALL_DIGITAL = TRUE
Input PORTB
Output PORTD
PORTD=0
PLC:
'DIJITAL GIRISLER
Symbol DI1 = PORTB.0
Symbol DI2 = PORTB.1
Symbol DI3 = PORTB.2
Symbol DI4 = PORTB.3
Symbol DI5 = PORTB.4
Symbol DI6 = PORTB.5
Symbol DI7 = PORTB.6
Symbol DI8 = PORTB.7
'DIJITAL CIKISLAR
Symbol O1 = PORTD.0
Symbol O2 = PORTD.1
Symbol O3 = PORTD.2
Symbol O4 = PORTD.3
Symbol O5 = PORTD.4
Symbol O6 = PORTD.5
Symbol O7 = PORTD.6
Symbol O8 = PORTD.7
'ANALOG GİRŞLER
Declare ADIN_RES 10
Declare ADIN_TAD FRC
Declare ADIN_DELAY 50
TRISA = %11111111
ADCON1 = %10000000
Dim AI1 As Word
Dim AI2 As Word
Dim AI3 As Word
Dim AI4 As Word
Dim AI5 As Word
Dim AI6 As Word
Dim AI7 As Word
Dim AI8 As Word
AI1 = ADIn 0
AI2 = ADIn 1
AI3 = ADIn 2
AI4 = ADIn 3
AI5 = ADIn 4
AI6 = ADIn 5
AI7 = ADIn 6
AI8 = ADIn 7
'MB MEMORY BIT'LERI
Dim MB1 As Bit
Dim MB2 As Bit
Dim MB3 As Bit
Dim MB4 As Bit
Dim MB5 As Bit
Dim MB6 As Bit
Dim MB7 As Bit
Dim MB8 As Bit
Dim MB9 As Bit
Dim MB10 As Bit
Dim MB11 As Bit
Dim MB12 As Bit
Dim MB13 As Bit
Dim MB14 As Bit
Dim MB15 As Bit
Dim MB16 As Bit
Dim MB17 As Bit
Dim MB18 As Bit
Dim MB19 As Bit
Dim MB20 As Bit
'MW MEMORY WORD'LERI
Dim MW1 As Word
Dim MW2 As Word
Dim MW3 As Word
Dim MW4 As Word
Dim MW5 As Word
Dim MW6 As Word
Dim MW7 As Word
Dim MW8 As Word
Dim MW9 As Word
Dim MW10 As Word
Dim MW11 As Word
Dim MW12 As Word
Dim MW13 As Word
Dim MW14 As Word
Dim MW15 As Word
Dim MW16 As Word
Dim MW17 As Word
Dim MW18 As Word
Dim MW19 As Word
Dim MW20 As Word
'RTC VE SERİ EEPROM
SCL_PIN = PORTC.3
SDA_PIN = PORTC.4
'SERI ILETISIM
SERIAL_BAUD = 9600
RSOUT_PIN = PORTC.6
RSOUT_MODE = TRUE
RSOUT_PACE = 1
RSIN_PIN = PORTC.7
RSIN_MODE = TRUE
HSERIAL_BAUD = 9600
HSERIAL_RCSTA = %10010000
HSERIAL_TXSTA = %00100100
HSERIAL_CLEAR = On
'PWM / ANALOG CIKIS
CCP1_PIN = PORTC.2
CCP2_PIN = PORTC.1