LPC1343: i2c temperature sensor

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1343: i2c temperature sensor

1,580 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vin.8teen on Wed Apr 18 05:17:46 MST 2012
hi sir,

can anyone help me in how to test the temperature sensor on LPC1343 using i2c the code available as examples. please....!


thanku,
vinay murthy
0 Kudos
Reply
18 Replies

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mahalinr on Mon Sep 01 14:53:30 MST 2014
Hallo

       can anyone help me in how to test the temperature sensor on LPC11C24 using CAN Communication with the help of some codes
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vin.8teen on Fri Apr 20 01:11:17 MST 2012
sir even im using lpcxpresso ide but wen i took this temperature sensor code its showing me lot of errors sir :( can u give me the full code for interfacing temp sensor on LPC1343 with xmbedded baseborad. please
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Thu Apr 19 21:36:52 MST 2012
Hi..
For your LCD/OLED display you can modify this code and try. Hope it helps you.:)



int main(void)
{
state = joystick_read();
        if (state != 0)
            drawOled(state);

}





static void drawOled(uint8_t joyState)
{
    static int wait = 0;
    static uint8_t currX = 48;
    static uint8_t currY = 32;
    static uint8_t lastX = 0;
    static uint8_t lastY = 0;

    if ((joyState & JOYSTICK_CENTER) != 0) {
        oled_clearScreen(OLED_COLOR_BLACK);
        return;
    }

    if (wait++ < 3)
        return;

    wait = 0;

    if ((joyState & JOYSTICK_UP) != 0 && currY > 0) {
        currY--;
    }

    if ((joyState & JOYSTICK_DOWN) != 0 && currY < OLED_DISPLAY_HEIGHT-1) {
        currY++;
    }

    if ((joyState & JOYSTICK_RIGHT) != 0 && currX < OLED_DISPLAY_WIDTH-1) {
        currX++;
    }

    if ((joyState & JOYSTICK_LEFT) != 0 && currX > 0) {
        currX--;
    }

    if (lastX != currX || lastY != currY) {
        oled_putPixel(currX, currY, OLED_COLOR_WHITE);
        lastX = currX;
        lastY = currY;
    }
}
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Thu Apr 19 21:15:14 MST 2012
Hi.....!!!

I am using LPCxpresso software. On which IDE you want to write your code....:)
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Thu Apr 19 05:31:04 MST 2012
[COLOR=red]Dear vin.8teen,[/COLOR]
[COLOR=red][/COLOR]
[COLOR=red]Please stick to only one forum thread per subject. I've merged your two LPC1343 ADC threads into one.[/COLOR]
[COLOR=red][/COLOR]
[COLOR=red]Also, please take time to answer questions people are asking you, and spend time to make your posts as readable and clear as possible. This way we will be able to help you the best.[/COLOR]
[COLOR=red][/COLOR]
[COLOR=red]Regards,[/COLOR]
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vin.8teen on Thu Apr 19 05:13:56 MST 2012
i please let me in which u software u coded thats in keil or lpcxpresso and it would be kind of u if i get to know how to display on the lcd.please

thankyou
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vin.8teen on Thu Apr 19 05:01:39 MST 2012
sir there is no function in which we write the value to the lcd?
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vin.8teen on Thu Apr 19 04:58:35 MST 2012
thankyou sir. and thiz is the base borad u have used...? http://www.digikey.com/product-highlights/us/en/nxp-semiconductors-mbed-xpresso-baseboard/723 so i just give pin 1_5 to LM35 and +5v to lm35. n u used LPCxpresso sir...?
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Thu Apr 19 04:54:05 MST 2012
Hope this code may help you...Just give a try.. .:)




#include "mcu_regs.h"
#include "type.h"
#include "gpio.h"
#include "temp.h"

/******************************************************************************
* Defines and typedefs
*****************************************************************************/

/*
* Time-Select Pin Configuration. Selected by Jumper J26 on the base board
*/
#define TEMP_TS1 0
#define TEMP_TS0 0

/*
* Pin 0.2 or pin 1.5 can be used as input source for the temp sensor
* Selected by jumper J25.
*/
//#define TEMP_USE_P0_2

#if TEMP_TS1 == 0 && TEMP_TS0 == 0
#define TEMP_SCALAR_DIV10 1
#define NUM_HALF_PERIODS 340
#elif TEMP_TS1 == 0 && TEMP_TS0 == 1
#define TEMP_SCALAR_DIV10 4
#define NUM_HALF_PERIODS 100
#elif TEMP_TS1 == 1 && TEMP_TS0 == 0
#define TEMP_SCALAR_DIV10 16
#define NUM_HALF_PERIODS 32
#elif TEMP_TS1 == 1 && TEMP_TS0 == 1
#define TEMP_SCALAR_DIV10 64
#define NUM_HALF_PERIODS 10
#endif

