Notes
![]() ![]() Notes - notes.io |
#define pintodata BIT0
#define pintolatch BIT1
#define pintoclock BIT2
#define pintodata_2 BIT3
#define pintolatch_2 BIT4
#define pintolatch_3 BIT5
#define pintodata_3 BIT6
void Shift_Out_Reg(char data);
void Shift_Out_Reg2(char data_2);
void Shift_Out_Reg3(char data_3);
void main() {
WDTCTL = WDTPW + WDTHOLD; // Disable Watchdog
P1OUT = 0x00;
P1DIR = pintodata + pintoclock + pintolatch + pintodata_2 + pintolatch_2 + pintodata_3 + pintolatch_3; // Set chosen pins to output direction
while(1) {
volatile unsigned char scnd = 0;
volatile unsigned char scnd_1 = 0;
volatile unsigned char mnts = 0;
volatile unsigned char mnts_1 = 0;
volatile unsigned char hours = 0;
volatile unsigned char hours_1 = 0;
volatile unsigned int j;
while (scnd < 86400) {
hours_1 = hours % 24;
scnd_1 = scnd % 60;
mnts_1 = mnts % 60;
scnd++;
P1OUT &= ~pintolatch;
Shift_Out_Reg(scnd_1);
P1OUT |= pintolatch;
if (scnd_1 == 0)
{
mnts++;
P1OUT &= ~pintolatch_2;
Shift_Out_Reg2(mnts_1);
P1OUT |= pintolatch_2;
if (mnts_1 == 0)
{
hours++;
P1OUT &= ~pintolatch_3;
Shift_Out_Reg3(hours_1);
P1OUT |= pintolatch_3;
}
}
__delay_cycles(1000000);
}
}
}
void Shift_Out_Reg(char data) {
volatile int i;
for (i = 0; i < 8; i++) { // 8 bits to a char
char bittowrite = (0x01 & data); // Get bit
data = data >> 1; // Data shifted left
if (bittowrite == 1) { // Bit sent
P1OUT |= pintodata ;
} else {
P1OUT &= ~pintodata;
}
// Adjusted pulse pintoclock
P1DIR |= pintoclock;
P1DIR &= ~pintoclock;
}
}
void Shift_Out_Reg2(char data_2) {
volatile int i;
for (i = 0; i < 8; i++) { // 8 bits to a char
char bittowrite = (0x01 & data_2); // Get bit
data_2 = data_2 >> 1; // Data shifted left
if (bittowrite == 1) { // Bit sent
P1OUT |= pintodata_2 ;
} else {
P1OUT &= ~pintodata_2 ;
}
// Adjusted pulse pintoclock
P1DIR |= pintoclock;
P1DIR &= ~pintoclock;
}
}
void Shift_Out_Reg3(char data_3) {
volatile int i;
for (i = 0; i < 8; i++) { // 8 bits to a char
char bittowrite = (0x01 & data_3); // Get bit
data_3 = data_3 >> 1; // Data shifted left
if (bittowrite == 1) { // Bit sent
P1OUT |= pintodata_3 ;
} else {
P1OUT &= ~pintodata_3 ;
}
// Adjusted pulse pintoclock
P1DIR |= pintoclock;
P1DIR &= ~pintoclock;
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team