Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you help me to find the error on my code please is for micro procesador msp430 is to control a bdc 7-segment #include msp430g2231.h

Can you help me to find the error on my code please

is for micro procesador msp430

is to control a bdc 7-segment

#include "msp430g2231.h"

int a = BIT0; //P1_0 -> Segment A

int b = BIT1; //P1_1 -> Segment B

int c = BIT2; //P1_2 -> Segment C

int d = BIT3; //P1_3 -> Segment D

int e = BIT4; //P1_4 -> Segment E

int f = BIT5; //P1_5 -> Segment F

int g = BIT6; //P1_6 -> Segment G

void delay(void);

void main(void)

{

unsigned int timeperiod; //Will be used to change timing on digits

P1DIR |= a; // Set P1.0 to output direction

P1DIR |= b; // Set P1.1 to output direction

P1DIR |= c; // Set P1.2 to output direction

P1DIR |= d; // Set P1.3 to output direction

P1DIR |= e; // Set P1.4 to output direction

P1DIR |= f; // Set P1.5 to output direction

P1DIR |= g; // Set P1.6 to output direction

P1OUT = 0x0000; //All segments OFF

while(1)

{

P1OUT &= ~(a + b + c + d + e + f + g); //Makes sure all segments are off

switch(Val)

{

case(0): //Num-0

P1OUT |= a + b + c + d + e + f;

P1OUT &= ~(a + b + c + d + e + f);

break;

case(1): //Num-1

P1OUT |= b + c;

break;

case(2): //Num-2

P1OUT |= a + b + d + e + g;

break;

case(3): //Num-3

P1OUT |= a + b + c + d + g;

break;

case(4): //Num-4

P1OUT |= b + c + f + g;

break;

case(5): //Num-5

P1OUT |= a + c + d + f + g;

break;

case(6): //Num-6

P1OUT |= a + c + d + e + f + g;

break;

case(7): //Num-7

P1OUT |= a + b + c;

break;

case(8): //Num-8

P1OUT |= a + b + c + d + e + f + g;

break;

case(9): //Num-9

P1OUT |= a + b + c + d + f + g;

break;

}

P2OUT |= BIT0; //Set P2_0-> Buzzer ON

Delay();

P2OUT ~= BIT0; //Reset P2_0-> Buzzer OFF

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

How should a firm go about constructing a product attribute map?

Answered: 1 week ago