Cos'è ElectroYou | Login Iscriviti

ElectroYou - la comunità dei professionisti del mondo elettrico

centrale pilota per orologio ad impulsi

Raccolta di codici sorgenti

Moderatore: Foto UtentePaolino

0
voti

[1] centrale pilota per orologio ad impulsi

Messaggioda Foto Utentedjdanielb » 23 mar 2012, 2:40

salve continuo qui poiché l'altro topic è stato chiuso, spero di farmi capire visto che sembra impossibile ( ho postato lo schema in fidocad ma pare che nessuno lo abbia visto )

io voglio realizzare questa centrale

http://www.assosrl.it/catalogo/piloti-s ... ri/mck2245

ovvio non con quelle caratteristiche

per farlo

HO BISOGNO DI UN IMPULSO A 24 volt CC 1amp POLARITA' INVERTITA OGNI 60 SECONDI

prego vivamente di NON continuare a leggere se non avete capito cosa vuol dire polarità invertita ogni 60 secondi

ora siccome NON ho mai detto che so tutto io ( anzi rileggeto ho scritto che ci sono già io a non sapere nulla non confodiamoci ancora di più ) ho googlato e quello che più di simile ho trovato al caso mio è il progetto presentato qui http://www.instructables.com/id/Lunchtime-Clock/

ovvero
schema.jpg
schema.jpg (105.87 KiB) Osservato 9051 volte


bene a questo punto ecco cosa voglio fare io

schema 2.jpg
schema 2.jpg (97.78 KiB) Osservato 9051 volte


L'orologio con display comunica con l'esterno fornendo SCL e SDA

ora siccome giustamente lì ci sono solo foto ecco gli schemi
untitled2.jpg
untitled2.jpg (70.34 KiB) Osservato 9051 volte


spero di aver chiarito i dubbi

giuro oltre non lo so

caratteristiche degli orologio pilotati o industriali

Questo orologio monta un tipico meccanismo industriale.
Si tratta di un orologio ricevitore di impulso.
Anni addietro quando ancora non c'erano i dispositivi via radio,questo era l'unico modo per collegare più orologi insieme e mantenere tutto alla stessa ora.
Semplificando la regolazione ed il controllo.
E permettere una maggiore precisione,ma sopratutto un 'ora unica in tutto l'impianto.
Il dispositivo per funzionare necessita di un regolatore pilota.
Il quale provvede ogni minuto ad emettere un impulso polarizzato,per un tempo che varia a seconda dell'impianto dove deve lavorare,va da un minimo di 80/100° di secondo ad un massimo di 3"
Un minuto in un senso,il minuto dopo invertito.
Questa funzione è importantissima,perché oltre a permettere un efficace sistema di controllo elimina i magnetismi residui.
Impedendo che mantenendo sempre la polarità nello stesso senso cariche parassite si accumulino e nel tempo possano invalidare il controllo o l'avanzamento.
Per sapere l'esatta tensione di funzionamento lo devi aprire,sulla bobina è solitamente segnata la tensione di lavoro.
Che probabilmente è intercambiabile 12 o 24 volt.
Per vederlo spostare,ti è sufficente un alimentatore DC .
Appoggi momentaneamente i fili sui morsetti di alimentazione,l'orologio si sposta di un minuto,inverti i fili,l'orologio fa un altro minuto,e così via.


torno a ringraziare coloro che mi aiuteranno e mi scuso se qualcuno si è sentito offeso.

Daniele O_/
Avatar utente
Foto Utentedjdanielb
3 4
New entry
New entry
 
Messaggi: 93
Iscritto il: 10 mar 2010, 20:18

2
voti

[2] Re: centrale pilota per orologio ad impulsi

Messaggioda Foto UtenteTardoFreak » 23 mar 2012, 12:38

djdanielb ha scritto:... L'orologio con display comunica con l'esterno fornendo SCL e SDA...

