vadimVladimir 0 Posted October 8, 2013 Share Posted October 8, 2013 Hi all, I just started with msp430. I am very noob !!! First question: How do I set the Status Register bits in C? slau144j.pdf assembly example, setting CPUOFF and GIE bit: ; Enter LPM0 Example BIS #GIE+CPUOFF,SR ; Enter LPM0 ; Exit LPM0 Interrupt Service Routine BIC #CPUOFF,0(SP) ; Exit LPM0 on RETI RETI But if I need set just the GIE bit, how do I do that ? I dont want to use functions like __enable_interrupts(), I Quote Link to post Share on other sites
spirilis 1,265 Posted October 8, 2013 Share Posted October 8, 2013 The intrinsics are used... e.g. __bis_SR_register(GIE); // set GIE bit __bic_SR_register(GIE); // clear GIE bit Those work in MSPGCC, along with a few variations like _BIS_SR() and _BIC_SR() which might also work in TI's CCS IDE (not sure which one is supported by which though; I always use the __bic_SR_register() and __bis_SR_register() type of intrinsics since I use MSPGCC exclusively) vadimVladimir 1 Quote Link to post Share on other sites
spirilis 1,265 Posted October 8, 2013 Share Posted October 8, 2013 PS, the headers have macros to enter LPMx modes, so here's how I typically do it: _EINT(); // intrinsic to set the GIE bit in SR LPM0; // msp430.h header macro that bis's the SR with LPM0_bits Quote Link to post Share on other sites
vadimVladimir 0 Posted October 8, 2013 Author Share Posted October 8, 2013 Thanks for reply, but I Quote Link to post Share on other sites
RobG 1,892 Posted October 8, 2013 Share Posted October 8, 2013 __asm(" BIC.W #0x0008,SR"); __asm(" BIS.W #0x0008,SR"); spirilis and vadimVladimir 2 Quote Link to post Share on other sites
spirilis 1,265 Posted October 8, 2013 Share Posted October 8, 2013 Leave C functions for C programs, or use ASM like Rob's example. Fwiw the compiler condenses the intrinsic functions for the SR down to simple ASM operations against the SR register anyhow. Sent from my Galaxy Note II with Tapatalk 4 Quote Link to post Share on other sites
roadrunner84 466 Posted October 8, 2013 Share Posted October 8, 2013 Thanks for reply, but I vadimVladimir 1 Quote Link to post Share on other sites
vadimVladimir 0 Posted October 8, 2013 Author Share Posted October 8, 2013 Love you guys, thanks for all replies ! :thumbup: Quote Link to post Share on other sites
vadimVladimir 0 Posted October 22, 2013 Author Share Posted October 22, 2013 Another noob question: People is there a way to power the launchpad (msp430 rev1.5) with a external power and connect to usb only to send uart data ? thanks again. Quote Link to post Share on other sites
piglet 14 Posted October 22, 2013 Share Posted October 22, 2013 You can supply 5v & ground to the test points TP1 and TP3 beside the USB socket. If you really don't want to power from the USB then you might have to doctor the micro-usb cable to remove the +5v pin (or cut the wire). The only time I've had to do that was on a Raspberry pi - to prevent a badly regulated powered USB hub from back-powering the Pi. vadimVladimir 1 Quote Link to post Share on other sites
roadrunner84 466 Posted October 22, 2013 Share Posted October 22, 2013 Remove the vcc , reset and test jumpers from the jumper patch. The uart/programmer is still powered over usb, but not the msp itself. vadimVladimir 1 Quote Link to post Share on other sites
piglet 14 Posted October 22, 2013 Share Posted October 22, 2013 Where's ground connected if you do that? I interpreted the original post as needing the entire launchpad powered. It's got to be easier to do that than to put 1.8->3.6v to the launchpad side. Quote Link to post Share on other sites
roadrunner84 466 Posted October 22, 2013 Share Posted October 22, 2013 ground cannot be disconnected and is required to be connected for correct uart operations. however, since vcc is disconnected, the msp will only share the zero voltage reference through ground, but will not draw current from usb. Quote Link to post Share on other sites
vadimVladimir 0 Posted October 22, 2013 Author Share Posted October 22, 2013 Remove the vcc , reset and test jumpers from the jumper patch. The uart/programmer is still powered over usb, but not the msp itself. Thanks again for your help. But do You know any doc where I can learn how the jumpers work ? thanks. Quote Link to post Share on other sites
roadrunner84 466 Posted October 22, 2013 Share Posted October 22, 2013 On the product page of the launchpad is a document with the schematic. Basically there are just a few connections from the debugger/emulator to the target msp, by disconnecting these, you cause the msp to run separate. vadimVladimir 1 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.