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.

MSp430g2153 rs485 communication

Other Parts Discussed in Thread: MSP430G2153

Dear All,

can anybody tell me whether rs485 and i2c  (both) is possible  with msp430g2153 or not.

 

thanks

regards

  • Rahul Gupta said:
    can anybody tell me whether rs485 and i2c  (both) is possible  with msp430g2153 or not.

    The two parts of the USCI can work simultaneously, so teh USCIA can do the UART job (for RS485 signalling and handshake, you'll have to add addintional hardware, such as the MAX485, and software for controlling the direction) while the USCIB part can at teh same time do I2C. And teh signals are on different port pins too.

    However, I2C will conflict with an attached JTAG, so you can only use SBW when you have the I2C pins in use or connected to I2C devices.

  • Thank you sir for your reply.........

    Actually sir i want to  use MSPg2153 and Tsl235(light to frequency sensor)

    the output of this sensor has to be connected to my mspG2153, WHICH PIN Would BE SUITABLE to connect this sensor as i have to calculate the input frequency(output of sensor will be square wave)

    whats could be the proceedure to calculate frequency.........

    after calculating frequency the data has to be transfered through UART(rs485) to computer.

    could u  tell me the proceedure to acheive above?

    Thanks

    regards

  • Rahul Gupta said:
    WHICH PIN Would BE SUITABLE to connect this sensor

    Basically every I/O pin. But I'd suggest using  apin that is input to a CCR unit. If oyuprogram a timer, e.g. to be clocked with 1MHz, and set up the CCR unit belonging to your signal pin into capture mode, the CCR unit will trigger an interrupt each tiem it detects an edge and also freeze the current timer value. Inside the ISR you can determine with a resolution of 1µs how far the two edges were apart by buildign the difference of the current and the last reading. With 1MHz timer clock, your maximum detectable frequency will be 500kHz (but then, your code might be too slow to catch up with this, even if your CPU clock is 16MHz), and the lowest frequency will be 16Hz, as the tiemr will overflow after 65536 ticks.
    Or mroe precisely, you can detect an incoming signal with a period time of 2..65535 microseconds. Unfortunately, the higher the frequency, the coarser the resolution gets. (2µs is 500kHz, 3µs is 333kHz, 4µs is 250kHz etc.). By chosing a different timer clock, you can move the upper and lower edge of this window up and down.

    The conversion from period time to frequency is best done using a lookup table, as divisions (the 1/t calculation) are slooow.

    For RS485 output you'll need an external RS485 driver such as MAX485. Also, you'll need to implement a logic for the direction control, as RS486 is half-duplex. For the data transfer itself, the USCI module in the G2153 does this job in UART mode. There are plenty of forum threads and code examples available avout this.

  • Thank you very much.....:-)

     

**Attention** This is a public forum