This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430 output at pin

Other Parts Discussed in Thread: MSP430F2274, MSP430G2231

 

Hi 

I am trying to get an output at one of the pins of the Msp430f2274 (Pin2.2). I have the following code but I do not see any output at the pin. I checked with an oscilloscope and a DMM. My code is given as follows:

  P2SEL = ~BIT2;

  P2REN &= ~BIT2;

  P2DIR |=  BIT2;

  P2OUT |= BIT2;

Thanks for the help.

Jehan

 

P.S. this is urgent

 

 

 

 

 

  • Jehan,

    Is this all of the code for your application?

    While this will result in the correct register settings for setting P2.2 as an output high, I would like to point out that " P2SEL = ~BIT2; " affects all of the bits of the P2SEL register, not just BIT2.

    As you have correctly above with P2REN &= ~BIT2; so should P2SEL &= ~BIT2;

    But this is not the source of your problem.

    On P2.2 are you seeing anything? A logic low or floating voltage?

    Which IDE are you using (IAR, CCS, etc)?

    Is this on a TI 38 pin USB target board or a custom built PCB?

    What revision of the MSP430F2274 are you using as well?

    Best regards,

    Austin Miller 

  • I am using IAR and this is part of the code for which i need one of the port pins to go high ( I selected pin 2.2). When i try to probe it using my DMM i do not see any output it stays at 0V. I am using the target board that comes with the ez430 rf 2500 kit.

     

    Thanks I am looking forward to your reply.

    Best,

    Jehan 

  • I don't think you need the P2SEL line at all, just remove it.  I believe this just ties a port to one of the modules like ADC or other.  If you want just the High/low output, you should be fine without... I'm just a newbie too, but worth a try!

    John

  • All,

    If P2SEL BIT 2 is not cleared the port will be configured for Timer A output channel 0.

    P2SEL BIT2 must be cleared for using the P2.2 port pin as a GPIO.

    This is noted on page 60 of the MSP430F2274 device datasheet.

    Jehan,

    Could you post the rest of your code in an attachment or tell me more about what is peripherals are setup within the MSP430?

    Does this logic low on the port pin occur when the code is running or does this also occur when you single step to the P2OUT line as well?

    Best regards,

    Austin Miller

  • Hi Austin,

    I figured it out :) I am getting a high voltage of about 3 V now

    Thanks for the help.

    Jehan

  • Jehan,

    Good to hear that you are up and running. If you do not mind, would you post what the solution to your problem was so that if this thread is searched another member will find this thread helpful as well?

    Best regards,

    Austin Miller

  • I had not connected my DMM correctly before :)

    At the moment I am trying to to edge select interrupts on another pin and am wondering what a low to high transition means in term of the voltage value. 

    I want to know what voltage does the msp consider a high.

     

    Jehan

  • Austin Miller said:

    If P2SEL BIT 2 is not cleared the port will be configured for Timer A output channel 0.

    P2SEL BIT2 must be cleared for using the P2.2 port pin as a GPIO.

    Indeed. But it is clear after a power-on. Unless one intentionally did set this bit after the last PUC, the port is already in GPIO condition

    Jehan karim said:
    I want to know what voltage does the msp consider a high.

    The beforementioned datasheet gives an exhaustive answer to this question for several different working conditions (supply voltage etc.)

    That's what datasheets are written for.

     

     

  • Hi,

    Thanks for the reply. I did checkout the data sheet and I read the trigger voltages before I posted the question. This is the information which i think is relavent (correct me if im wrong please)

     

     

     

    Schmitt-trigger inputs -- Ports P1, P2, P3, P4, and RST/NMI (pg 27)

    A few questions about this:

    Does the Vit+ and Vit- show the trigger voltages when go high to low and vice versa? If so does that mean that it will trigger at any voltage in between the given range?

    My problem:

    Sometimes the interrupt flag is raised at 0.8mV! and sometimes it does not get triggered until 1.4V.....

     

     

  • The informaiton in this section needs to be read like this:

    @3V, the threshold for being accepted as positive is between 1.5 and 2.1V, the threshold for being accepted as negative is below 1.65V but might be as low as 0.75V.  But the difference between the two thresholds is at least 0.4V and at most 1V. (Values taken from 54xx datasheet, may vary for other MSPs and do vary for other supply voltages)

    So if the negative threshold os 1.65V, then the positive one is at least 2.05V., if the positive threshold is 2.1V then the negative is not below 1.1V etc.

    The characteristic of Schmitt trigger is, that there is no single trigger point on which the signal might oscillate. If you fall below exactly the low threshold, the signal must rise again for at least 0.4V (worst or best case, depending on application, is 1V) to cause another level change. Example: a sinus signal that swings between 1V and 2 V. When the signal reaches 1.3V, it is detected low. It goes further low to 1V and then raises again. The schmitt-trigger will still consider it low even above the 1.3V until it reaches the high trigger point, which is at least 0.4V higher (=1.7V). When it reaches 1.7V, the port detects a raising edge. Then the input stays high until the signal falls below 1.3V again.

    The problem with the above example is, that with a low trigger point of 1.4V, the high trigger point might be as high as 2.1V and therefore never reached. So it's best that you have your input signal swing below the lowest and above the highest given trigger voltage. The Schmitt trigger, however, ensures that your signal transitions are clear, even if the signal jitters during the (possibly very slow) transition. You don't get double-triggers unless the signal has a ripple larger than the hysteresis (of at least 0.4V)

  • I am a new newbie to MSP430. I am using MSP430G2231 device and using CCS IDE with MSP430USB FET.

    I want to know whether the bit manupulation of port is possible using P1OUT &= ~BIT6; for reseting P1.6 and P1OUT |= BIT6; for setting P1.6.

     

  • Yasin J.I. said:
    I want to know whether the bit manupulation of port is possible using P1OUT &= ~BIT6; for reseting P1.6 and P1OUT |= BIT6; for setting P1.6.

    While this question fits the topic, it is unrelated to the threads original problem, so it would have been better to start a new thread.

    Anyway, yes, the MSP supports bit manipulations in form of RMW (read modify write) commands. While this is fast, you should keep in mind that the target register/memory cell is actually read, which may have side-efects for some registers (such as clearing an interrupt).

    Besides this, your statements are correct and do what you intend. At least if you have the port bit configured for output before,using the PxDIR register. The default direction is input and the manipulation of P1OUT will only change between pullup and pulldown, if pullups are supported and enabled at all.

**Attention** This is a public forum