Sbagliato. [-X
L' orologio non comunica un tubo di niente con quei due segnali. Quei due segnali sono quelli del bus I2C tramite il quale il microcontrollore (il master) comanda l' RTCC (il DS1307, lo slave). Il bus I2C serve esclusivamente per connettere fra di loro i due componenti.
Senza una modifica nel firmware dell' orologio non puoi comandare una altro slave e quindi inviarli in qualche modo i dati.

E' evidente che non conosci affatto il funzionamento dell' I2C bus quindi ti invito
1) A dare un' occhiata QUI
2) A studiarlo più approfonditamente sulle application notes di Microchip, Atmel, ST e compagni bella dove trattano l' interfacciamento tramite I2C

Dopo aver capito il funzionamento dell' I2C capirai anche l' assurdità del sistema (sbagliato) che hai in mente di fare.
"La follia sta nel fare sempre la stessa cosa aspettandosi risultati diversi".
"Parla soltanto quando sei sicuro che quello che dirai è più bello del silenzio".
Rispondere è cortesia, ma lasciare l'ultima parola ai cretini è arte.
Avatar utente
Foto UtenteTardoFreak
73,9k 8 12 13
-EY Legend-
-EY Legend-
 
Messaggi: 15754
Iscritto il: 16 dic 2009, 11:10
Località: Torino - 3° pianeta del Sistema Solare

0
voti

[3] Re: centrale pilota per orologio ad impulsi

Messaggioda Foto Utentedjdanielb » 23 mar 2012, 13:14

ok incomincio a capirci qualcosa

nel link dato c'è questa figura
300px-I2C_svg.png
300px-I2C_svg.png (5.7 KiB) Osservato 9023 volte


che modifica firmware dovrei fare perché un altro microchip possa leggersi tramite protocollo I2C il minuto ?


grazie mille

Daniele
Avatar utente
Foto Utentedjdanielb
3 4
New entry
New entry
 
Messaggi: 93
Iscritto il: 10 mar 2010, 20:18

1
voti

[4] Re: centrale pilota per orologio ad impulsi

Messaggioda Foto UtenteAjKDAP » 23 mar 2012, 13:21

Non ho capito, hai già l'orologio con atmel e display LCD?

Se si, non vedo il motivo di aggiungere un altro microprocessore (arduino)...

Basta modificare il firmware del primo atmel per fornirti l'impulso adeguato ogni minuto, ovviamente aggiungi i transistors ed i relè che ti servono e sei a posto.

No?
'˙˙˙·٠•● Alberto ●•٠·˙˙˙'
________________________
http://www.ajk.altervista.org
Avatar utente
Foto UtenteAjKDAP
1.255 2 6 9
Expert EY
Expert EY
 
Messaggi: 796
Iscritto il: 17 mag 2006, 0:13
Località: nella coda dei pronti

0
voti

[5] Re: centrale pilota per orologio ad impulsi

Messaggioda Foto Utentedjdanielb » 23 mar 2012, 13:40

Si l'orologio con LCD e Ds1307 cell'ho già ed è funzionante sfrutta un PIC16F877
ma non so modificargli il firmware per pargli fare l'impulso esterno ai due transistor

chi mi modifica il firmware per fargli fare questo ?

grazie mille

Daniele
Avatar utente
Foto Utentedjdanielb
3 4
New entry
New entry
 
Messaggi: 93
Iscritto il: 10 mar 2010, 20:18

1
voti

[6] Re: centrale pilota per orologio ad impulsi

Messaggioda Foto UtenteAjKDAP » 23 mar 2012, 13:43

dovresti almeno postare il sorgente (se è disponibile) e poi vediamo se io o qualcun altro può aiutarti a modificare il firmware.
'˙˙˙·٠•● Alberto ●•٠·˙˙˙'
________________________
http://www.ajk.altervista.org
Avatar utente
Foto UtenteAjKDAP
1.255 2 6 9
Expert EY
Expert EY
 
Messaggi: 796
Iscritto il: 17 mag 2006, 0:13
Località: nella coda dei pronti

1
voti

[7] Re: centrale pilota per orologio ad impulsi

Messaggioda Foto UtenteTardoFreak » 23 mar 2012, 13:46

