Jump to content
Sign in to follow this  
davisse

tsl 235r + interrutpts on msp432

Recommended Posts

hi i just started using msp432 and for now i'm using energia.

I plan to use ccs later because i think the possibiliities are more with ccs and register programming rather than arduino code.

i dont get it cant read anything from the sensor when it is fine i tested it on arduino.

i think i misunderstood something about the interrupts and on wich pin i have to attach it.

thx a lot

davisse

volatile unsigned long counter1= 0;
unsigned long oldcnt1 = 0;
unsigned long t = 0;
unsigned long last;

void irq1()
{
 counter1++;
}

void setup() 
{
 Serial.begin(115200);
 Serial.print("START");
 pinMode(40, INPUT);
 digitalWrite(40, HIGH);
 attachInterrupt(36, irq1, RISING);
 
}

void loop() 
{
 if (millis() - last > 1000)
 {
   last = millis();
   t = counter1;
   unsigned long hz = t - oldcnt1;
   Serial.print("FREQ: "); 
   Serial.print(hz);
   Serial.print("\t = "); 
   Serial.print((hz+50)/100);  // +50 == rounding last digit
   Serial.print(" mW/m2");
   Serial.print("\n");
   oldcnt1 = t;
 }
}

Share this post


Link to post
Share on other sites

pinMode(40, INPUT);
digitalWrite(40, HIGH);
attachInterrupt(36, irq1, RISING);

You're initialising pin 40 but you're attaching the interrupt to pin 36.

 

I guess the digitalWrite(40, HIGH); is for internal pull-up.

 

With Energia, use instead pinMode(40, INPUT_PULLUP);

pinMode(40, INPUT_PULLUP);
attachInterrupt(40, irq1, RISING);

Energia relies on the same DriverLib and TI-RTOS as CCS for driving the MCU.

 

If you're looking for a better IDE, have a look at CCS, embedXcode on Mac OS X or Visual Micro on Windows.

Share this post


Link to post
Share on other sites

@@davisse

Looking at the datasheet for the TSL235R, I don't see anywhere mentioning a need for pull up or down on the output and one is not shown on the sample schematic. So, maybe try setting the input pin on the 432 as simple "INPUT" and remove / comment out the digitalWrite setting the pin high. The sensor might pull the pin whichever way it needs to.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...