#define P0_2_STATE ((LPC_GPIO0->DATA & (0x1 << 2)) != 0)
#define P1_5_STATE ((LPC_GPIO1->DATA & (0x1 << 5)) != 0)

#ifdef TEMP_USE_P0_2
#define    GET_TEMP_STATE P0_2_STATE
#else
#define    GET_TEMP_STATE P1_5_STATE
#endif


/******************************************************************************
* External global variables
*****************************************************************************/

/******************************************************************************
* Local variables
*****************************************************************************/

static uint32_t (*getTicks)(void) = NULL;

/******************************************************************************
* Local Functions
*****************************************************************************/

/******************************************************************************
* Public Functions
*****************************************************************************/

/******************************************************************************
*
* Description:
*    Initialize Temp Sensor driver
*
* Params:
*   [in] getMsTicks - callback function for retrieving number of elapsed ticks
*                     in milliseconds
*
*****************************************************************************/
void temp_init (uint32_t (*getMsTicks)(void))
{
#ifdef TEMP_USE_P0_2
    GPIOSetDir( PORT0, 2, 0 );
#else
    GPIOSetDir( PORT1, 5, 0 );
#endif
    getTicks = getMsTicks;
}

/******************************************************************************
*
* Description:
*    Read temperature
*
* Returns:
*    10 x T(c), i.e. 10 times the temperature in Celcius. Example:
*    if the temperature is 22.4 degrees the returned value is 224.
*
*****************************************************************************/
int32_t temp_read (void)
{
    uint8_t state = 0;
    uint32_t t1 = 0;
    uint32_t t2 = 0;
    int i = 0;

    /*
     * T(C) = ( period (us) / scalar ) - 273.15 K
     *
     * 10T(C) = (period (us) / scalar_div10) - 2731 K
     */

    state = GET_TEMP_STATE;

    /* get next state change before measuring time */
    while(GET_TEMP_STATE == state);
    state = !state;

    t1 = getTicks();

    for (i = 0; i < NUM_HALF_PERIODS; i++) {
        while(GET_TEMP_STATE == state);
        state = !state;
    }

    t2 = getTicks();
    if (t2 > t1) {
        t2 = t2-t1;
    }
    else {
        t2 = (0xFFFFFFFF - t1 + 1) + t2;
    }


    return ( (2*1000*t2) / (NUM_HALF_PERIODS*TEMP_SCALAR_DIV10) - 2731 );
}
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vin.8teen on Thu Apr 19 04:52:06 MST 2012
sir i have thiz broad as base borad http://www.digikey.com/product-highlights/us/en/nxp-semiconductors-mbed-xpresso-baseboard/723 and on top connecting the base broad which u have.

vinay
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vin.8teen on Thu Apr 19 04:47:54 MST 2012
ok sir i wil post it right way. sir if u dont mind can i have ur mail id in which i can contact with u, if u dont mind sir.
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Thu Apr 19 04:45:16 MST 2012
If you don't mind can you please post the image of your LPC1343 emulator, because I have one but I guess it is different from yours and it works with baseboard.Image you can see here:-
[COLOR=Blue][B]http://www.google.co.in/imgres?q=lpc1343&um=1&hl=en&safe=active&sa=N&tbm=isch&tbnid=Jq7BTOoWK4YncM:&...[/B][/COLOR]


Thanks & Regards...:)
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vin.8teen on Thu Apr 19 04:36:48 MST 2012
im using a xmbedded borad which is provided by nxp. in tat there is no LM35 i want to interface LM35 to this LPC1343. hope im clear with the answere. n i want to know if anyone can help me with the external connectin connections.
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Thu Apr 19 00:40:10 MST 2012
Hi..

If you are talking about the LPCxpresso Rev. Baseboard which has MAXIM SOT Temperature Sensor with period/frequency output and different electrical characteristic, so matching with LM35 or LM75 can be a problem.
Just do google for MAX6576/MAX6577.

Hope it can help you out.

Thanks : :)
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Wed Apr 18 23:58:43 MST 2012
Hi,

You can have a look at the microbuilder website, they provide a LM75 driver for the LPC1343 in their Code Base.

http://www.microbuilder.eu/projects/LPC1343ReferenceDesign/LPC1343CodeBase.aspx

Regards,
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Wed Apr 18 23:26:56 MST 2012
Are we talking about lpcxpresso board equipped with a lpc1343 (wich revision?)or a custom board?:confused:
I am not aware of any temp sensor on the LPCXPRESSO 1343 board, i even just took the schematics to cheq on it. If i overlooked something...
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vin.8teen on Wed Apr 18 22:48:02 MST 2012
sir its LM75 temp sensor, can we use LM35 instead of LM75
0 Kudos
Reply

1,298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vasanth on Wed Apr 18 10:37:11 MST 2012
Which sensor IC are you talking about ?
0 Kudos
Reply