Ma a questo punto tanto vale modificare il programma in modo che, oltre a farti da orologio, ti generi anche gli impulsi per il pilotaggio dei relè. La modifica sarebbe più facile e non ti servirebbero due micrcontrollori perché ti basterebbe quello dell' orologio.
Sempre che tu abbia a disposizione il sorgente.
Se non hai il sorgente bisogna scrivere il programma da zero.
"La follia sta nel fare sempre la stessa cosa aspettandosi risultati diversi".
"Parla soltanto quando sei sicuro che quello che dirai è più bello del silenzio".
Rispondere è cortesia, ma lasciare l'ultima parola ai cretini è arte.
Avatar utente
Foto UtenteTardoFreak
73,9k 8 12 13
-EY Legend-
-EY Legend-
 
Messaggi: 15754
Iscritto il: 16 dic 2009, 11:10
Località: Torino - 3° pianeta del Sistema Solare

0
voti

[8] Re: centrale pilota per orologio ad impulsi

Messaggioda Foto Utentedjdanielb » 23 mar 2012, 13:55

ecco il sorgente
e di allegato il file sorgente

E' SCRITTO IN BASIC
a questo punto vorrei integrarci un pulsante che faccia un avanzamento veloce per impostare l'ora


Codice: Seleziona tutto
'****************************************************************
'*  Name    : UNTITLED.BAS                                      *
'*  Author  : tommaso vincenti                                  *
'*  Notice  : Copyright (c) 2009 2009                           *
'*          : All Rights Reserved                               *
'*  Date    : 24/10/2009                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************


   '   DS1307 RTC Program
   '   Includes Setting the Date and Time
   '      3 Buttons Control Setting...
   '      12/24 hour Clock Mode
   '      Year
   '      Month
   '      Day of Month (also accounting for Leap Years)
   '      Hour
   '      Minute
   '      Second
   '
   '   Written for 2 line 16 Character LCD
   '
   '   This program is designed to "hold your hand" and prevent you
   '      from setting any invalid data combinations into the DS1307
   '
   '   It's a crude program, but demonstrates how to set the clock
   '      with control buttons
   '
   '   You will be automatically returned to the Time & Date display if
   '      you are in the Setup and don't touch any Buttons for 20 seconds
   
    include "modedefs.bas"

   DEFINE OSC 4   
   Define LCD_DREG PORTB   ' Port for LCD Data
   Define LCD_DBIT 4   ' Use lower 4 bits of Port
   Define LCD_RSREG PORTB   ' Port for RegisterSelect (RS) bit
   Define LCD_RSBIT 1   ' Port Pin for RS bit
   Define LCD_EREG PORTB   ' Port for Enable (E) bit
   Define LCD_EBIT 3   ' Port Pin for E bit
   DEFINE LCD_RWREG PORTB
    DEFINE LCD_RWBIT 2
    Define LCB_BITS 4   ' Using 4-bit bus
   Define LCD_LINES 2   ' Using 2 line Display
   Define LCD_COMMANDUS 2000
    Define LCD_DATAUS 100   ' Data Delay (uS)

   SCLpin var PORTD.0
   SDApin var PORTD.1

   
   DecButton var PORTD.3   ' Press to Decrement Button
   SetButton var PORTC.4   ' Press to Set/memorise Button
   IncButton var PORTC.5   ' Press to Increment Button
   

   
   '   EEPROM Locations

   Data @0,74,97,110,70,101,98,77,97,114,65,112,114
      ' Jan Feb Mar Apr
   Data 77,97,121,74,117,110,74,117,108,65,117,103
      ' May Jun Jul Aug
   Data 83,101,112,79,99,116,78,111,118,68,101,99
      ' Sep Oct Nov Dec
   Data 84,117,101,87,101,100,84,104,117,70,114,105
      ' Tue Wed Thu Fri
   Data 83,97,116,83,117,110,77,111,110
      ' Sat Sun Mon


   '   RAM Assignments and Variables
   
   CounterA var byte   ' General purpose Variable
   CounterB var byte   ' General purpose Variable
   CounterC var byte   ' General purpose Variable
   CounterD var byte   ' General purpose Variable
   RTCSec var byte      ' Seconds
   RTCMin var byte      ' Minutes
   RTCHour var byte   ' Hours
   RTCWDay var byte   ' Weekday
   RTCDay var byte      ' Day
   RTCMonth var byte   ' Months
   RTCYear var byte   ' Year
   RTCCtrl var byte   ' Control
   SetTime var byte   ' 12/24 Hour Clock
   SetSec var byte      ' Seconds
   SetMin var byte      ' Minutes
   SetHour var byte   ' Hours
   SetDay var byte      ' Day
   SetMonth var byte   ' Months
   SetYear var byte   ' Year
   TimeOut var word   ' Variable for SetUp Menu Time-Out


   ButtonRepeat con 200   

    char    var     byte            ' Storage for serial character
    mode    var     byte            ' Storage for serial mode
    rcv     var  PORTD.6         ' Serial receive pin
    tx      var  PORTD.7
    mode = 2
   
   goto JumpStart


   '
   '   Subroutine Nest Area
   '   ====================

   '
   '   Subroutine Converts back to BCD
   '   -------------------------------
      ' CounterA is the entry variable
      ' CounterB holds the converted BCD result on exit
