Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Help] traffic light with MSP430

Status
Not open for further replies.

lee_trieu

Newbie level 6
Joined
Nov 5, 2012
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,355
Hi all !
I am trying to do a project on traffic light using MSP430F2131.
I testing my code whith an Example
same as picture bellow
**broken link removed**
and my code
Code:
 #include  "msp430g2231.h" 
int data[]={0,1,2,3,4,5,6,7,8,9};
int add[]={0x00,0x10,0x20,0x30}; 
int i,j,chuc,donvi;
void hienthi1()
{
  
  {
    P1OUT = data[chuc] | add[0];//xuat hang chuc
    __delay_cycles(1);
    P1OUT = data[donvi] | add[1]; //xuat hang don vi
    __delay_cycles(1);
  }
}

void main(void) 
{ 
  WDTCTL = WDTPW + WDTHOLD;   // watchdog timer setup 
  BCSCTL1 = 0x80;                            // Set range = 0x80 ; RSEL = 0;         
                            // DCOCTL = 0xC0;  // DCO=3; MOD = 0 
  DCOCTL |= DCO1 + DCO0 + MOD0; // DCO=3; MOD = 0  
 
//=======> f = 0.12Mhz 
  P1DIR = 0xff;   
  P2DIR = 0xff;// I/O setup 
 
  BCSCTL2 |= SELM_0 + DIVM_3;    // select DCOCLK  ; divide = 8 
        // ===> f = 0.12 / 8 MHz 
  while(1) 
  { 
    for(i=25;i>=0;i--)
   {  
    chuc=i/10;
    donvi=i%10;
   
    hienthi1();
     __delay_cycles(7500);
   }

}
}

But it don't working exactly , first LED still blinking....pls help me to complete my code.
I must complete my project on this weekend:-:)-:)-:)-:)-(
thanks all
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top