Question

I'm trying to read from parallax SHT11 module with LPC1769 board using FreeRTOS.

I found this example http://wiring.org.co/learning/basics/humiditytemperaturesht11.html

and I'm trying port to LPC1769

Is something similar to shitOut function for this ?

my knowledge about mbed is scarce, In what pin I should write?

LPC_GPIO0->?????

I've read about LPC_GPIOX->FIOPIN stores current pin value, is here?

Was it helpful?

Solution

Sorry...

I've just found a implementation of shiftOut() function :

void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
{
uint8_t i;
digitalWrite(clockPin, LOW);    
for (i = 0; i < 8; i++)  {
    if (bitOrder == LSBFIRST)
        digitalWrite(dataPin, !!(val & (1 << i)));
    else    
        digitalWrite(dataPin, !!(val & (1 << (7 - i))));
    digitalWrite(clockPin, HIGH);
    digitalWrite(clockPin, LOW);    
}
}

Currently I'm only want to support MSBFIRST, so my function looks like...

#define GPIO0_WRITE(Pin,Value)   if ( Value == 0 ) { LPC_GPIO0->FIOCLR|= ( 1 << Pin); } else { LPC_GPIO0->FIOSET |= ( 1 << Pin); }


GPIO0_WRITE(CLOCK_PIN, LOW);   
for (i = 0; i < 8; i++)
{
    GPIO0_WRITE(DATA_PIN, !!(CMD_TEMPERATURE & (1 << (7 - i))));

    GPIO0_WRITE(CLOCK_PIN,HIGH);
    GPIO0_WRITE(CLOCK_PIN,LOW);
}

Any suggestion are welcome.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top