Jump to content
OzGrant

[Energia Library] OneWire DS18B20 (430 & Stellaris)

Recommended Posts

check the hardware:

Vcc to Vcc

GND to GND

DQ (DATA) to P2.1

resistor (4.7K or 2-6K) from Vcc to P2.1

 

P2.1 defined in code:


#define OWPIN  9


 

pinouts:


 


Figure 5. Powering the DS18B20 with an External Suppl

post-29938-0-51059800-1361386238_thumb.png

Share this post


Link to post
Share on other sites

Hi,

 

I'm trying to get this code(sample code from archive) running on my launchpad, but all I'm getting is 

OW1=85C (when I use parasite wiring),

and not recognizing device when I use external supply wiring ..

Share this post


Link to post
Share on other sites

Hi, 

 

Here is a small change to StellarisOW.ino that will provide full resolution without adding floats.

the binary size remains very small :

Binary sketch size: 4,771 bytes (of a 131,072 byte maximum) (MSP430F5529)
 

:

 

change 

 

byte result[MAXOW+5];
to 
int32_t  result[MAXOW+5];
 
change the saveTemperature(uint8_t ROMno) routine to 
 
void saveTemperature(uint8_t ROMno){
  result[ROMno] = (int32_t)((data[1] << 8) | data[0]);
}
 
change 
         Serial.print(result); 
to 
 
         prt2((result*625)/100);
 
add the prt2 routine 
 
 
void prt2(int x){
    Serial.print(x/100);
    Serial.print(".");
    Serial.print(x%100);
}
 
 
output is now
 
OW1=20.56C OW2=20.62C 
 
Hope this will help some !
 
jxlbbb
 

Share this post


Link to post
Share on other sites

Hi, I work with texas launchpad MSP430G2553 and DS18B20. I download GFDS18B20V2.zip and I follow the instructions. I use a 4.7k resistor pull-up. My problem is that I can't find the device. Anuone help me? Thanks.

Share this post


Link to post
Share on other sites

 

G'day,

I now have a working Dallas Library that works on both 430 and Stellaris using Energia IDE.

Have fun.

Grant

 

Hi OzGrant!

 

Thank you for the usefull OW library (I use it to read  DS18B20). It works great for me on MSP430G2553.

 

The same code with new Energia 0012 and TM4C129 LaunchPad gives me the following error msg

 

 

C:\DOCUME~1\Mama\LOCALS~1\Temp\build596613283320066190.tmp\core.a, -LC:\DOCUME~1\Mama\LOCALS~1\Temp\build596613283320066190.tmp, -lm, -lc, -lgcc, -LC:\DOCUME~1\Mama\LOCALS~1\Temp\build596613283320066190.tmp, -lm]
 
GFDS18B20V2\GFDS18B20.cpp.o: In function `DS18B20::DS18B20(unsigned char)':
C:\Documents and Settings\Mama\Dokumenty\Energia\libraries\GFDS18B20V2/GFDS18B20.cpp:46: undefined reference to `port_to_dir'
C:\Documents and Settings\Mama\Dokumenty\Energia\libraries\GFDS18B20V2/GFDS18B20.cpp:46: undefined reference to `port_to_ren'
C:\Documents and Settings\Mama\Dokumenty\Energia\libraries\GFDS18B20V2/GFDS18B20.cpp:46: undefined reference to `port_to_input'
C:\Documents and Settings\Mama\Dokumenty\Energia\libraries\GFDS18B20V2/GFDS18B20.cpp:46: undefined reference to `port_to_output'
collect2.exe: error: ld returned 1 exit status
 
Thanks for help or hint,
Pavel

Share this post


Link to post
Share on other sites

This problem seems to be caused because the defined macros portDirRegister, portRenRegister, portInputRegister, and portOutputRegister in GFDS18B20.cpp refer to arrays port_to_dir[],  port_to_ren[], port_to_input[] and port_to_output[] which are normally externally defined in the msp430 pins_energia.h file.

 

The current TM4C129 pins_energia.h file found under the lm4f/variants/launchpad_129 directory doesn't define these arrays and appears to use a totally different base referencing scheme for the pin ports.

 

I think it will take a bit more work to get the port register mechanism used for the MSP430 to operate for the TM4C.

 

Jeff

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×