-
          
	
		
		
	
	
	
	
		
	
	
		
			
- 
	
	
		
			
			
				Erfahrener Benutzer
			
			
				Fleißiges Mitglied
			
			
			
			 
			
				
				
				
				
				
					    
				
			
		 
		
			
				
				
				
					Auswertung Uhrzeit
				
				
						
						
				
					
						
							Guten Morgen an alle hier!
Vor paar Tagen hatte ich wegen der Auswertung des Wochentages (RTC 1307) hier eine Frage gestellt und auch eine Lösung bekommen, die auch teilweise funktioniert. Eins geht jedoch nicht. Da ich nicht weiß ob ich einen Fehler gemacht habe, hier meine Frage.
Ich verwende im Prinzip folgenden Code für die RTC. Abhängig vom Wochentag mochte ich etwas bestimmtes starten.  z.B.
if _weekday = 7 then
  Print Bcd(_day) ; "/" ; Bcd(_month) ; "/" ; Bcd(_year) 
LCD _weekday[/color]
endif
Diese If-Schleife habe ich in meinen Code eingebaut (zwichen "****").
Mache ich da was falsch bei der If-Abfrage da ich beim bei mDatum setzen "_weekday = Makebcd(_weekday" verwendet habe?
 
$regfile = "m8def.dat" 
$crystal = 8000000 
$baud = 9600 
Config Sda = Portc.4 
Config Scl = Portc.5 
Dim _weekday As Byte 
Dim _day As Byte 
Dim _month As Byte 
Dim _year As Byte 
Dim _sec As Byte 
Dim _min As Byte 
Dim _hour As Byte 
Dim Ds1307w As Byte 
Dim Ds1307r As Byte 
Ds1307w = &B11010000 
Ds1307r = &B11010001 
_day = 23 
_month = 6 
_year = 05 
_sec = 10 
_min = 10 
_hour = 13 
_weekday = 1 
Rem Zeitsetzen 
_sec = Makebcd(_sec) 
_min = Makebcd(_min) 
_hour = Makebcd(_hour) 
I2cstart 
I2cwbyte Ds1307w 
I2cwbyte 0 
I2cwbyte _sec 
I2cwbyte _min 
I2cwbyte _hour 
I2cstop 
Rem Datumsetzen 
_day = Makebcd(_day) 
_month = Makebcd(_month) 
_year = Makebcd(_year) 
_weekday = Makebcd(_weekday) 
I2cstart 
I2cwbyte Ds1307w 
I2cwbyte 3 
'I2cwbyte _weekday 
I2cwbyte _day 
I2cwbyte _month 
I2cwbyte _year 
I2cstop 
Do 
Rem Datum und Zeit holen 
I2cstart 
I2cwbyte Ds1307w 
I2cwbyte 0 
I2cstart 
I2cwbyte Ds1307r 
I2crbyte _sec , Ack 
I2crbyte _min , Ack 
I2crbyte _hour , Ack 
I2crbyte _weekday , Ack 
I2crbyte _day , Ack 
I2crbyte _month , Ack 
I2crbyte _year , Nack 
I2cstop 
Print Bcd(_hour) ; "/" ; Bcd(_min) ; "/" ; Bcd(_sec) 
Print "---------------------------------------" 
Waitms 1000 
'**************************************
if _weekday = 7 then
  Print Bcd(_day) ; "/" ; Bcd(_month) ; "/" ; Bcd(_year) 
LCD _weekday[/color]
endif
'*****************************************
Loop
						
					 
					
				 
			 
			
			
		 
	 
		
	
 
		
		
		
	
 
	
	
	
	
	
	
	
	
	
	
	
	
		
		
		
		
			
				
				Berechtigungen
			
			
				
	
		- Neue Themen erstellen: Nein
 
		- Themen beantworten: Nein
 
		- Anhänge hochladen: Nein
 
		- Beiträge bearbeiten: Nein
 
		-  
 
	
	
	Foren-Regeln
 
			 
		 
	 
 
  
 
  
 
Lesezeichen