ConvertBCD:
   CounterB=CounterA DIG 1
   CounterB=CounterB<<4
   CounterB=CounterB+CounterA DIG 0
   Return

   '
   '   Subroutine Displays Month at current Cursor Position
   '   ----------------------------------------------------
      ' CounterB holds Month (1-12) this value is destroyed by the routine
      ' additionally uses CounterA and CounterD variables
DisplayMonth:
   CounterB=CounterB*3-3   ' Convert BCD Month to EEPROM Start Address
DisplaySequence:
   For CounterA=CounterB to CounterB+2
            ' Read and Display Month
      Read CounterA,CounterD
      LCDOut CounterD
      Next CounterA
   Return

   '
   '   Subroutine works out Number of Days in the Month
   '   ------------------------------------------------
      ' SetYear - entry variable containing year (0-99)
      ' SetMonth - entry Variable Containing Month (1-12)
      ' CounterA - exits with number of days
FindDays:
   LookUp SetMonth-1,[31,28,31,30,31,30,31,31,30,31,30,31],CounterA
      ' Above line gives the 'usual' days of the Month
      ' Section below adjusts for Leap-Year
   If SetMonth=2 then
      If (SetYear&$03)=0 then CounterA=29
      endif
   Return
   
   '
   '   Subroutine waits until user reseases Set Button
   '   -----------------------------------------------
SetButtonRelease:
   LCDOut $FE,1
   While SetButton=0:Wend
   Pause 250   ' Small pause to kill any Key-Bounce
   Return

   '
   '   End of Subroutine Nest Area
   '   ---------------------------

   '
   '   Actual Start of Real Program
   '   ============================
JumpStart:

   '
   '   Reset Hardware
   '   --------------
   Pause 200      ' Timeout for LCD to settle

   '
   '   Time & Date Display Loop
   '   ========================
ReDisplay:
   LCDOut $FE,1      ' Clear LCD
