Write Onewire data toa I2C memory / read ASCI


Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 40 of 68
  1. #1
    Join Date
    Nov 2007
    Posts
    60

    Default Write Onewire data toa I2C memory / read ASCI

    Hi !

    I have a display with leds . If I write a text to a I2C memory (24FC512),I can read and scroll this text on leds display . But...I wish to write the result of measurement from ONEWIRE sensor DS1820 for example :

    " temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c) "


    and to read / display ASCI karacter , something like this :

    "i2cread I2CDAT , I2CCLK , $A0,adrr,[karacter]" karacter to be ASCI code

    I can not know to do this . Can somebody to help me ?

    Thank you very much !
    PS. Escuse me ! I do not know so well english .
    Last edited by Eugeniu; - 14th October 2008 at 23:36.

  2. #2
    Join Date
    Jul 2007
    Location
    Bavaria
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Hi Eugeniu,

    it's not clear to me what you want to do, maybe point 4.17.7. in the manual is what you should have a look at.

    4.17.7 DIG
    DIG returns the value of a decimal digit. Simply tell it the digit number
    (0 - 4 with 0 being the rightmost digit) you would like the value of, and
    voila.
    B0 = 123 ‘ Set B0 to 123
    B1 = B0 DIG 1 ‘ Sets B1 to 2 (digit 1 of
    123)

    This allows you to separate each digit from the computed result.

    But you can also divide the word into two bytes using the .lowbyte and .highbyte modifiers and write them to the display or memory.

    HTH

    Regards,
    Ingo

  3. #3
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by inse View Post
    Hi Eugeniu,

    it's not clear to me what you want to do, maybe point 4.17.7. in the manual is what you should have a look at......................
    I will try to explain :

    I use in this moment .....writing a text in a I2C memory ........

    for adr = 0 to 135
    lookup adr,["WELLCOM ! .......................... 5"],c
    I2cwrite I2CDAT , I2CCLK , $A0,ADR,[C]
    pause 5
    next adr


    Read text :

    i2cread I2CDAT , I2CCLK , $A0,J,[caracter]

    Use " case " for select :

    SELECT CASE CARACTER
    CASE 65: SIR_NO=4 ;A
    CASE 66: SIR_NO=9 ;B
    CASE 67: SIR_NO=14 ;C
    CASE 68: SIR_NO=19 ;D
    CASE 69: SIR_NO=24 ;E


    and .....go for select what leds are on .....

    TABLOU:
    LOOKUP OFSET,[_
    $3F,$48,$48,$48,$3F,_ ;A 0-4
    $36,$49,$49,$49,$7F,_ ;B 4-9
    $22,$41,$41,$41,$3E,_ ;C 9-14
    $3E,$41,$41,$41,$7F,_ ;D 14-19
    $41,$49,$49,$49,$7F,_ ;E 19-24


    I wish to write time to time in memory a temperature from a Onewire sensor tip DS1820 and when I read from memory to find there a ASCI CODE to can use same , in my program .
    Last edited by Eugeniu; - 15th October 2008 at 16:16.

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I have difficulty in understanding what you want to do! You should post the complete code to better understand what you have done and what you want to achieve.

    Remember that you cannot write and read with the same control!

    use:

    WriteDev con %10100000
    ReadDev con %10100001

    Perhaps it will solve your present problem.

    Al.

  5. #5
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    I have difficulty in understanding what you want to do!

    You should post the complete code to better understand what you have done and what you want to achieve.


    Al.
    Briefly : Tell me how can write in a I2C memory result from this :



    mainloop:
    OWOut DQ, 1, [$CC, $44] ' Start temperature conversion

    waitloop:
    OWIn DQ, 4, [count_remain] ' Check for still busy converting
    If count_remain = 0 Then waitloop
    OWOut DQ, 1, [$CC, $BE] ' Read the temperature
    OWIn DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE, Skip 4, count_remain, count_per_c]
    temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c)
    'Calculate temperature in degrees C to 2 decimal places (not valid for negative temperature)


    ******************

    adr = xx
    i2cwrite I2CDAT, I2CCLK, $A0, adr,[temperature]
    pause 5

    ******************

    and how can read from memory something xx,xx (ASCI CODE )

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    Briefly : Tell me how can write in a I2C memory result from this :
    I too am having a bit of difficulty in understanding what you wish to achieve...

    adr = xx
    i2cwrite I2CDAT, I2CCLK, $A0, adr,[temperature]
    pause 5

    ******************

    and how can read from memory something xx,xx (ASCI CODE )
    Is 'temperature' a byte or a word value?
    Are you wanting to get a fractional value out of the eeprom itself?
    Have you put a fractional value into that location of the eeprom?

    I2CREAD I2CDAT , I2CCLK , $A0 , adr , [ temp_read ] - would be a command line for starters...

  7. #7
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    I too am having a bit of difficulty in understanding what you wish to achieve...
    " i2cwrite I2CDAT, I2CCLK, $A0, adr,[I do not know what to write here ]".......

    and , to can read 2 digits and 2 decimals for example
    25,55 grade C

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    " i2cwrite I2CDAT, I2CCLK, $A0, adr,[I do not know what to write here ]".......

    and , to can read 2 digits and 2 decimals for example
    25,55 grade C
    If you read the PBP manual, you'll find commands in the LCD, I2Cxxxx, SERIN/SEROUT, HSERIN/HSEROUT, and various other sections that will show you have these various commands handle digits, decimals (which PBP does NOT natively handle), numeric characters, ASCII values, etc.etc.etc. DEC DIG HEX BIN, and all sorts of other good information in there...

  9. #9
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Split value into two separate bytes

    i2cwrite I2CDAT, I2CCLK, $A0, adr,[Byte_integer,Byte_decimal]

    Al.

  10. #10
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    I put all program .
    Attached Files Attached Files

  11. #11
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    Split value into two separate bytes

    i2cwrite I2CDAT, I2CCLK, $A0, adr,[Byte_integer,Byte_decimal]

    Al.
    You can see in program that I wish to do this . to write at adr. 71 2 digits , and at adr 74, other 2 ( decimals ) But how ?

  12. #12
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    If you read the PBP manual, you'll find commands in the LCD, I2Cxxxx, SERIN/SEROUT, HSERIN/HSEROUT, and various other sections that will show you have these various commands handle digits, decimals (which PBP does NOT natively handle), numeric characters, ASCII values, etc.etc.etc. DEC DIG HEX BIN, and all sorts of other good information in there...
    I know this , and I have used for LCD display , for serin/serout and work , but now I do not know how can use this commands for I2CXXXX. When I use one of this do not accept by MicroCode Studio .

  13. #13
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    I know this , and I have used for LCD display , for serin/serout and work , but now I do not know how can use this commands for I2CXXXX. When I use one of this do not accept by MicroCode Studio .
    You don't have to store them in eeprom in anyway out of the ordinary. If you can display it using those modifiers, then store the data as the raw data. Then recover it as raw data and display it using those modifiers again. You don't have to do anything special to store it.

  14. #14
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    You don't have to store them in eeprom in anyway out of the ordinary. If you can display it using those modifiers, then store the data as the raw data. Then recover it as raw data and display it using those modifiers again. You don't have to do anything special to store it.
    Can you give me a in context example ? Please !

    Thank you !

  15. #15
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    Can you give me a in context example ? Please !
    Just exactly what you had...
    i2cwrite I2CDAT, I2CCLK, $A0, adr,[Byte_integer,Byte_decimal]
    Then read them back the same way and display them on the LCD seperately with a decimal point in between them.

  16. #16
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Just exactly what you had...
    i2cwrite I2CDAT, I2CCLK, $A0, adr,[Byte_integer,Byte_decimal]
    Then read them back the same way and display them on the LCD seperately with a decimal point in between them.
    I do not use LCD , I use a 7 X 96 leds panel . With LCD is very simple ! Support all of these "DEC DIG HEX BIN,"
    Last edited by Eugeniu; - 15th October 2008 at 20:12.

  17. #17
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    I do not use LCD , I use a 7 X 96 leds panel . With LCD is very simple ! Support all of these "DEC DIG HEX BIN,"
    Ahhh....ok....I see now...
    Well then...your answer is in post #2...

  18. #18
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Ahhh....ok....I see now...
    Well then...your answer is in post #2...
    I am sorry ! but I do not see in mind the solution for my problem .
    I say again : PLEASE ! SHOW ME IN CONTEXT EXAMPLE , in my programme.

  19. #19
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    I am sorry ! but I do not see in mind the solution for my problem .
    I say again : PLEASE ! SHOW ME IN CONTEXT EXAMPLE , in my programme.
    Ok, you can't display a byte variable directly because a byte (if larger than 9) contains more than one numeric character right?

  20. #20
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Ok, you can't display a byte variable directly because a byte (if larger than 9) contains more than one numeric character right?
    I must to read from memory , for example :for 25,55 (grade C ) I must to read from memory ...50 53 44 53 53 , or except " , " 50 53 53 53

  21. #21
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    I must to read from memory , for example :for 25,55 (grade C ) I must to read from memory ...50 53 44 53 53 , or except " , " 50 53 53 53
    Yes, I understand, I think... A bit of a language disconnect here I think Not that your English is bad, it's not bad at all, it's far far better than my ______(insert language here)...

    Those sequences of numbers above...What are they? Is that how you have it stored? Or is that how you want to display it...
    What is 25,55? Is it 25.55? Or is it 25, then 55, and so on (I realize in Europe and other parts of the world the comma ( , ) is used in much the same way that folks in the States use the decimal point)...

  22. #22
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Yes, I understand, I think... A bit of a language disconnect here I think Not that your English is bad, it's not bad at all, it's far far better than my ______(insert language here)...

    Those sequences of numbers above...What are they? Is that how you have it stored?

    They are in ACII code . I attach it .



    (I realize in Europe and other parts of the world the comma ( , ) is used in much the same way that folks in the States use the decimal point)...
    Is not impportant , is a separration sign between 25(integer) and 55(2 decimals)
    Attached Files Attached Files

  23. #23
    Join Date
    Jul 2007
    Location
    Bavaria
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Hi Eugeniu,

    as I have already explained in my first post:
    use the DIG modifier to separate the single digits of your calculated temperature.
    Then simply add 48 to each digit and you will get the ASCII code.

    If temperature is 2555 for 25.55°C
    n0 = (temperature dig 0) + 48

    n0 is 48+5 = 53 = ASCII "5"
    ...

    Regards,

    Ingo

  24. #24
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by inse View Post
    Hi Eugeniu,

    as I have already explained in my first post:
    use the DIG modifier to separate the single digits of your calculated temperature.
    Then simply add 48 to each digit and you will get the ASCII code.

    If temperature is 2555 for 25.55°C
    n0 = (temperature dig 0) + 48

    n0 is 48+5 = 53 = ASCII "5"
    ...

    Regards,

    Ingo
    Dear Ingo ,

    I work by many days to do this and in my mind is a black hole. Please if you wish to help me , write a example ,

    i2cwrite I2CDAT, I2CCLK, $A0, adr,[TELL ME WHAT i MUST TO WRITE HERE ]

    I think that you now formula for temperature measurement with Onewire sensor ( one from others ) :
    " temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c) "

    If I will write :

    LCDOUT $FE, $C0, DEC TEMPERATURE
    I'll be reading 2555

    For LCDOUT and to see a comma , I use this formula :
    lcdout "temp= " , dec temperature/2 ,"," , dec2 100- (100/16)*(count_remain)," gr.C"

    , but ....If I write in EEPROM :

    i2cwrite I2CDAT, I2CCLK, $A0, adr,[temperature]

    When I will read it with my FORMULA :

    i2cread I2CDAT , I2CCLK , $A0,J,[caracter]
    in " caracter "will can be read , time to time , a single sign / not a cipher
    Last edited by Eugeniu; - 16th October 2008 at 21:46.

  25. #25
    Join Date
    Jul 2007
    Location
    Bavaria
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Hi Eugeniu,

    your program is a little bit hard to read without knowing Romanian (right?).

    If you want to store the temperature value in single ASCII characters, something like this might work:

    i2cwrite I2CDAT, I2CCLK, $A0, adr,[(temperature dig 0= + 48, (temperature dig 1) + 48, (temperature dig 2) + 48, (temperature dig 3) +48]

    Add the comma where you please or add it after reading back the value.

    Correct me if I am talking bull****...

    Regards,
    Ingo

  26. #26
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by inse View Post
    Hi Eugeniu,

    your program is a little bit hard to read without knowing Romanian (right?).

    If you want to store the temperature value in single ASCII characters, something like this might work:

    i2cwrite I2CDAT, I2CCLK, $A0, adr,[(temperature dig 0= + 48, (temperature dig 1) + 48, (temperature dig 2) + 48, (temperature dig 3) +48]

    Add the comma where you please or add it after reading back the value.

    Correct me if I am talking bull****...

    Regards,
    Ingo
    Uffff, not work . I see or 88888888 , or 44444444 or 77777777 .......
    I'll try to write every DIG , separate . I'll tell you tomorow if work .

    Thank you very much ! Good night !

  27. #27
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    LCDOUT $FE, $C0, DEC TEMPERATURE
    I'll be reading 2555
    If that's the only thing you are getting out of the temp sensor, then I'm thinking it probably meaning that your connection or your sensor probably isn't working because it's returning a value that's always max'd out for a byte variable...
    Put the sensor in some ice water and see if the reading changes...
    Get the core working first, then start adding things. You're not even sure if the sensor part is working in the first place!

    , but ....If I write in EEPROM :
    i2cwrite I2CDAT, I2CCLK, $A0, adr,[temperature]
    When I will read it with my FORMULA :
    i2cread I2CDAT , I2CCLK , $A0,J,[caracter]
    in " caracter "will can be read , time to time , a single sign / not a cipher
    Each one of these statements might only be WRITE'ing (or READ'ing) a BYTE, not a WORD. Not sure what the rest of your code says...

  28. #28
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    You wrote:

    "LCDOUT $FE, $C0, DEC TEMPERATURE
    I'll be reading 2555 "

    Now:

    ByteInteger = TEMPERATURE/100

    ByteDecimal = TEMPERATURE-(ByteInteger*100)

    LCDOUT $FE, $C0, DEC ByteInteger,",",ByteDecimal

    You will see on your display 25,55.

    You don't need to store the comma (separator) but you will store only ByteInteger and ByteDecimal in a location that can be recalled to read back the values. Than after the reading you will add the separator as above.

    Al.

  29. #29
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Sorry I have forgotten a Dec. Please read......

    LCDOUT $FE, $C0, DEC ByteInteger,",",DEC ByteDecimal

  30. #30
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Dear MEN !

    I do not use a LCD display . I have make only a comparision .

    I use in front of my program this line to write text "

    I2Cwrite I2CDAT, I2CCLK, $A0, adr,[" Temperature is _________________ "]

    late in program , in free space I wish to write DATA of temperature

    adr = 15( where is free space )
    I2Cread I2CDAT, I2CCLK, $A0, adr,[ temperature DATA ]

    In finish, I wish to can read all - text and temperature DATA as ASCI CODE such as

    Temperatura is 25,55(for example) .

    from this formula :

    i2cread I2CDAT , I2CCLK , $A0,J,[caracter]

    program read for every adrress (j) a sign (caracter ) in ASCI Code , and this CODE i'll translate in leds on .But where I write temperature DATA , program read other signs not ASCI CODE for 25,55 ( for example )

    Now understand me ?

    I 'll try to write only text with quote and temperature DATA except quote
    Last edited by Eugeniu; - 17th October 2008 at 09:40.

  31. #31
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post

    I 'll try to write only text with quote and temperature DATA except quote
    Not work . Data from DS1820 temperature sensor is in binary . Do you know how can convert it in decimal and use in formula ? Except use DEC .

  32. #32
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    YOU WROTE:
    -------------------------------------------------------------------------
    I do not use a LCD display . I have make only a comparision .
    I use in front of my program this line to write text "
    I2Cwrite I2CDAT, I2CCLK, $A0, adr,[" Temperature is _________________ "]
    late in program , in free space I wish to write DATA of temperature
    adr = 15( where is free space )
    I2Cread I2CDAT, I2CCLK, $A0, adr,[ temperature DATA ]
    ------------------------------------------------------------------------

    I assume you have grounded pin 1 , pin 2 and pin 3 of your 24LC01 chip and that you have pulled up pin 6 and pin 5 with a 4.7K resistors (see page 85 of the manual)

    Just use the following code:

    'set these variable

    WriteDev con %10100000
    ReadDev con %10100001
    Celsius VAR BYTE [32]

    Fix text in the array

    Celsius[0]=84
    Celsius[1]=101
    Celsius[2]=109
    Celsius[3]=112
    Celsius[4]=101
    Celsius[5]=114
    Celsius[6]=97
    Celsius[7]=116
    Celsius[8]=117
    Celsius[9]=114
    Celsius[10]=32
    Celsius[11]=105
    Celsius[12]=115
    Celsius[13]=32
    Celsius[14]=0
    Celsius[15]=44
    Celsius[16]=0


    Now in your program you read temperature from your device and you have the value in the variable TEMPERATURE!

    write:

    Celsius[14] = TEMPERATURE/100
    Celsius[16] = TEMPERATURE - (Celsius[14]*100)

    So you will have the integer part of your value in Celsius[14] and the decimal part in Celsius[16]. Celsius[15]=44 is your separator.

    Now write to your memory at address 0
    adr=0

    I2CWRITE I2CDAT, I2CCLK, WriteDev , adr,[ Str Celsius\32]
    PAUSE 10

    Now if your hardware works properly, you should have stored in your memory the string and the values.

    To recall them back:

    adr=0
    I2CREAD I2CDAT, I2CCLK, ReadDev , adr,[ Str Celsius\32]
    Pause 10

    At this point you send the array to your display

    For A0=0 to 16
    single byte (Celsius[A0]) can be sent to your display
    Next A0

    If you need to store more than on single value you have to increment your Address (adr) by a multiple of 32, and with two values you have filled one page (64 bytes)

    Al.

  33. #33
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    QUOTE=aratti;
    -------------------------------------------------------------------------
    I do not use a LCD display . I have make only a comparision .
    I use in front of my program this line to write text "
    I2Cwrite I2CDAT, I2CCLK, $A0, adr,[" Temperature is _________________ "]
    late in program , in free space I wish to write DATA of temperature
    adr = 15( where is free space )
    I2Cread I2CDAT, I2CCLK, $A0, adr,[ temperature DATA ]
    ------------------------------------------------------------------------

    I assume you have grounded pin 1 , pin 2 and pin 3 of your 24LC01 chip and that you have pulled up pin 6 and pin 5 with a 4.7K resistors (see page 85 of the manual)

    I use this display NOW , and scroll a simple text , but a long text , what is writing in a 24FC512 menory . It has pins 1,2,3,4 and 7 to ground .


    Just use the following code:

    'set these variable

    What doing this ?

    WriteDev con %10100000
    ReadDev con %10100001
    Celsius VAR BYTE [32]

    Fix text in the array

    I use a long text ......with caps.letters only ( you can see this in my programe ).


    Celsius[0]=84 = T
    Celsius[1]=101 = e
    Celsius[2]=109 = m
    Celsius[3]=112 = p
    Celsius[4]=101 = e
    Celsius[5]=114 = r
    Celsius[6]=97 = a
    Celsius[7]=116 = t
    Celsius[8]=117 =u
    Celsius[9]=114 =r
    Celsius[10]=32 = blank
    Celsius[11]=105 = i
    Celsius[12]=115 = s
    Celsius[13]=32 = blank
    Celsius[14]=0 this is not 0
    Celsius[15]=44 = ,
    Celsius[16]=0


    Now in your program you read temperature from your device and you have the value in the variable TEMPERATURE!

    write:

    Celsius[14] = TEMPERATURE/100
    Celsius[16] = TEMPERATURE - (Celsius[14]*100)

    So you will have the integer part of your value in Celsius[14] and the decimal part in Celsius[16]. Celsius[15]=44 is your separator.

    Now write to your memory at address 0
    adr=0

    I2CWRITE I2CDAT, I2CCLK, WriteDev , adr,[ Str Celsius\32]
    PAUSE 10

    Now if your hardware works properly, you should have stored in your memory the string and the values.

    To recall them back:

    Look back in message , I must to use only this formula , only one .
    I2Cread I2CDAT , I2CCLK , $A0 , J ,[caracter]


    adr=0
    I2CREAD I2CDAT, I2CCLK, ReadDev , adr,[ Str Celsius\32]
    Pause 10

    At this point you send the array to your display

    For A0=0 to 16
    single byte (Celsius[A0]) can be sent to your display
    Next A0

    If you need to store more than on single value you have to increment your Address (adr) by a multiple of 32, and with two values you have filled one page (64 bytes)


    Thank you !

  34. #34
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Red face

    Either there is still a serious language barrier here or you're not getting what we're trying to say... In either case, I wish I spoke whatever language you speak so we could get this all straightened out a lot faster...

    I use this display NOW , and scroll a simple text , but a long text , what is writing in a 24FC512 menory . It has pins 1,2,3,4 and 7 to ground .
    And is it working the way you want it to work?

    What doing this ?
    Shouldn't have to use 2 different 'codes' for reading and writing to an I2C eeprom. PBP handles the Read/Write bit (bit0 in the 'code') for you. Should only need to use $A0 when addressing a standard 24xxxxx serial eeprom.

    I use a long text....with caps.letters only (you can see this in my programe)
    Are you storing the entire string, along with the temperature data in the eeprom or just the temperature?

    Look back in message , I must to use only this formula , only one .
    That may be so, but to store a temperature, with a whole part and a fractional part, along with any other characters, you are going to need more than one byte of storage and will need more than one I2CWRITE command...

  35. #35
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    skimask;64321 Either there is still a serious language barrier here or you're not getting what we're trying to say... In either case, I wish I spoke whatever language you speak so we could get this all straightened out a lot faster...

    I am from Bucharest , ROMANIA .

    And is it working the way you want it to work?

    It work OK with a simle text . But I wish to add in the fututre more options such : temperature out , temperature in house , time , date ...


    Shouldn't have to use 2 different 'codes' for reading and writing to an I2C eeprom. PBP handles the Read/Write bit (bit0 in the 'code') for you. Should only need to use $A0 when addressing a standard 24xxxxx serial eeprom.

    Of course , I use this " $A0 "

    Are you storing the entire string, along with the temperature data in the eeprom or just the temperature?

    I wish to store only result ( I think that I understand exactly what you say ??)

    That may be so, but to store a temperature, with a whole part and a fractional part, along with any other characters, you are going to need more than one byte of storage and will need more than one I2CWRITE command...

    Is not important how many I2Cwrite command will be use ,if PIC16F876 support lenght of code . Important is to can used only one command I2Cread to read all - text and data -

  36. #36
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Is not important how many I2Cwrite command will be use ,if PIC16F876 support lenght of code . Important is to can used only one command I2Cread to read all - text and data
    Those 2 comments contradict themselves...
    -----Is not important how many I2CWRITE command will be use, if PIC support length of code----
    Tells me that you can use I2CWRITE as many times as you need as long as the PIC has enough code space left...

    ----Important is to can used only one command I2CREAD to read all - text and data -----
    Tells me that you MUST read everything you write with one single command.

    Which one is it?

  37. #37
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Those 2 comments contradict themselves...
    -----Is not important how many I2CWRITE command will be use, if PIC support length of code----
    Tells me that you can use I2CWRITE as many times as you need as long as the PIC has enough code space left...

    It's true .

    ----Important is to can used only one command I2CREAD to read all - text and data -----
    Tells me that you MUST read everything you write with one single command.

    And this is true .

    Which one is it?
    Is not a contradict . I write in memory at diversely address and time sequents, and read all address once .

  38. #38
    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?

  39. #39
    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.

  40. #40
    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.

Similar Threads

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

Members who have read this thread : 1

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