+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 20 of 33

Thread: Can anyone Help With Atlas PH stamp on propeller

  1. #1

    Unhappy Can anyone Help With Atlas PH stamp on propeller

    Ive just recieved my ph stamp of atlas that I was waiting for for so long,


    Ive tryed everything but I cant seem to get the simple code to work

    if got my stamp connecter tx stamp - pin8 propeller , rx stamp - p7 propeller

    And to get started I need to send a simple asci code to the stamp and wait for the reply..

    hope anyone can help me with some code to send then recive the data from the stampp

    here a link of the datasheet of the stamp , so you can see the simple commands
    https://www.atlas-scientific.com/ind...t.viewdoc&id=1


    hope to get some help soon
    Igor

  2. #2

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    This is not a Parallax Basic Stamp. It's another company's product that has nothing to do with Parallax. Unfortunately, we can't help you with this Stamp.

    The Propeller should be able to work though. You might download the Simple_Serial I/O driver from the Propeller Object Exchange. This can do ordinary serial I/O up to 9600 Baud. Alternatively, you could download the BS2_Functions object from the Propeller Object Exchange. This provides many of the functional pieces that are implemented as statements in Parallax's Stamp Basic, but as Spin subroutines and functions. There's some explanation in the source code comments for each of the objects. If you're using the Propeller Tool for Propeller programming, these object may already be included in the installation folder.

  3. #3

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Have you checked out this video already?

    http://www.youtube.com/watch?v=UIk6CAINpwo

    ... Tim

  4. #4

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    I modified my SayIt bridge program to act as a bridge to your pH Stamp.

    Set your teminal window to 57600 baud and let me know if this program works.

    Code:
    CON
      _Clkmode = xtal1 + pll16x     ' 80MHz  
      _Xinfreq = 5_000_000          
      ' Pin Assignments
     
      _pHTx = 7                  ' Connected to Rx on pH Stamp
      _pHRx = 8                  ' Connected to Tx on pH Stamp
      _DebugTxPin = 30
      _DebugRxPin = 31
     
      _PhBaud = 38400
      _DebugBaud = 57600
       
    OBJ
      Com[2] : "FullDuplexSerial"                 ' uses two cog
      
    PUB Main | localIndex, localAttmpts
      
      Com[0].start(_DebugRxPin, _DebugTxPin, 0, _DebugBaud)
      Com[1].start(_pHRx, _pHTx, 0, _pHBaud)
      waitcnt(clkfreq / 4 + cnt)
      repeat
        result := Com[0].rxcheck
        if result <> -1 and result <> 0
          Com[1].tx(result)
        result := Com[1].rxcheck
        if result <> -1 and result <> 0
          TbugTx(result)
    PRI TbugTx(localCharacter)
      if (localCharacter > 31 and localCharacter < 127) or localCharacter == 13
        
        Com[0].tx(localCharacter) 
           
      else
        
        Com[0].tx(60)
        Com[0].tx(36)
        Com[0].hex(localCharacter, 2)
        Com[0].tx(62)
    Try typing "L1" followed by enter (and without the quotes) into the terminal window. The LED on the pH Stamp should light up.
    Attached Files Attached Files

  5. #5

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Igor,

    I do a lot of pH testing. I'm very curious what you think of your pH Stamp.

    I hope you let us know how it works.

  6. #6

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    ok , I understand what yo mean , but I must be able to control it using the proppeller and a LCD connected to it

    so this far I am
    Code:
    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000
    
    VAR
    byte command
    
    byte ph
    obj
    PST :"Parallax Serial Terminal"
      debug : "SerialMirror"  
        BS2 : "BS2_Functions"    ' Create BS2 Object
        gg: "simple_serial"
    PUB Main
     Debug.start(31, 30, 0, 115200) 
     gg.init(8, 7,38400)
    
     waitcnt(cnt+ clkfreq/2) 
    
      BS2.Serout_Char(7,"E",38400,BS2#NInv,8)
       BS2.Serout_Char(7,13,38400,BS2#NInv,8)
       Debug.Str(String("Telling Stamp Listen",13))
    
    repeat
    
       
       waitcnt(cnt+ clkfreq*2)
    
       BS2.Serout_Char(7,"R",38400,BS2#NInv,8)
       BS2.Serout_Char(7,13,38400,BS2#NInv,8)
       Debug.Str(String("Asking PH",13))  
       
       waitcnt(cnt+ clkfreq/2)
       BS2.SERIN_STR (8,ph,38400,1,8)
    The light on the stamps blinks like it get's the command to execute a single reading

    but when I try to get the reading , the program stalls at the Serin routine

    can you help me whit the problem

  7. #7

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    He Duane , Your program works good as a heck . Im busy all day this is the first I see, all the commands looks to be working fine

    So thank you alot

    on the other hand , Im fairly new to the propeller and I struggle my way around with most code's but I don't understand a thing of how it works,
    how can I get the data to be displayed in a lcd
    or mean can you help me with it

    im trying for some time allready to make a PH & Ec controller . to Get it wright I decided to get theres stamps.
    some help would be great

  8. #8

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    A couple of problems jump out.

    Code:
    BS2.SERIN_STR (8,ph,38400,1,8)
    you need an address symbol "@" in front of "ph".

    Code:
    BS2.SERIN_STR (8,@ph,38400,1,8)
    ph also needs enough bytes to hold all the characters that are returned.

    Code:
    VAR
    
      byte ph[16]
    Use the above, if don't ever expect to receive more than 15 characters.

    You'll also want a way of displaying the received data.

    Code:
      Debug.Str(@ph)
    The above should display the received data.

    It would probably be a good idea to zero out the byte array between reading from the pH Stamp. If the number of characters received isn't always the same, you could end up having old charaters in your array.

    The following code will fill the array with zeros.

    Code:
      bytefill(@ph, 0, 16)
    Edit: Igor, I hadn't seen your last post when I wrote this. Let me know if you're still having trouble.

  9. #9

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Click image for larger version

Name:	IMG00242-20120201-2325.jpg
Views:	111
Size:	152.1 KB
ID:	89199

    This is how the controller looks like now

  10. #10

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Igor,

    Mike's comment about Simple Serial's baud rate limited reminded me BS_Functions has the same limit.

    Quote Originally Posted by Mike Green View Post
    This can do ordinary serial I/O up to 9600 Baud.
    You'll probably want to use Parallax Serial Terminal or FullDuplexSerial.

  11. #11

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Code:
    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000
    
    VAR
    byte command
    
     
    byte ph[16]
    obj
    PST :"Parallax Serial Terminal"
      debug : "SerialMirror"  
        BS2 : "BS2_Functions"    ' Create BS2 Object
    
    PUB Main
     Debug.start(31, 30, 0, 115200) 
     waitcnt(cnt+ clkfreq/2) 
    
    
     Debug.Str(String("step 1",13))
      BS2.Serout_Char(7,"E",38400,BS2#NInv,8)
       BS2.Serout_Char(7,13,38400,BS2#NInv,8)
       Debug.Str(String("step 2",13))
       Debug.Str(String("Telling Stamp Listen",13))
    
    repeat
    
       
       waitcnt(cnt+ clkfreq*2)
    
       Debug.Str(String("step 3",13))
       
       BS2.Serout_Char(7,"R",38400,BS2#NInv,8)
       BS2.Serout_Char(7,13,38400,BS2#NInv,8)
       Debug.Str(String("Asking PH",13))
       
       Debug.Str(String("step 4",13))
       
       waitcnt(cnt+ clkfreq/2)
    
       Debug.Str(String("Step 5",13))
       
       BS2.SERIN_STR (8,@ph,38400,0,8)
       
       Debug.Str(String("step 6",13))
       
    
       
       Debug.Str(@ph)  
      Debug.Str(String("step 7",13))
    it still get's stuk at the step 5 so at the recive ?????

  12. #12

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Yes but I never understud thos commands , ok sending is one part , that I got

    but recieving the data was always a problem for me , espesialy withe the timming etc.

    you have any idear how a simple code looks like for the fullduplexserial

    it needs to

    send
    step 1 send - E,13

    step 2 send - R,13

    step 3 recive the data

    display the data

    later ill adjust to let the stamp temperture compensate , I have a DS18b20 temp sensor also connected to the stamp to take care of that part for me

    igor

  13. #13

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Igor,

    I think this should get you started.

    Code:
    CON
      _Clkmode = xtal1 + pll16x     ' 80MHz  
      _Xinfreq = 5_000_000          
      ' Pin Assignments
     
      _pHTx = 7                  ' Connected to Rx on pH Stamp
      _pHRx = 8                  ' Connected to Tx on pH Stamp
      _DebugTxPin = 30
      _DebugRxPin = 31
     
      _PhBaud = 38400
      _DebugBaud = 57600
      _BufferSize = 50
       
    VAR
      byte messageBuffer[_BufferSize]
      
    OBJ
      Com[2] : "Parallax Serial Terminal"                 ' uses two cog
      
    PUB Main | localIndex, localAttmpts
      Com[0].StartRxTx(_DebugRxPin, _DebugTxPin, 0, _DebugBaud)
      Com[1].StartRxTx(_pHRx, _pHTx, 0, _pHBaud)
      waitcnt(clkfreq / 4 + cnt)
      Com[1].str(@endCmd)
      
      repeat
        Com[1].str(@readCmd)
        Com[1].StrIn(@messageBuffer)
        Com[0].char(13)
        Com[0].str(@messageBuffer)
        bytefill(@messageBuffer, 0, _BufferSize)
        waitcnt(clkfreq * 2 + cnt)
    DAT
    endCmd        byte "E", 13, 0
    readCmd       byte "R", 13, 0
    continuousCmd byte "C", 13, 0
    The program only sends the "end" command once. From the documentation, it looked like it only needed to be sent once.

    I haven't tested this code and I don't use the "StrIn" method very often (if ever) but I think this code should work.
    Attached Files Attached Files

  14. #14

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Thanks man < it works fine now, this way I can adjust it later to work in the program the way I know how to work with it

    thanky you verryyy veryyy much , Ill keep you posted on how the status of the project is , scool also killing all my time ,

    and im waiting on a ec probe so I can setup the ec stamp *** well

    o almost forgot

    I was going to use temperture dependant readings so . I have a ds1820 sensor connected also and this put's the temp on the lcd,

    how can I make the code accept the temp variable to send in place of the R to get a temperture compensated reading

    the temp code looks like this now in this stage , but works so far
    Code:
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
      OW_DATA           = 14                                 ' 1-wire data pin
    
      SKIP_ROM          = $CC                               ' 1-wire commands
      READ_SCRATCHPAD   = $BE
      CONVERT_T         = $44
    
      CLS               = $00                               ' clear screen
      HOME              = $01                               ' home
      CR                = $0D                               ' carriage return
      DEG               = $B0                               ' degree symbol
       #8, BKSP, TAB, LF
    
       RS = 0                         {lcd control}
      RW = 1                         {lcd control}
      E  = 2                         {lcd control}
      DBLow  = 3                      {lcd control}
      DBHigh = 6                      {lcd control}
    
    
      PSTClearScreen = 16
    OBJ
       LCD : "LCD_20x4" 
      term : "jm_txserial"
      'term          : "tv_text"
      ow            : "OneWire"
      fp            : "FloatString"
      f             : "FloatMath"                           ' could also use Float32
    
    VAR
    
    long tempc  ,temp1,temp
      
    PUB main 
      
    LCD.Init( E, RS, RW, DBHigh, DBLow )                            {LCD init}
    LCD.usDelay( 5_000 )                                            {LCD init}
    LCD.Clear
    
    term.init(30, 115_200)                                        ' start VGA terminal
    
    
      ow.start(OW_DATA)                                     ' start 1-wire object, pin 0
    
      ' read temperature and update display every second
      repeat
        tempC := getTemperature                             ' get temperature in celsius
                 
        
        
         LCD.RawSetPos( $02 )
                             
        LCD.PrintStr(fp.FloatToFormat(temp1, 5, 1))
        LCD.PrintStr( string(" C" ))
    
        
        waitcnt(cnt+clkfreq)
      
    PUB getTemperature 
      ow.reset                                              ' send convert temperature command
      ow.writeByte(SKIP_ROM)
      ow.writeByte(CONVERT_T)
    
      repeat                                                ' wait for conversion
        waitcnt(cnt+clkfreq/1000*25)
        if ow.readBits(1)
          quit
    
      ow.reset                                              ' read DS1822 scratchpad
      ow.writeByte(SKIP_ROM)
      ow.writeByte(READ_SCRATCHPAD)
      temp := ow.readByte + ow.readByte << 8                ' read temperature
      temp1 := F.FDiv(F.FFloat(temp), 16.0)                  ' convert to floating point
    Ill hear from you later , gonna cath a sleep now , tomorrow early scool again

    thanks again
    & hope to hear more from you , help like you is priceless

  15. #15

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    It shouldn't be hard to send the temperature information to the pH Stamp. You'll just use the "dec" method in PST.

    If you're not just sending integer values, you'll have to use some other steps.

    You'll also want to calibrate the meter with buffer solutions. If your meter isn't calibrated, the temperature correction isn't going to matter since you'll likely have greater errors from not calibrating the meter than you'll have from temperature differences.

    It's too bad the pH Stamp doesn't output the millivolt readings because then you could add extra calibration options into your program.

    I've found my pH meter had a hard time accurately measuring pHs around 2 when just calibrated with buffer of 7.00 and 4.00. I have to use a 1.68 buffer and 4.00 buffer to calibrate the meter when I want to measure low pH levels.

    It's best if you can "frame" the pH you wish to measure with buffers above and below the value to be measured.

    I hope you know about using an appropriate soaking solution for your electrode. Don't soak it in distilled water. pH electrodes will go bad over time (kind of like a battery).

    When you get your EC Stamp, you'll need to use a resistor of at least 3.3K between it and the Prop to protect the Prop from the 5V signal levels.

    When I read some data sheets on the type of ADC used in pH meters they stressed the importance of keeping the electronics clean. They strongly suggested using finger cots when handling the chip.

    pH electrodes don't provide a signal that is easy to read for just any ADC chip.

  16. #16

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Click image for larger version

Name:	IMG00244-20120202-1608.jpg
Views:	89
Size:	73.8 KB
ID:	89227Ok Duane, Ive tyred all day again , hihih

    before I get to sending te temperture to the PH stamp to get a temperture compensated reading , I began to figure a way to calculate with the numbers

    I want to get the difference between the mesured Ph of the stamp and a Target_PH value that I set( just a constant now, later ill add it in a lcd menu)

    now the problem looks like I can't get the Ph value that is stored in message buffer to become a floating point valve , so I can make a simple subtraction



    target PH - actual Ph = diference

    this diference is later used to let the pumps know howmuch to dose

    Can you help me with the string to float ???

    hope to hear soon
    igor

    Code:
    CON
    
       _clkmode = xtal1 + pll16x
       _xinfreq = 5_000_000
    
      buton1 =9                    {input buttons }
      buton2 =10                    {input buttons }
      buton3 =11                    {input buttons }
      buton4 =12                     {input buttons }
      
      RS = 0                         {lcd control}
      RW = 1                         {lcd control}
      E  = 2                         {lcd control}
      DBLow  = 3                      {lcd control}
      DBHigh = 6                      {lcd control}
    
      CR  = 13
      LF  = 10
      PSTClearScreen = 16
    
      tempsensor = 14
      vlotter = 13
    
      
      _pHTx = 7                  ' Connected to Rx on pH Stamp
      _pHRx = 8                  ' Connected to Tx on pH Stamp
      _DebugTxPin = 30
      _DebugRxPin = 31
     
      _PhBaud = 38400
      _DebugBaud = 57600
      _BufferSize = 50
    
      Target_PH     = 7.1
                                       
    
      SKIP_ROM          = $CC                               ' 1-wire commands
      READ_SCRATCHPAD   = $BE
      CONVERT_T         = $44
    
      CLS               = $00                               ' clear screen
      HOME              = $01                               ' home
                                   ' carriage return
      DEG               = $B0                               ' degree symbol
       #8, BKSP, TAB
    VAR
    
      byte messageBuffer[_BufferSize]
     long tempc  ,temp1,temp   ,diference,delta    ,ph     ,ph1
     
    OBJ
    
      Com : "Parallax Serial Terminal"                 ' uses two cog
      ow            : "OneWire"
       fp            : "FloatString"
      f             : "FloatMath"   
     
      LCD : "LCD_20x4"
    
      
    PUB Main | localIndex, localAttmpts
    
      ow.start(tempsensor)
      
      LCD.Init( E, RS, RW, DBHigh, DBLow )                            {LCD init}
      LCD.usDelay( 5_000 )                                            {LCD init}
      LCD.Clear
    
    
      
      Com.StartRxTx(_pHRx, _pHTx, 0, _pHBaud)
      waitcnt(clkfreq / 4 + cnt)
    
      Com.str(@endCmd)
      
      repeat
    
        tempC := getTemperature                            {get the temperture}
        LCD.RawSetPos( $0B )                               {set lcd position}
        LCD.PrintStr(fp.FloatToFormat(temp1, 5, 1))        {float to sting}
        LCD.PrintStr( string(" C" ))                       {display C after temp}
    
        
        Com.str(@readCmd)                                 {Ask for Reading}
        Com.StrIn(@messageBuffer)                         {Getting reading Back}
        LCD.RawSetPos( $00 )                              {set lcd position}  
        LCD.PrintStr( String("Ph"))                       {display "ph"}  
        LCD.RawSetPos( $03 )                              {set lcd position}
        LCD.PrintStr( @messagebuffer)                     {print PH value}
        
        ph := @messageBuffer                               {get PH out of buffer}   { this needs to be float }
    
        LCD.RawSetPos( $40 )                              {set lcd position}  
         LCD.PrintStr( String("Target"))
         LCD.RawSetPos( $4C )                              { diplay to seeon lcd }        
         LCD.PrintStr(fp.FloatToFormat(target_ph, 3, 1))
        
         LCD.RawSetPos( $14 )                              {set lcd position}  
         LCD.PrintStr( String("Actual"))
         LCD.RawSetPos( $20 )                              { diplay to seeon lcd }        
         LCD.PrintStr( ph)
         
         delta := f.FSub(Target_Ph,ph )            { display diference from ph and target_ph  }
    
    
        LCD.RawSetPos( $54 )                              {set lcd position}  
        LCD.PrintStr( String("Diference"))                   
              
        LCD.RawSetPos( $60 )                                             
        LCD.PrintStr( fp.FloatToFormat(delta, 4, 2))
            
        bytefill(@messageBuffer, 0, _BufferSize)
        waitcnt(clkfreq/2  + cnt)
    
    
    
    
    
    
    DAT
    
    endCmd        byte "E", 13, 0
    readCmd       byte "R", 13, 0
    continuousCmd byte "C", 13, 0
    
    PUB getTemperature 
      ow.reset                                              ' send convert temperature command
      ow.writeByte(SKIP_ROM)
      ow.writeByte(CONVERT_T)
    
      repeat                                                ' wait for conversion
        waitcnt(cnt+clkfreq/1000*25)
        if ow.readBits(1)
          quit
    
      ow.reset                                              ' read DS1822 scratchpad
      ow.writeByte(SKIP_ROM)
      ow.writeByte(READ_SCRATCHPAD)
      temp := ow.readByte + ow.readByte << 8                ' read temperature
      temp1 := F.FDiv(F.FFloat(temp), 16.0)                  ' convert to floating point

  17. #17

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Igor,

    I thought you'd end up wanting to do something like this.

    You probably don't need to use floating point numbers.

    Talke a look at this thread to see what is referred to as "pseudo real" numbers.

    To turn the ASCII characters to a number, take a look at the "StrToBase" method in PST. You'll want to make it a public method. Use base "10" in the conversion. You'll still need to worry about the decimal point. If the decimal point is always in the same place, you can just us a constant multiplier to know how many places your pseudo real number has been shifted.

    So unless you need some complex mathematics, I'd stay away from floating point numbers for now. When you do need FP, Lonesock's "F32" is the object to use. Lawson just fixed a bug in it. The most recent version is here (post #84).

  18. #18

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    still can't get it working , any code samples ??

  19. #19

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    ok , after hour and hour of reading and trying I got the difference problem solved , it,s still in float
    now on my attemt to send the temp to the ph stamp Ive tryed everything again to get they data alined to be send .
    like 23.5 <cr>
    i moved the data in diferent forms , now I got them in the right spot in the data , but there in the wrong format , there decimal number and need to make it a asci .
    can someone please point out wich way I have to look for an anwserrrrrrrrrrrr

    Code:
    CON
    
       _clkmode = xtal1 + pll16x
       _xinfreq = 5_000_000
    
      buton1 =9                    {input buttons }
      buton2 =10                    {input buttons }
      buton3 =11                    {input buttons }
      buton4 =12                     {input buttons }
      
      RS = 0                         {lcd control}
      RW = 1                         {lcd control}
      E  = 2                         {lcd control}
      DBLow  = 3                      {lcd control}
      DBHigh = 6                      {lcd control}
    
      CR  = 13
      LF  = 10
      PSTClearScreen = 16
    
      tempsensor = 14
      vlotter = 13
    
      zaza = 10.0
      _pHTx = 7                  ' Connected to Rx on pH Stamp
      _pHRx = 8                  ' Connected to Tx on pH Stamp
      _DebugTxPin = 30
      _DebugRxPin = 31
     
      _PhBaud = 38400
      _DebugBaud = 57600
      _BufferSize = 50
    
      Target_PH     = 7.1
                                       
    
      SKIP_ROM          = $CC                               ' 1-wire commands
      READ_SCRATCHPAD   = $BE
      CONVERT_T         = $44
    
      CLS               = $00                               ' clear screen
      HOME              = $01                               ' home
                                   ' carriage return
      DEG               = $B0                               ' degree symbol
       #8, BKSP, TAB
    VAR
    
      byte messageBuffer[_BufferSize]
     long tempc  ,temp1,temp   ,diference,delta    ,ph     ,ph1  ,a,b,c,d,ee,ff,   idx,tc
     byte  nstr[64] 
    OBJ
    
      Com : "Parallax Serial Terminal"                 ' uses two cog
      ow            : "OneWire"
       fp            : "FloatString"
      f             : "FloatMath"   
     
      LCD : "LCD_20x4"
     
      
    PUB Main | localIndex, localAttmpts
    
      ow.start(tempsensor)
      
      LCD.Init( E, RS, RW, DBHigh, DBLow )                            {LCD init}
      LCD.usDelay( 5_000 )                                            {LCD init}
      LCD.Clear
          
     
      waitcnt(clkfreq / 4 + cnt)
    
     
      
      repeat
         
        getTemperature                            {get the temperture}
         
        LCD.RawSetPos( $0B )                               {set lcd position}
        LCD.PrintStr(fp.FloatToFormat(temp1, 5, 1))        {float to sting}
        LCD.PrintStr( string(" C" ))                       {display C after temp}
                                       
       
        byte[@tt][0]:=f.FTrunc(f.fmul(temp1,10.0))/100
        byte[@tt][1]:=f.FTrunc(f.fmul(temp1,10.0))/10 - ((f.FTrunc(f.fmul(temp1,10.0))/100)*10)
        byte[@tt][3]:=f.FTrunc(f.fmul(temp1,10.0))- ((f.FTrunc(f.fmul(temp1,10.0))/10)*10)
        
    
        a:=byte[@tt][0]    
        LCD.RawSetPos( $54 )                              {set lcd position}  
        LCD.Printstr( decx(a,2) )
    
        b:=byte[@tt][1]    
        LCD.RawSetPos( $57 )                              {set lcd position}  
        LCD.Printstr( decx(b,2) )
    
        c:=byte[@tt][2]    
        LCD.RawSetPos( $5A )                              {set lcd position}  
        LCD.Printstr( decx(c,2) )
        
        d:=byte[@tt][3]    
        LCD.RawSetPos( $5F )                              {set lcd position}  
        LCD.Printstr( decx(d,2) )
                  
        ee:=byte[@tt][4]    
        LCD.RawSetPos( $64 )                              {set lcd position}  
        LCD.Printstr( decx(ee,2) )
    
        
         
        waitcnt(clkfreq/2  + cnt)
     
      
    DAT
    
    endCmd        byte "E", 13, 0
    readCmd       byte "r", 13, 0
    continuousCmd byte "C", 13, 0
    tt            byte  "A","5",".","5",13,0
    temp2         long
    PUB getTemperature 
      ow.reset                                              ' send convert temperature command
      ow.writeByte(SKIP_ROM)
      ow.writeByte(CONVERT_T)
    
      repeat                                                ' wait for conversion
        waitcnt(cnt+clkfreq/1000*25)
        if ow.readBits(1)
          quit
    
      ow.reset                                              ' read DS1822 scratchpad
      ow.writeByte(SKIP_ROM)
      ow.writeByte(READ_SCRATCHPAD)
      temp := ow.readByte + ow.readByte << 8                ' read temperature
      temp1 := F.FDiv(F.FFloat(temp), 16.0)                  ' convert to floating point
      
      
    PUB decx(value, digits) | div
    
    '' Returns pointer to zero-padded, signed-decimal string
    '' -- if value is negative, field width is digits+1
    
      clrstr(@nstr, 64)  
      digits := 1 #> digits <# 10
    
      if (value < 0)                                        ' negative value?   
        -value                                              '   yes, make positive
        nstr[idx++] := "-"                                  '   and print sign indicator
    
      div := 1_000_000_000                                  ' initialize divisor
      if digits < 10                                        ' less than 10 digits?
        repeat (10 - digits)                                '   yes, adjust divisor
          div /= 10
      
      value //= (div * 10)                                  ' truncate unused digits
      
      repeat digits
        nstr[idx++] := (value / div + "0")                  ' convert digit to ASCII
        value //= div                                       ' update value
        div /= 10                                           ' update divisor
    
      return @nstr
    
    PRI clrstr(strAddr, size)
    
    ' Clears string at strAddr
    ' -- also resets global character pointer (idx)
    
      bytefill(strAddr, 0, size)                            ' clear string to zeros
      idx~                                                  ' reset index
    I also tryed to convert them one bye one ,like in the code below . works wel for the first digit , second digit is a diferent story sadly enough
    Code:
    PUB  gg 
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 0
         byte[@tt][0]:=48
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 1
         byte[@tt][0]:=49 
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 2
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 3
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 4
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 5
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 6
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 7
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 8
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 9
         byte[@tt][0]:=50 
        
      return
    HELLLLLLLLLPPPPPPPPPPPP

  20. #20

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    You have a floating point number and want that as a string? If so this should do (fp is the FloatString object):
    Code:
    LCD.Printstr(fp.FloatToString(floating_point_number))

+ Reply to Thread

Similar Threads

  1. Stamp --> Propeller
    By worthyamherst in forum Propeller 1 Multicore Microcontroller
    Replies: 9
    Last Post: 07-07-2011, 12:43 PM
  2. Propeller or Stamp?
    By Dwayne Dibbley in forum General Discussion
    Replies: 8
    Last Post: 06-23-2011, 08:18 PM
  3. propeller or Stamp
    By whiteoxe in forum General Discussion
    Replies: 2
    Last Post: 09-06-2010, 04:45 PM
  4. Propeller vs Stamp
    By Dave Adams in forum Propeller 1 Multicore Microcontroller
    Replies: 3
    Last Post: 03-08-2008, 03:40 AM
  5. Atlas Component Analyser?
    By Pezi_Pink! in forum General Discussion
    Replies: 0
    Last Post: 04-14-2006, 04:13 PM

Bookmarks

Posting Permissions

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