Write Onewire data toa I2C memory / read ASCI


Closed Thread
Results 1 to 40 of 68

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Meaning that the posts referring to the use of the DIG function with bytes/words/whatever are most likely what you need to pull the individual digits out of the bytes/words/whatever to send to the LEDs...
    I have made a few changes :

    In the first time write a few blanks (16)
    I2cwrite I2CDAT , I2CCLK , $A0,ADR,[ ]

    I have insert this lines
    SELECT CASE CARACTER
    ................................................
    CASE %0000000 : SIR_NO=137 ;0
    CASE %0000001 : SIR_NO=140 ;1
    CASE %0000010 : SIR_NO=145 ;2
    CASE %0000011 : SIR_NO=150 ;3
    CASE %0000100 : SIR_NO=155 ;4
    CASE %0000101 : SIR_NO=160 ;5
    CASE %0000110 : SIR_NO=165 ;6
    CASE %0000111 : SIR_NO=170 ;7
    CASE %0001000 : SIR_NO=175 ;8
    CASE %0001001 : SIR_NO=180 ;9
    ..................................................

    TEMP1 VAR BYTE
    TEMP2 VAR BYTE

    temp1 = temperature.LOWBYTE /2
    temp2 = (100- (100/16)*(count_remain))

    (This FORMULAS work very well with LCD display )

    and writing
    adr = 4
    i2cwrite I2CDAT, I2CCLK, $A0, adr,[(temp1)dig 1,(temp1)dig 0,",",temp2 dig 1,temp2 dig 0 ]
    pause 15

    Now I read on LEDS display

    for begining 2000404,0502 ( this ciphers from the right side are more variables)
    when I put my fingers on sensor all nubers are modify . More right side
    and last ciphra from left side :

    200050x,0x0x
    200060x,0x0x
    ..................
    200090x,0x0x
    200010x,0x0x

    " 2 " not change in "3" . And not 25,xx or 26,xx ......and so on

    GIVE ME AN OTHERS IDEAS !

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eugeniu View Post
    adr = 4
    i2cwrite I2CDAT, I2CCLK, $A0, adr,[(temp1)dig 1,(temp1)dig 0,",",temp2 dig 1,temp2 dig 0 ]
    pause 15
    I don't know why you insist on writing individual digits to the eeprom when there is no need to do so...since you can use DIG to get the digits after reading the eeprom...

    GIVE ME AN OTHERS IDEAS !
    You've got all the ideas you should need...over and over, as referenced above. I'm sure this sort of project has been done by numerous people over the years, with PBP, without PBP, with C, with assembly, etc.etc.etc.
    Short of learning Romanian to lower the language barrier even farther, I don't know what else to say or do except write the program for you (not going to happen).
    Maybe somebody else can step in to translate the problem and/or answers better than I, or maybe even somebody else will step in and write the code for you. I'm out...

  3. #3
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    I don't know why you insist on writing individual digits to the eeprom when there is no need to do so...since you can use DIG to get the digits after reading the eeprom...

    All are very simple : I DO NOT KNOW OTHER KIND TO CAN CONTINUOUS PROGREAME AND DISPLAY ALL TEXT AND DATA , OTHER THAN HOW IS ROGRAME WRITE NOW ! IT READ DIGIT BY DIGIT .

  4. #4
    Join Date
    Nov 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Happy end !

    Hi !

    I have find problem and solution .

    I have instal and a LCD display together with my LED display and....I understand that my DS sensor is not ok . Data from it was wrong . I have change sensor and I see that work on LCD , and ....

    In this moment I use this solution :

    In the firs time I define ...

    temperature Var word ' Temperature (integr)
    count_remain Var Byte ' Count remaining
    count_per_c Var Byte ' Count per degree C

    tem var word ' Temperature (decimal)

    zecimi____________ VAR BYTE ' For decimal
    sutimi_____________VAR BYTE ' For decimal

    dozen(zeci)________VAR BYTE
    units(unitati)_______VAR BYTE

    and next ...

    Code:
    mainloop: 
       OWOut DQ, 1, [$55,$47,$6C,$71,$01,$08,$00,$C1,$44]           ' Start conversie temperatura in casa
     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]
       pause 300
        
         
        if temperature.HighByte > $0000 then                ' For " - " temperature DS1820
        temperature =  ($FF - temperature.LowByte)
        tem =  (100/16)*(count_remain)
        pause 50
              LCDOUT $fe, 1
              LCDOUT $FE,$80 ,"Temp= -", dec temperature ,",",dec2  (100/16)*(count_remain)," gr.C"
        
         
         zeci = 48+(temperature //100/10)
         unitati = 48+(temperature // 10)
         zecimi = 48+(tem/10 )
         sutimi = 48+(tem//10)
         
        adr = 2 
    i2cwrite I2CDAT, I2CCLK, $A0, adr,["TEMPERATURE IS =  -",zeci,unitati,".",zecimi,sutimi,"degree C"]   
        else
        temperature = (temperature.LOWBYTE )/2          ' For "+" temperature
        tem =  100- (100/16)*(count_remain)
        pause 50
               LCDOUT $fe, 1
               LCDOUT $fe, $80 
               LCDOUT "temp= " , dec temperature ,"." , dec2 100- (100/16)*(count_remain)," gr.C"
                
          pause 30 
    
         sute = 48 +(temperature // 1000/100)
         zeci = 48+(temperature //100/10)
         unitati = 48+(temperature // 10)
         zecimi = 48+(tem/10 )
         sutimi = 48+(tem//10)
         
        adr = 2
    i2cwrite I2CDAT, I2CCLK, $A0, adr,["TEMPERATURE IS=",zeci,unitati,".",zecimi,sutimi,"degree C"]
      pause 100  
        endif
    Thank you for all your help !

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