ReDisplayLoop:
      '
      '   Read RTC
      '   --------
   I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl]
      '
      '   Decide if Setup Required/Wanted
      '   -------------------------------
   If RTCSec.7=1 then goto SetUpPreset
            ' Hands-Up who noticed the fact that when the DS1307
            ' powers-up initially from cold, and all it's
            ' registers are potentially "unpredictable", that
            ' Seconds bit 7 is always high?
            ' We can use this feature to automatically jump to
            ' our 'Setup' routine on initial power-up if the user
            ' forgets to keep 'Setup' depressed and so prevent
            ' any 'undesriable' Time & Date displays...
   If SetButton=0 then
            ' If Set Button is pressed, User will be taken to
            ' the Setup Menu.  If the Set Button is pressed at
            ' Power-Up, then the User will be taken to the Setup
            ' Menu directly without any intermediate display
      Gosub SetButtonRelease
      goto Setup
      endif   
   '
   '   Display RTC
   '   -----------
   '   Displayed on 2-line 16 character LCD in the form...
   '      10:15:00 AM
   '      Wed 12 Jun 2002
   '   Note - AM/PM indicator only shows in 12 hour mode.
   '   Additionally there is Hours leading Zero Surpression in 12-Hour Mode
   '      after-all, you don't display 07pm do you?
   '
      '
      '   Display Time on Line 1
      '   ----------------------
   LCDOut $FE,$80
   If RTCHour.6=1 then
         ' Work-Out 12 or 24 hour Display for Hours
      CounterA=(RTCHour>>4)&$01
      else
      CounterA=(RTCHour>>4)&$03
      endif
   CounterA=CounterA*10+(RTCHour&$0F)
   If RTCHour.6=1 then
         ' Display Hours appropriately for 12 or 24 hour Mode
      LCDOut #CounterA
      else
      LCDOut #CounterA Dig 1,#CounterA Dig 0
      endif
   LCDOut ":",#(RTCMin>>4)&$0F,#RTCMin&$0F,":"
   LCDOut #(RTCSec>>4)&$0F,#RTCSec&$0F," "
   IF RTCHour.6=1 then
      If RTCHour.5=1 then
         LCDOut "PM"
         else
         LCDOut "AM"
         endif
      endif
      '
      '   Display Day of Week on Line 2
      '   -----------------------------
         ' Let's face it... the DS1307 doesn't calculate the Day of Week,
         ' all it does is increment a number at each mignight from
         ' 1 thru 7 and roll back to start from 1 all over again.
         ' It's really up to you to work out the DOW and program it in.
         ' This is a tough nut for integer math to do... see the
         ' 'Calculate Day of Week' routine in the setup section.
   LCDOut " ",$FE,$C0
   CounterB=RTCWDay*3+33   ' Convert BCD WeekDay to EEPROM Start Address
   Gosub DisplaySequence   ' Display 3 character sequence from EEPROM
      '
      '   Display Date on Line 2
      '   ----------------------
   LCDOut " ",#(RTCDay>>4)&$0F,#RTCDay&$0F," "
   CounterB=((RTCMonth>>4)&$0F)*10+(RTCMonth&$0F)
   Gosub DisplayMonth
   LCDOut " 20",#(RTCYear>>4)&$0F,#RTCYear&$0F,$FE,$80
   '
   Pause 250      ' Repeat about 4 times/sec
   Goto ReDisplayLoop

   '
   '   Clock and Calandar Settings
   '   ===========================
      '
      '   Initial Default Settings
      '   ------------------------
      ' Default setting preset to the moment this program first born
      '
SetupPreset:
   RTCSec=$00      ' Seconds preset to 00
   RTCMin=$15      ' Minutes preset to 15
   RTCHour=$13      ' Hours preset to 13'00
   RTCWDay=$01      ' Weekday preset to 01
   RTCDay=$12      ' Day preset 12
   RTCMonth=$06      ' Months preset to June
   RTCYear=$02      ' Year preset to 2002
   RTCCtrl=$10      ' Control preset to output 1 second 'Tick' on SQWpin
      '
      '   Convert the Current BCD Data to Something easier to Edit
      '   --------------------------------------------------------
Setup:
   SetTime=RTCHour.6   ' Determines 12/24 Hour mode
   If SetTime=1 then
            ' Regardless of 12/24 options, SetHour always
            ' contains the hours in 24 hour clock format
            ' otherwise there's twice the amount of work
            ' to keep track in the edit routines
      SetHour=(RTCHour>>4)&$01
            ' if 12-hour mode
      else
      SetHour=(RTCHour>>4)&$03
            ' if 24 hour mode
      endif
   SetHour=SetHour*10+(RTCHour&$0F)
   If SetTime=1 then
      If RTCHour.5=1 then
         If SetHour<12 then SetHour=SetHour+12
            ' Add-in the AM/PM indicator
         else
         If SetHour=12 then SetHour=0
         endif
      endif
   SetMin=((RTCMin>>4)&$0F)*10+(RTCMin&$0F)
   SetSec=((RTCSec>>4)&$0F)*10+(RTCSec&$0F)
   SetYear=((RTCYear>>4)&$0F)*10+(RTCYear&$0F)
   SetMonth=((RTCMonth>>4)&$0F)*10+(RTCMonth&$0F)
   SetDay=((RTCDay>>4)&$0F)*10+(RTCDay&$0F)
      '
      '   Setup Menu Loop
      '   ---------------
   CounterC=0      ' Set to Start of Setup (seven steps from 0 to 6)
   TimeOut=0      ' Zero the Time-Out counter
