Write Onewire data toa I2C memory / read ASCI


Closed Thread
Results 1 to 40 of 68

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    Is not a contradict . I write in memory at diversely address and time sequents, and read all address once .
    Ok, so if I am to understand this correctly, at the moment, you have:
    A PIC
    A one-wire temp sensor (model number???)
    A 24FC512 serial eeprom
    A handful of 5x7 LED matrix display units
    An LCD for testing (not to be used in the 'final project')

    Correct so far?

  2. #2
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Don't mean to jump in the middle of everything here, but let me see if I can summarize perhaps what you want to do.

    You want to write both "TEXT" and digits to the EEPROM using one (or several) I2CWRITE command; and you want to read them, again, using one I2CREAD command correct?

    If this is so, I think you really want to revisit what ARATTI said on post #32. Using the STR, [Str Celsius\32], modifier allows to access a whole string (array) which is what you want to do. Let me note though, that this would be an awfull waste of resources. Storing the numeric value in the EEPROM is good, but all additional processing and characters do not need to be on EEPROM.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by languer View Post
    If this is so, I think you really want to revisit what ARATTI said on post #32. Using the STR, [Str Celsius\32], modifier allows to access a whole string (array) which is what you want to do. Let me note though, that this would be an awfull waste of resources. Storing the numeric value in the EEPROM is good, but all additional processing and characters do not need to be on EEPROM.
    He did mention in post #35 that he only wants to store/retrieve the temp results only, not the whole string. But I agree, he should re-visit post #32, as well as post #2, #8, #23, and #25.
    And now that he has an LCD to play with, should re-visit those posts along with trying different methods of displaying numbers on the LCD to get a good idea on how those commands and/or modifiers actually work. Then build up to displaying the results using those modifiers to a 5x7 LED matrix.

  4. #4
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    languer;64350] Don't mean to jump in the middle of everything here, but let me see if I can summarize perhaps what you want to do.

    You want to write both "TEXT" and digits to the EEPROM using one (or several) I2CWRITE command; and you want to read them, again, using one I2CREAD command correct?

    I want to write on memory : simple text ,( letters and ciphers) , data for 2 temperature ,( inside and out ), day , month , year , houre , minutes .And in this monent I do not know to convert hexa result from DS1820 to ASCII to can be some as text .


    If this is so, I think you really want to revisit what ARATTI said on post #32. Using the STR, [Str Celsius\32], modifier allows to access a whole string (array) which is what you want to do.

    Why ? I have a program that work . Do you read it ? I'll try to translate in englesh for easily understand . What you say is to do an other program .

    Let me note though, that this would be an awfull waste of resources. Storing the numeric value in the EEPROM is good, but all additional processing and characters do not need to be on EEPROM

    Is not true , I must to have all in eeprom to can read together ( in my idea and in program what I use now )
    Last edited by Eugeniu; - 18th October 2008 at 21:04.

  5. #5
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Hi !

    Here is some informations about DS 1820 "

    TEMPERATURE/DATA RELATIONSHIP Table 2
    TEMPERATURE DIGITAL OUTPUT DIGITAL OUTPUT
    _______________(Binary)_____________(Hex)

    +85.0°C*____ 0000 0000 1010 1010___00AAh
    +25.0°C ____ 0000 0000 0011 0010___0032h
    +0.5°C______ 0000 0000 0000 0001 __0001h
    0°C_________0000 0000 0000 0000___0000h
    -0.5°C______1111 1111 1111 1111____FFFFh
    -25.0°C_____1111 1111 1100 1110____FFCEh
    -55.0°C_____1111 1111 1001 0010____FF92h

    only right byte I use , but I must to conver it in decimal . The left byte I use only to put "-" sign when it is = FFh .For right side of comma , I use byte 6 from sensor - COUNT REMAIN- . Tell me how convert right byte in decimal
    Last edited by Eugeniu; - 18th October 2008 at 21:01.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Might I suggest that you back up in your process just a bit and practice/learn how to convert and display various types of numbers in general before trying to convert and display a result from a temperature sensor.
    You don't seem to understand that the references to the earlier posts that we are giving you have the some of the information and answers you need to finish your project, DIG is on of those, if not the only one you'll need to convert your data from the binary format to the ASCII format (along with a bit of simple addition) to send to your display subroutine.
    We do not have the hardware you have. We do not have the same 'vision' of the final project that you have, therefore, I think it is relatively unreasonable to ask others to write code FOR you, since that code that is written probably won't work for YOUR particular setup in the end. One thing that DOES work almost everytime though is trying to give a person the building blocks to start somewhere and end up somewhere else...

  7. #7
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Might I suggest that you back up in your process just a bit and practice/learn how to convert and display various types of numbers in general before trying to convert and display a result from a temperature sensor............................................ ...
    OK ! I ' ll do , be sure . Thank you all , for your help . If have you a new idea , pleace , let me know it .

    PS. I have tried all your ideas , and DIG , but they do not work .

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    OK ! I ' ll do , be sure . Thank you all , for your help . If have you a new idea , pleace , let me know it .
    PS. I have tried all your ideas , and DIG , but they do not work .
    I'm trying to help you out. I think in this case, it's a language thing...
    DIG should work for you...pulling individual digits out of the results and displaying them one by one. I don't know what else to say how or to say it for that matter that'll make more sense to you.

  9. #9
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Post

    Ok, look at the info below. Most of it came from http://www.rentron.com/PicBasic/one-wire3.htm and your posted program.

    This may not be the most elegant method, but it should give you a start. I still do not think there is any real value in adding all the "text" characters to the EEPROM, but that's a different story.

    Code:
    ' Additional Variables
    Cold_Bit		VAR temperature.Bit11	' Sign-Bit for +/- Temp. 1 = Below 0 deg C
    Sign			VAR BYTE	' +/- sign for temp display
    temperature_int		VAR BYTE	' integer part of temperature   
    temperature_dec		VAR BYTE	' fractional part of temperature
    
    ' Temperature Readout and manipulation
    OWIn DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE, Skip 4, count_remain, count_per_c]
    
    IF Cold_Bit = 0 THEN	' If Cold_Bit = 0, positive temperature
        Sign  = "+"
        temperature = temperature & $00FF	' Mask lower byte of temperature
        (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c)
    ELSE	' If Cold_Bit = 1, negative temperature
        Sign  = "-"
        temperature = temperature & $00FF	' Mask lower byte of temperature
        (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c)
    ENDIF
    
    'separate interger part from decimal part
    temperature_int = ((temperature DIG 4) * 10) + (temperature DIG 3)	' integer part of temperature
    temperature_dec = ((temperature DIG 1) * 10) + (temperature DIG 0)	' fractional part of temperature
    
    'write digits to EEPROM
    i2cwrite I2CDAT, I2CCLK, $A0, 71,[(temperature DIG 4)+48]	'load EEPROM with integer part
    pause 5
    i2cwrite I2CDAT, I2CCLK, $A0, 72,[(temperature DIG 3)+48]	'load EEPROM with integer part
    pause 5
    i2cwrite I2CDAT, I2CCLK, $A0, 74,[(temperature DIG 2)+48]	'load EEPROM with decimal part
    pause 5  
    i2cwrite I2CDAT, I2CCLK, $A0, 75,[(temperature DIG 1)+48]	'load EEPROM with decimal part
    pause 5

  10. #10
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Ok, so if I am to understand this correctly, at the moment, you have:
    A PIC
    A one-wire temp sensor (model number???)
    A 24FC512 serial eeprom
    A handful of 5x7 LED matrix display units
    An LCD for testing (not to be used in the 'final project')

    Correct so far?
    I have a 7 line X 96 columns leds display , and an other board with LCD display for testing .

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  4. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 00:22
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts