odenkgo
Newbie level 2
- Joined
- Nov 20, 2013
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 14
I used latch, decoder and multipexer.....how can i display the 7 segment from rtc..
this is my coding...can help me where should i add coding to display the time from rtc to 7 segment display..
]
View attachment whole_schematic_schem.png
this is my coding...can help me where should i add coding to display the time from rtc to 7 segment display..
Code:
[CODE]#include "Wire.h"
#define DS1307_ADDRESS 0x68
void setup(){
Wire.begin();
Serial.begin(9600);
}
void loop(){
printDate();
delay(1000);
}
byte bcdToDec(byte val) {
// Convert binary coded decimal to normal decimal numbers
return ( (val/16*10) + (val%16) );
}
void printDate(){
// Reset the register pointer
Wire.beginTransmission(DS1307_ADDRESS);
byte zero = 0x00;
Wire.write(zero);
Wire.endTransmission();
Wire.requestFrom(DS1307_ADDRESS, 7);
int second = bcdToDec(Wire.read());
int minute = bcdToDec(Wire.read());
int hour = bcdToDec(Wire.read() & 0b111111); //24 hour time
int weekDay = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
int monthDay = bcdToDec(Wire.read());
int month = bcdToDec(Wire.read());
int year = bcdToDec(Wire.read());
//print the date
Serial.print(month);
Serial.print("/");
Serial.print(monthDay);
Serial.print("/");
Serial.print(year);
Serial.print(" ");
Serial.print(hour);
Serial.print(":");
Serial.print(minute);
Serial.print(":");
Serial.println(second);
}[/CODE
View attachment whole_schematic_schem.png
Last edited: