[سلام از اساتید و دوستان درخواست کمک دارم 5 روزه اعصابمو خراب کرده نمونه خط کانفیق ایسی
End If
دیود پل اپ 47 کیلو
پورت جی تک غیر فعال
تاریخ رو ایسی ثبت میشه ولی بعد کذشت 24 ساعت که باید مقدارش جلو بره میره رو تاریخ 11/10/78 روزشم یکشنبه یعنی همون مقدار پیش فرض رو ست میکنه و ثابت میمونه :angry:
کارهای انجام شده
تعویض ای سی حدود 7 تا
تعویض کریستال
گراند کردن کریستال
راه اندازی ایسی با باطری بک اپ و بدون باطری
استفاده از مقاومت پل اپ10 کیلو[img][/img]
کد:
$regfile = "m32def.dat"
$crystal = 8000000
'-------------------------------------------------------------------------------
Config Clock = Soft , Gosub = Sectic
Enable Interrupts
Config Debounce = 30
'--------------------------- ds 1307 -----------------------------------------
$lib "ds1307clock.lib"
$lib “mcsbyteint.lbx”
'configure the scl and sda pins
Config Sda = Porta.7
Config Scl = Portc.5
'address of ds1307
Const Ds1307w = &HD0 ' Addresses of Ds1307 clock
Const Ds1307r = &HD1
'*******************************************************************************
' CONFIG PORT
'*******************************************************************************
Config Portb = Output
Config Portd = Output
Config Pina.0 = Output
Config Pina.1 = Output
Config Pina.2 = Output
Config Pina.3 = Output
Config Pina.4 = Input
Config Pina.5 = Input
Config Pina.6 = Input
Config Pinc.0 = Output
Config Pinc.1 = Output
Config Pinc.2 = Output
Config Pinc.3 = Output
Config Pinc.4 = Output
'*******************************************************************************
' VAR
'*******************************************************************************
Dim Scan As Byte , Refresh As Byte , Row As Byte , Refresh2 As Byte
Dim Hour As Byte , Mint As Byte , Second As Byte
Dim H1 As Byte , H2 As Byte , H3 As Byte , F As Byte , G As Byte
Dim M1 As Byte , M2 As Byte , M3 As Byte
Dim S1 As Byte , S2 As Byte , S3 As Byte
Dim K(16) As Integer , L(5) As Byte
Dim H4(8) As Byte , H5(65) As Byte , M4(8) As Byte , M5(65) As Byte , S4(8) As Byte , S5(65) As Byte , Tim0(65) As Byte , Tim(65) As Byte
Dim A As Byte , A1 As Byte , A2 As Byte , A3 As Byte , A4 As Byte , A5 As Byte
Dim B As Byte , B1 As Byte , B2 As Byte , B3 As Byte , B4 As Byte , B5 As Byte
Dim C As Byte , C1 As Byte , C2 As Byte , C3 As Byte , C4 As Byte , C5 As Byte
Dim Buf(60)as Byte
Dim D(60) As Byte , D1(60) As Byte
Dim J1 As Integer , J2 As Integer , J3 As Integer , J4 As Integer
Dim I1 As Integer , I2 As Integer , I3 As Integer , I4 As Integer
Dim S(16) As Byte , T As Byte , T2 As Bit , T22 As Byte
Dim Daycon As Byte , S7 As Byte , Ss As Integer
Dim W As Bit , X As Bit , Z As Byte
Dim Y1 As Integer , Y2 As Integer , Y3 As Integer , Y4 As Integer , Y5 As Integer
Dim Effecttime As Byte
Dim Myear As Integer 'input Miladi(gregorian) Year
Dim Mday As Integer 'input Miladi Day
Dim Mmonth As Integer 'input Miladi Month
Dim Mdayofyear As Integer
Dim Myear_ As Integer
Dim Jday As Integer 'output Jalali(shamsi) Day
Dim Jmonth As Integer 'output Jalali Month
Dim Jyear As Integer 'output Jalali Year
Dim Jdayofyear As Integer
Dim Gnumdayofyear As Integer
Dim Isleapyear As Bit
Dim Isleapyearp As Bit
Dim Iloop As Byte
Dim Temp1 As Integer
Dim Temp2 As Integer
Dim Temp3 As Integer
Dim Temp4 As Integer
Dim Jmonth_a(12) As Byte
Dim Mmonth_a(12) As Byte
Dim Seco As Byte , Mine As Byte , Hour1 As Byte , Day0 As Byte , Day1 As Byte , Month As Byte , Year As Byte
'*******************************************************************************
' TIME & DAY SET0
'*******************************************************************************
'******************'
'******************'
Effecttime = 7 ' (s)
'******************'
'******************'
Gosub I2c
T = 0
W = 0
For A = 0 To 7
Portb = 0
Portd = 2 ^ A
Portd = 0
Portc = 2 ^ A
Portc = 0
Next A
'*******************************************************************************
' ** **
' ** **
' ** **
' ** MAIN **
' ** **
' ** **
' ** **
'*******************************************************************************
Gosub Azanchange
Gosub Day
Main:
Do
If X = 1 Then
X = 0
Gosub I2c
Gosub Azanchange
Gosub Day
End If
If W = 1 Then
W = 0
Gosub Secshift
Gosub Timeshift
End If
For B = 0 To 64
Tim0(b) = H5(b) Or M5(b)
Next B
For B = 0 To 64
Tim(b) = Tim0(b) Or S5(b)
Next B
If T = 0 And T2 = 1 Then
Gosub Day
T2 = 0
End If
If T = 1 And T2 = 1 Then
Gosub Daynumber
T2 = 0
End If
If T = 2 Or T = 4 Or T = 6 Or T = 8 Or T = 10 Or T = 12 Then
If T2 = 1 Then
Gosub Azan01
T2 = 0
End If
End If
If T = 3 Or T = 5 Or T = 7 Or T = 9 Or T = 11 Or T = 13 Then
If T2 = 1 Then
Gosub Azantime
T2 = 0
End If
End If
For Refresh = 0 To 50
Scan = 0
For Row = 0 To 7
A = Row
Gosub Chekkey1
Portb = Tim(a)
Portd = 1
Portd = 0
Portb = Tim(a + 8)
Portd = 2
Portd = 0
Portb = Tim(a + 16)
Portd = 4
Portd = 0
Portb = Tim(a + 24)
Portd = 8
Portd = 0
Portb = Tim(a + 32)
Portd = 16
Portd = 0
Portb = Tim(a + 40)
Portd = 32
Portd = 0
Portb = Tim(a + 48)
Portd = 64
Portd = 0
Portb = Tim(a + 56)
Portd = 128
Portd = 0
A1 = A + 1
A2 = A1 + 8
A3 = A1 + 16
A4 = A1 + 24
A5 = A1 + 32
Portb = Buf(a1)
Portc = 1
Portc = 0
Portb = Buf(a2)
Portc = 2
Portc = 0
Portb = Buf(a3)
Portc = 4
Portc = 0
Portb = Buf(a4)
Portc = 8
Portc = 0
Portb = Buf(a5)
Portc = 16
Portc = 0
Porta = Scan
Scan = Scan + 1
Waitus 100
Porta = 8
Next Row
Next Refresh
Loop
'*******************************************************************************
' ** **
' ** I2C **
' ** **
'*******************************************************************************
I2c:
I2cstart ' Generate start code
I2cwbyte Ds1307w ' send address
I2cwbyte 0 ' start address in 1307
I2cstart ' Generate start code
I2cwbyte Ds1307r ' send address
I2crbyte Seco , Ack ' sec
I2crbyte Mine , Ack ' MINUTES
I2crbyte Hour1 , Ack ' Hours
I2crbyte Day0 , Ack
I2crbyte Day1 , Ack
I2crbyte Month , Ack
I2crbyte Year , Nack
I2cstop
Seco = Makedec(seco) : Mine = Makedec(mine) : Hour1 = Makedec(hour1) : Day0 = Makedec(day0)
Day1 = Makedec(day1) : Month = Makedec(month) : Year = Makedec(year)
If Seco > 59 Then Seco = 0
If Mine > 59 Then Mine = 0
If Hour1 > 23 Then Hour1 = 0
If Day0 > 6 Then Day0 = 0
If Day1 > 31 Then Day1 = 1
If Month > 12 Then Month = 1
If Year > 99 Then
Year = 0
دیود پل اپ 47 کیلو
پورت جی تک غیر فعال
تاریخ رو ایسی ثبت میشه ولی بعد کذشت 24 ساعت که باید مقدارش جلو بره میره رو تاریخ 11/10/78 روزشم یکشنبه یعنی همون مقدار پیش فرض رو ست میکنه و ثابت میمونه :angry:
کارهای انجام شده
تعویض ای سی حدود 7 تا
تعویض کریستال
گراند کردن کریستال
راه اندازی ایسی با باطری بک اپ و بدون باطری
استفاده از مقاومت پل اپ10 کیلو[img][/img]





دیدگاه