SetupLoop:
   LCDOut $FE,1,"Set "
      '
      '   First Display the Menu Prompts
      '   ------------------------------
      '   This is a crude way of doing the entry Menu's but it was
      '   pretty fast and quite mindless to program this lunch-hour
      '
   If CounterC=0 then
      LCDOut "Mode"
      endif
   If CounterC=1 then
      LCDOut "Hours"
      endif
   If CounterC=2 then
      LCDOut "Minutes"
      endif
   If CounterC=3 then
      LCDOut "Seconds"
      endif
   If CounterC=4 then
      LCDOut "Year : 20"
      endif
   If CounterC=5 then
      LCDOut "Month"
      endif
   If CounterC=6 then
      LCDOut "Day"
      endif
   If CounterC<>4 then LCDOut " :"
      '
      '   Now Display the Data
      '   --------------------
SetupDisplayLoop:
         '
         '    12/24 Hour Option
         '   -----------------
   If CounterC=0 then
      LCDOut $FE,$8B
      If SetTime=0 then
         LCDOut "24HR"
         else
         LCDOut "12HR"
         endif
      LCDOut $FE,$8B
      endif
         '   Hours
         '   -----
         '   Hours are tricky because of the 12/24 & AM/PM bit
         '   so we have to reconvert 1-24 back to 1-12 plus AM/PM
   If CounterC=1 then
      CounterA=SetHour
      If SetTime=1 then
         LCDOut $FE,$8E
            ' Display AM/PM bit
         If CounterA<12 then
            LCDOut "AM"
            else
            LCDOut "PM"
            endif
         If CounterA=0 then CounterA=12
         If CounterA>12 then CounterA=CounterA-12
         endif
      LCDOut $FE,$8C,#CounterA
      If CounterA<10 then LCDOut " "         
      LCDOut $FE,$8C
      endif
         '
         '   Minutes
         '   -------
   If CounterC=2 then
      LCDOut $FE,$8E,#SetMin
      If SetMin<10 then LCDOut " "
      LCDOut $FE,$8E
      endif
         '
         '   Seconds
         '   -------
   If CounterC=3 then
      LCDOut $FE,$8E,#SetSec
      If SetSec<10 then LCDOut " "
      LCDOut $FE,$8E
      endif
         '
         '   Year
         '   ----
   If CounterC=4 then
      LCDOut $FE,$8D,#SetYear DIG 1,#SetYear Dig 0
      LCDOut $FE,$8D
      endif
         '
         '   Month
         '   -----
         '   Here's a nice touch to setting the month rather
         '   than the usual number entry method...
         '
   If CounterC=5 then
      LCDOut $FE,$8C
      CounterB=SetMonth
      Gosub DisplayMonth
      LCDOut $FE,$8C
      endif
         '
         '   Day
         '   ---
   If CounterC=6 then
      LCDOut $FE,$8A,#SetDay
      If SetDay<10 then LCDOut " "
      LCDOut $FE,$8A
      endif
      '
      '   The Data-Entry Bit
      '   ------------------
