sub procedure blinkfast delay_ms(1000) for a = 0 to 20 portd.4 = 1 delay_ms(100) portd.4 = 0 delay_ms(100) next a delay_ms(1500) end sub --------------------------------- sub procedure blinknot delay_ms(1000) portd.4 = 1 delay_ms(4000) portd.4 = 0 delay_ms(1500) end sub -------------------------------------- sub procedure Read_time'(dim byref Sec as byte, 'dim byref Min_ as byte, 'dim byref Hr as byte, 'dim byref Day as byte, 'dim byref Mn as byte) ' KOMUNIKACIJA SE ODVIJA PREKO RC3 I RC4 PINA I2C_init(100000) I2C_start I2C_Wr($A0) I2C_Wr(2) I2C_Repeated_Start I2C_Wr($A1) rawsec = I2C_Rd(1) while I2C_Is_Idle = 0 nop wend rawMin = I2C_Rd(1) while I2C_Is_Idle = 0 nop wend rawhr = I2C_Rd(1) while I2C_Is_Idle = 0 nop wend rawday = I2C_Rd(1) while I2C_Is_Idle = 0 nop wend rawmn = I2C_Rd(0) while I2C_Is_Idle = 0 nop wend I2C_Stop 'pretvaranje ocitanih podataka iz RTC-a sekund = ((rawsec and $F0) >> 4)*10 + (rawsec and $0F) ' formats date and time Minut = ((rawMin and $F0) >> 4)*10 + (rawMin and $0F) sat = ((rawhr and $F0) >> 4)*10 + (rawhr and $0F) godina = ((rawday and $C0)) >> 6 dan = ((rawday and $30) >> 4)*10 + (rawday and $0F) mjesec = ((rawmn and $10) >> 4)*10 + (rawmn and $0F) end sub ------------------------------------------------------------------------------- Main: ansel = 0 pcon = 3 adcon1 = 6 ANSELH = 0 TRISA = 0 TRISB = 0 TRISC = 0 TRISD = 0 TRISE = 0 PORTA = 0 PORTB = 0 PORTC = 0 PORTD = 0 PORTE = 0 s1: blinkfast 'kontrolno prvo blinkanje Vrijeme: Read_time ' read_time je subprocedura gdje MCU komunicira sa RTC. ostale su čista matematika tako da tu ne bi trebalo da transform_date ' zaglavi Read_Eeprom Transform_time zadavanje_vremenaa blinknot 'kontrolno drugo blinkanje