Jump to content
43oh

[Energia Library] OneWire DS18B20 (430 & Stellaris)


Recommended Posts

  • Replies 85
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

G'day, I now have a working Dallas Library that works on both 430 and Stellaris using Energia IDE. Have fun. Grant StellarisDS18B20.zip

Opps, zip file now attached GFDS18B20.zip

Tks Pivden, Yes your correct, no idea how the microsec's snuck through, they seem to do that at 2AM. Have updated the zip file. Tks again GFDS18B20V2.zip

Posted Images

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

Link to post
Share on other sites
  • 1 month later...
  • 2 weeks later...
  • 3 weeks later...
  • 1 month later...
  • 2 weeks later...
  • 4 months later...

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
 
Link to post
Share on other sites
  • 1 month later...
  • 1 month later...
  • 1 month later...

 

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
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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...