SetupEntryLoop:
         '
         '   Decrement Button Pressed
         '   ------------------------
   If DecButton=0 then
            '
            '   12/24 Clock Selection
            '   ---------------------
      If CounterC=0 then
         If SetTime=0 then
            SetTime=1
            else
            SetTime=0
            endif
         endif
            '
            '   Decrement Hours
            '   ---------------
      If CounterC=1 then
         If SetHour=0 then
            SetHour=23
            else
            SetHour=SetHour-1
            endif
         endif
            '
            '   Decrement Minutes
            '   -----------------
      If CounterC=2 then
         If SetMin=0 then
            SetMin=59
            else
            SetMin=SetMin-1
            endif
         endif
            '
            '   Decrement Seconds
            '   -----------------
            '   Kinda overkill to include setting seconds,
            '   but if you got codespace to burn...
      If CounterC=3 then
         If SetSec=0 then
            SetSec=59
            else
            SetSec=SetSec-1
            endif
         endif
            '
            '   Decrement Years
            '   ---------------
      If CounterC=4 then
         If SetYear=0 then
            SetYear=99
            else
            SetYear=SetYear-1
            endif
         endif
            '
            '   Decrement Month
            '   ---------------
      If CounterC=5 then
         If SetMonth=1 then
            SetMonth=12
            else
            SetMonth=SetMonth-1
            endif
               '
               ' Changing the Month has a bearing on the
               ' days, especially if you've got days preset
               ' to 31 and you now select a month with fewer
               ' days... so this bit here just prevents that
         Gosub FindDays
         If SetDay>CounterA then SetDay=CounterA
         endif
            '
            '   Decrement Days
            '   --------------
            '   Tricky one here... go work-out the days
            '   of the month first...
      If CounterC=6 then
         Gosub FindDays
         If SetDay=1 then
            SetDay=CounterA
            else
            SetDay=SetDay-1
            endif
         endif
      Pause ButtonRepeat
      TimeOut=0
      Goto SetUpDisplayLoop
      endif
         '
         '   Increment Button Pressed
         '   ------------------------
         '    This is just like Decrement but opposite...
   If IncButton=0 then
            '
            '   12/24 Clock Selection
            '   ---------------------
      If CounterC=0 then
         If SetTime=1 then
            SetTime=0
            else
            SetTime=1
            endif
         endif
            '
            '   Increment Hours
            '   ---------------
      If CounterC=1 then
         If SetHour=23 then
            SetHour=0
            else
            SetHour=SetHour+1
            endif
         endif
            '
            '   Increment Minutes
            '   -----------------
      If CounterC=2 then
         If SetMin=59 then
            SetMin=0
            else
            SetMin=SetMin+1
            endif
         endif
            '
            '   Increment Seconds
            '   -----------------
            '   Kinda overkill to include setting seconds,
            '   but if you got codespace to burn...
      If CounterC=3 then
         If SetSec=59 then
            SetSec=0
            else
            SetSec=SetSec+1
            endif
         endif
            '
            '   Increment Years
            '   ---------------
      If CounterC=4 then
         If SetYear=99 then
            SetYear=0
            else
            SetYear=SetYear+1
            endif
         endif
            '
            '   Increment Month
            '   ---------------
      If CounterC=5 then
         If SetMonth=12 then
            SetMonth=1
            else
            SetMonth=SetMonth+1
            endif
               '
               ' Changing the Month has a bearing on the
               ' days, especially if you've got days preset
               ' to 31 and you now select a month with fewer
               ' days... so this bit here just prevents that
         Gosub FindDays
         If SetDay>CounterA then SetDay=CounterA
         endif
            '
            '   Increment Days
            '   --------------
            '   Tricky one here... go work-out the days
            '   of the month first...
      If CounterC=6 then
         Gosub FindDays
         If SetDay=>CounterA then
            SetDay=1
            else
            SetDay=SetDay+1
            endif
         endif
      Pause ButtonRepeat
      TimeOut=0
      Goto SetupDisplayLoop
      endif
         '
         '   Set Button Pressed
         '   ------------------
   If SetButton=0 then
      CounterC=CounterC+1
            ' Increment Menu Item
      TimeOut=0
      If CounterC>6 then
            ' Save Data if all edit items exhaused
         LCDOut $FE,1,"Memorised"
            ' Make the User feel happy
            '
            '   Save 12/24 Hours to BCD DS1307's Format
            '   ---------------------------------------
         CounterA=SetHour
         If SetTime=1 then
            If CounterA>12 then CounterA=CounterA-12
            If CounterA=0 then CounterA=12
            endif
         Gosub ConvertBCD
         RTCHour=CounterB
               ' Save the Hours Value
         If SetTime=1 then
            RTCHour.6=1
               ' Save the 12 Hour Mode Flag
            If SetHour=>12 then RTCHour.5=1
               ' Save the 'PM' Flag
            endif
            '
            '   Save Minutes
            '   ------------
         CounterA=SetMin
         Gosub ConvertBCD
         RTCMin=CounterB
            '
            '   Save Seconds
            '   ------------
         CounterA=SetSec
         Gosub ConvertBCD
         RTCSec=CounterB
            '
            '   Save Year
            '   ---------
         CounterA=SetYear
         Gosub ConvertBCD
         RTCYear=CounterB
            '
            '   Save Month
            '   ----------
         CounterA=SetMonth
         Gosub ConvertBCD
         RTCMonth=CounterB
            '
            '   Save Day
            '   --------
         CounterA=SetDay
         Gosub ConvertBCD
         RTCDay=CounterB
            '
            '   Calculate Day of Week & Save
            '   ----------------------------
               ' Melanie's fudge for calculating Days of Week
               ' using PBP's integer math...
               ' by the time someone's clock displays the
               ' the wrong Day of Week, I'll hopefully have long
               ' retired and be past caring...
               ' I wouldn't however go stick this routine in a
               ' Nuclear Power Station to purge the reactor
               ' every Monday morning without checking how far it
               ' will work before the integer math overflows...
               ' In my routine RTCWDay=1 is a Tuesday (the
               ' start of my week) and continues sequentially
               ' until RTCWDay=7 which is a Monday
         CounterA=SetYear+4
         CounterB=SetMonth
         If SetMonth<3 then
            CounterA=CounterA-1
            CounterB=CounterB+12
            endif
         CounterD=(SetDay+(153*CounterB-457)/5+365*CounterA+CounterA/4-CounterA/100+CounterA/400+2) MOD 7
         RTCWDay=CounterD+1
            '
            '   Do the Business
            '   ---------------

         I2CWrite SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl]
         Pause 1000
         Gosub SetButtonRelease
         Goto ReDisplay
         endif
      Gosub SetButtonRelease
      Goto SetupLoop   ' Loop for Next Menu Item
      endif
      '
      '   Menu TimeOut Counter
      '   --------------------
   Pause 1         ' Kill 1mS
   TimeOut=TimeOut+1
   If TimeOut>20000 then goto ReDisplay
            ' User paused too long
            ' Return User to Time & Date Display
            ' This will however bounce the User to the original
            ' Setup Menu start point if the DS1307 has not
            ' been initialised
   Goto SetupEntryLoop   ' Loop for Button Press

   '
   End

