mnpumar 2 Posted November 20, 2010 Share Posted November 20, 2010 I have wired up a layout in which the LEDs are connected in a grid. The rows are all connected to transistors which switch between the positive supply and zero, and the columns switch between an open circuit and a connection to ground I am using the following code: #include "io430.h" void TurnON(unsigned x, unsigned y) { unsigned YBITS[5] = {BIT0, BIT1, BIT2, BIT3, BIT4}; unsigned XBITS[3] = {BIT5, BIT6, BIT7}; P1OUT &= ~YBITS[y]; P1SEL &= ~YBITS[y]; P1DIR |= YBITS[y]; P1OUT |= YBITS[y]; if(x < 3) { P1OUT &= ~XBITS[x]; P1SEL &= ~XBITS[x]; P1DIR |= XBITS[x]; P1OUT |= XBITS[x]; }else { P2OUT &= ~BIT6; P2SEL &= ~BIT6; P2DIR |= BIT6; P2OUT |= BIT6; } } void TurnOFF(unsigned x, unsigned y) { unsigned YBITS[5] = {BIT0, BIT1, BIT2, BIT3, BIT4}; unsigned XBITS[3] = {BIT5, BIT6, BIT7}; P1OUT &= ~YBITS[y]; if(x < 3) { P1OUT &= ~XBITS[x]; }else { P2OUT &= ~BIT6; } } int main( void ) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; TurnON(1,0); TurnOFF(1,0); } The problem is that when I run it with TurnON then TurnOFF, the LED doesn't light up. When run it with just TurnON, the led lights up. However, when I try to display a number on the grid without using TurnOFF, such as a 2, the entire grid just lights up. What am I doing wrong? How do I make the LEDs turn on and off and still see them? Thanks Quote Link to post Share on other sites
mnpumar 2 Posted November 20, 2010 Author Share Posted November 20, 2010 LOL forgot to add infinate loop...guess these things happen when you stay up all night breadboarding/coding Quote Link to post Share on other sites
bluehash 1,581 Posted November 20, 2010 Share Posted November 20, 2010 I'm thinking it's solved? You can start a build log in the project section, if you like. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.