Other Parts Discussed in Thread: MSP430G2553
Hello I am a bit new but still trying to do something meaningful, I've already gone trough the tutorials, for lighting up leds and using buttons and ect. now I'd like to ask you about that, I've got an US1881 Hall Latch, and I am trying to detect magnetic field with 430g2553, the idea is I've got a diode with 1k resistor connected to I've got a red diode connected to P1.0 (bit0) and the signal pin of the Hall Latch to P1.6(bit6) but I am having difficulties with the code here is what I've got for now.
#include<msp430G2553.h>
void main(void){
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
P1DIR=0x0F; /// P1.0 through P1.3 will be outputs, while P1.4 through P1.7 will be inputs.
P1OUT |= 0x01; // turn bit zero of port 1 on. P1.0 is now high
while (1)
if (0x0F == 1)
{
P1OUT |= 0x01; // turn bit zero of port 1 on. P1.0 is now high
}
else {
P1OUT &= 0xFE; //turn bit zero of port 1 off. P1.0 is now low
}
}
I've got a red diode connected to P1.0 (bit0) and the signal pin of the Hall Latch to P1.6(bit6)
my idea is: when Hall Latch feels magnetic filed, the diode goes RED, when no magnetic field is sensed the the diode is off.
the diode does not light up :(
please assist :/