DS1307.zip
(5.49 KiB) Scaricato 147 volte
Avatar utente
Foto Utentedjdanielb
3 4
New entry
New entry
 
Messaggi: 93
Iscritto il: 10 mar 2010, 20:18

0
voti

[9] Re: centrale pilota per orologio ad impulsi

Messaggioda Foto Utentedjdanielb » 23 mar 2012, 13:58

giusto per completezza schema in fidocad
e foto del lavoro realizzato ( poi lo modificherò per metterci le uscite )
ScreenShot001.jpg
ScreenShot001.jpg (93.07 KiB) Osservato 9005 volte
image (2).jpeg
image (2).jpeg (69.36 KiB) Osservato 9005 volte
stampato.JPG
stampato.JPG (503.46 KiB) Osservato 9005 volte
Avatar utente
Foto Utentedjdanielb
3 4
New entry
New entry
 
Messaggi: 93
Iscritto il: 10 mar 2010, 20:18

1
voti

[10] Re: centrale pilota per orologio ad impulsi

Messaggioda Foto UtenteAjKDAP » 23 mar 2012, 14:19

Sei capace di ricompilare il firmware e programmare nuovamente il microcontrollore? Oppure quando hai realizzato il progetto hai utilizzato direttamente il file .HEX ?

Se non hai mai provato, prova a compilare il sorgente e poi a programmare il PIC ;-)


Per l'inversione di polarità penso basti un solo pin del microcontrollore, il solito transistor ed un relè a doppio scambio. Se utilizzi questa configurazione puoi invertire il valore di un singolo pin (alto/basso) ogni 60secondi.

Siccome non ho letto la discussione precedente, non so esattamente che tipo di impulso ti serve, quindi semmai puoi spiegarlo brevemente :mrgreen:

ciao
'˙˙˙·٠•● Alberto ●•٠·˙˙˙'
________________________
http://www.ajk.altervista.org
Avatar utente
Foto UtenteAjKDAP
1.255 2 6 9
Expert EY
Expert EY
 
Messaggi: 796
Iscritto il: 17 mag 2006, 0:13
Località: nella coda dei pronti

Prossimo

Torna a Firmware e programmazione

Chi c’è in linea

Visitano il forum: Nessuno e 7 ospiti