Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22189

MSP430F5438: IR Photodiode sensor

$
0
0

Part Number:MSP430F5438

Hi
I am a student working on a project with MSP-EXP430F5438 LaunchPad and I'm trying to use IR photodiode to open a gate in a model of a parking lot. In order to check my circuit I wrote a simple code just to check if the photodiode connection is working. Code purpose is to turn on the launchpad's LED. 
This is my code: 

void main (void)
{

// Port1 - IR detectors (located in RF3 )
P1DIR = 0x03; // configure pin P1.0 & P1.1 for led output 
P1OUT = 0x00; // clear the output of P1 
P1SEL = 0x00; // set all port1 pins as I/O 

//Port5
P5DIR = 0x01; // P5.0 IR input
P5SEL = 0x00; // set all P5 pins as I/O
P5OUT = 0x00;

while(1){
if(P5IN & 0x01)
P1OUT = 0x03;
else
P1OUT = 0x00;
}

}

also, I am using 10Kohm resistor before the port input as a pullup resistor. This is a diagram of my circuit:


Nothing happens in the LEDs of the MSP and also when I debug the program I don't see the input changing

I've checked my circuit bu connecting a simple LED instead of the port and I see it toggles when I block the IR LED <-> IR PhotoDiode lien of sight

any ideas what I'm doing worng?

Thank you


Viewing all articles
Browse latest Browse all 22189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>