NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include <msp430.h>
#define DATAPIN BIT0
#define CLOCKPIN BIT2
#define LATCHPIN BIT1
#define DATAPIN2 BIT3
#define LATCHPIN2 BIT4
#define LATCHPIN3 BIT5
#define DATAPIN3 BIT6

void shiftOut(char data);

void shiftOut2(char data2);

void shiftOut3(char data3);

void main() {

WDTCTL = WDTPW + WDTHOLD; // kill WDT
P1OUT = 0x00;
P1DIR = DATAPIN + CLOCKPIN + LATCHPIN + DATAPIN2 + LATCHPIN2 + DATAPIN3 + LATCHPIN3;


while(1) {
volatile unsigned char second = 0;
volatile unsigned char secondmod = 0;
volatile unsigned char minutes = 0;
volatile unsigned char minutesmod = 0;
volatile unsigned char hours = 0;
volatile unsigned char hoursmod = 0;

while (second < 84000) {

hoursmod = hours % 24;
secondmod = second % 60;
minutesmod = minutes % 60;



second++;
P1OUT &= ~LATCHPIN;
shiftOut(secondmod);
P1OUT |= LATCHPIN;

if (secondmod == 0)
{
minutes++;
P1OUT &= ~LATCHPIN2;
shiftOut2(minutesmod);
P1OUT |= LATCHPIN2;

if (minutesmod == 0)
{
hours++;
P1OUT &= ~LATCHPIN3;
shiftOut3(hoursmod);
P1OUT |= LATCHPIN3;


}

}







__delay_cycles(1000);



}


}
}

void shiftOut(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; // shift data left
if (bittowrite == 1) { // send bit
P1OUT |= DATAPIN ;
} else {
P1OUT &= ~DATAPIN;
}
// pulse clockpin
P1DIR |= CLOCKPIN;
P1DIR &= ~CLOCKPIN;
}

}

void shiftOut2(char data2) {
volatile int i;


for (i = 0; i < 8; i++) { // 8 bits to a char
char bittowrite = (0x01 & data2); // get bit
data2 = data2 >> 1; // shift data left
if (bittowrite == 1) { // send bit
P1OUT |= DATAPIN2 ;
} else {
P1OUT &= ~DATAPIN2 ;
}
// pulse clockpin
P1DIR |= CLOCKPIN;
P1DIR &= ~CLOCKPIN;
}

}


void shiftOut3(char data3) {
volatile int i;



for (i = 0; i < 8; i++) { // 8 bits to a char
char bittowrite = (0x01 & data3); // get bit
data3 = data3 >> 1; // shift data left
if (bittowrite == 1) { // send bit
P1OUT |= DATAPIN3 ;
} else {
P1OUT &= ~DATAPIN3 ;
}
// pulse clockpin
P1DIR |= CLOCKPIN;
P1DIR &= ~CLOCKPIN;
}

}
     
 
what is notes.io
 

Notes.io is a web-based application for 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 12 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

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.