AEC1
-
Content Count
4 -
Joined
-
Last visited
Reputation Activity
-
AEC1 reacted to energia in Comparator Use
Yep you can. All register definitions used in e.g. the TI msp430 code examples can be used in Energia. The example code above is from the TI code examples. The header files that are used with CCS are the same as the ones included in gcc and thus Energia.
-
AEC1 reacted to spirilis in Comparator Use
Not sure if Energia has any libraries or functions for doing that, so the devs would have to chime in. You should be able to monkey around with enabling and configuring the comparator the old fashioned way, i.e. toggling the special-function-registers for it... the MSP430 x2xx User's Guide has all those details-- http://www.ti.com/lit/ug/slau144i/slau144i.pdf
Energia (and Arduino, the AVR-oriented IDE it's derived from) ideally abstracts away a lot of those details, but maybe that feature just isn't written yet.
-
AEC1 reacted to energia in Comparator Use
This should help you to get going.
void setup() { pinMode(RED_LED, OUTPUT); /* Internal reference (comp-)0.25 * VCC and turn on */ CACTL1 = CARSEL + CAREF0 + CAON; /* Select P1.3/CA3/S2 as the compare input (comp+). * This selection is not obvious from register bit definitions. * The Comparator_A+ Block Diagram in sectotion Comparator_A+ Introduction * is a better reference. */ CACTL2 = P2CA2 | P2CA1; } void loop() { /* Pressing S2 will turn on the LED1 */ if ((CACTL2 & CAOUT)) digitalWrite(RED_LED, HIGH); else digitalWrite(RED_LED, LOW); }
-
AEC1 reacted to Rickta59 in Comparator Use
There aren't any wrappers for the Comparator as of yet. You could look at the TI code samples for the msp430g2553 and use that as a starting point.
http://www.ti.com/litv/zip/slac485a code samples there. Check out the ones with *_ca_* in the name of the file.
-rick