Shop OBEX P1 Docs P2 Docs Learn Events
Dual Temp Control using BS2,LCD and DS18S20 Code help — Parallax Forums

Dual Temp Control using BS2,LCD and DS18S20 Code help

Radridz3Radridz3 Posts: 49
edited 2009-06-14 20:05 in BASIC Stamp
Hey there everyone this is· only the second time I've used this forum. And everyone was very helpful on my 1st project ....Spotted my typo imdtlyyy.. The project I'm working on know is a dual Temp controller using a common 2x16 hd44780 LCD and 2 DS18S20 Digi temp sensors. 1 sensors for water temp and others for Engine Temp...The Display is from seetron and will be on the dash in my boat. I have looked at some old code for this app in DIY Elect...Using a PIC16F627/628 and 628A...Actually I had to buy the hole kit for 40 bucks just to get the pre prog chip ... So I tried to us the editor to use my BS2 with that code and had no luck. Now since that point I burned up a hard drive and lost all my elect folders/datasheets/research and so on. Because I was to Stupid· not to back it up. Amazing isn't it 4 terra bytes and only had all my info on 1 Drive. Dont rub it in OK++ Im still ticked...Anyways I know your sayin why not just read the PIC again well I returned the Kit after I got what I wanted and Now I'm starting all over...I guess it could be KArma.. If anyone has any info or good links to knowledge let me Now I'm not lookin for some one to give me the code because I really Do want to get better at writting it... Thanks ahead of time.........························ J.Hess

Comments

  • Radridz3Radridz3 Posts: 49
    edited 2009-04-08 06:00
    OK guys so far I have figured out I need to use a different stamp .I'm using homework board and don't see anyway of getting it to do 1 wire digital....I think I need BS2-PE Someone on the forum also said the same thing....Thats probably why it wont run program right...
  • Craig EidCraig Eid Posts: 106
    edited 2009-04-08 07:00
    Rad,

    I think you are you asking if you can implement the 1-wire protocol with a BS2 and the answer is no - but you can use the any of the BS2p microcontrollers to communicate with a DS1820. See the attached link for a discussion of the DS1820 on a previous posting - http://forums.parallax.com/showthread.php?p=651724

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ························ Craig Eid


    ··········· Triad Research and Development
    Electical Engineering Design and Consulting Services

    ··················· www.TriadRD.com
  • Radridz3Radridz3 Posts: 49
    edited 2009-04-12 06:52
    OK figured it out ,,. Im still using a normal stamp and 3 dallas ds18s20 to-92 sensors with a PH Anderson 1 wire controller PIC Board. So there was no need for me to BUY A EXTREMELY OVER PRICED BS2-PPPPPPPPPXPPXPXZZZZZ or whatever.
  • $WMc%$WMc% Posts: 1,884
    edited 2009-04-12 08:07
    Radridz3

    If You dont need an over priced BS---stamp,

    Why Are You in this Froum???

    ____$WMc%___________

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············································ BoogerWoods, FL. USA
  • Radridz3Radridz3 Posts: 49
    edited 2009-04-13 06:31
    Now any better 1's
  • Dave-WDave-W Posts: 94
    edited 2009-04-22 00:52
    Radridz3,
    Keep looking at the Daily Deals and get yourself a BS2P, BS2PE·or better yet a PS2PX.
    The Special deals are the only way to go these days.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave W.
  • pwillardpwillard Posts: 321
    edited 2009-04-22 01:47
    If you are willing to spend that much money... again. Keep the BS2 for a different project and get yourself setup coding the SX chips. SX/B basic will support 1-wire and it's darn close to PBasic.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    There's nothing like a new idea and a warm soldering iron.
  • Radridz3Radridz3 Posts: 49
    edited 2009-04-22 04:04
    I finished this project or the hardware for this project with a PH Anderson 1 wire controller. So I just added another PIC to the project and it controls 7 DS18S20 Sensors... The only problem I'm having now is how to show all the data on an LCD instead of Debug.....Im trying to use a LCD117 Serial Backpack from Modern Devices but the commands are different than the parallax LCD Commands... So if it looks like this with parallax Serout 0, 84, [noparse][[/noparse]22] then on the backpack I have would be Serout 0, 84, [noparse][[/noparse]"?Bff"].. OH and I made these up I don't now what the 22 command is and the lcd117 command is for software controlled backlight... Just threw them out there to show the difference....
  • Radridz3Radridz3 Posts: 49
    edited 2009-04-27 15:45
    Any help or litature on this LCD 117 serial backpack would be helpful thanks. I think I'm going to have to brake down and by a parallax backpack so i can use there commands because I still cant seem to get my data from the debug terminal to show on my LCd ..I have found a few examples from parallax experiments to get my info onto a lcd but there all parallax commands and the 117 doesn't have some of the same commands so no luck yet. Any Help would be appreciated.. And yes I did buy a bs2px for another project and this thing is sweeeeeet...No more bs2e's for me. Once I get better at pbasic2 I'll move onto SX chips...
  • Larry~Larry~ Posts: 242
    edited 2009-04-27 16:07
    command set for lcd 117
    http://moderndevice.com/LCD117CommandSummary.htm

    so what are you sending to the lcd now ?
  • Larry~Larry~ Posts: 242
    edited 2009-04-27 16:15
    Parallax Basic Stamp 2 Example.



    ' LCD117_1.BS2 (Parallax Basic Stamp 2)
    '

    ' Configured for 9600 baud, 8 bits, no parity.
    '
    ' Basic Stamp 2 LCD #117
    '
    ' P0 (term 5)
    > RX (term 7)
    '
    '
    ' Sets geometry of LCD as 4X20 and clears the LCD and writes a byte in decimal and in hex
    ' an integer, a word, a character to the LCD display.
    '
    ' Defines, special characters 0 - 5 as no vertical lines, 1 vertical line, 2 vertical lines etc. Displays an
    ' increasing bar and then a decreasing bar on line 3.
    '
    ' Enters an infinite loop winking outputs 7 and 6.
    '
    ' copyright, Peter H. Anderson, Baltimore, MD, Oct, '06

    BaudMode Con 84 ' 9600 baud, non-inverted

    N Var Byte
    I Var Byte
    WordVar Var Word
    ByteVar Var Byte

    NN Var Byte
    Remainder Var Byte
    Num_5 Var Byte


    Dir0 = 1 ' make P0 an output
    High 0 ' this is the steady state for non-inverted
    Pause 1000 ' allow to stabilize

    SerOut 0, Baudmode, [noparse][[/noparse]"?G420"] ' configure LCD geometry
    Pause 200 ' pause to allow LCD EEPROM to program

    SerOut 0, Baudmode, [noparse][[/noparse]"?B40"] ' set backlight to 40 hex
    Pause 200 ' pause to allow LCD EEPROM to program

    SerOut 0, Baudmode, [noparse][[/noparse]"?f"] ' clear the LCD

    SerOut 0, Baudmode, [noparse][[/noparse]" LCD #117?n"] 'note new line

    SerOut 0, Baudmode, [noparse][[/noparse]"www.phanderson.com?n"]

    SerOut 0, Baudmode, [noparse][[/noparse]"?0?1?2?3?4?5?6?7?n"] ' display special characters

    Pause 5000 ' pause five secs to admire

    SerOut 0, Baudmode, [noparse][[/noparse]"?y1?x00"] ' cursor at line 1, col 0

    SerOut 0, Baudmode, [noparse][[/noparse]"?l?j?l?j?l?y1"]' clear lines 1, 2 and 3 and start at line 1
    ' note use of down cursor

    WordVar = 12345
    ByteVar = 123


    For N = 0 to 25
    SerOut 0, Baudmode, [noparse][[/noparse]"?x00?y1"] ' locate cursor to beginning of line 1
    SerOut 0, Baudmode, [noparse][[/noparse]Dec N, "?t", Hex N, "?t"] ' display N in Dec and Hex
    SerOut 0, Baudmode, [noparse][[/noparse]Dec ByteVar, "?n"]
    SerOut 0, Baudmode, [noparse][[/noparse]Dec WordVar, "?n"] ' display a word
    ByteVar = ByteVar + 1
    WordVar = WordVar + 1
    For I = 1 to 4
    SerOut 0, Baudmode, [noparse][[/noparse]"?g"] ' beep four times
    Pause 50
    Next
    Pause 500
    Next

    SerOut 0, Baudmode, [noparse][[/noparse]"?D00000000000000000"] ' define special characters
    Pause 200 ' delay to allow write to EEPROM

    SerOut 0, Baudmode, [noparse][[/noparse]"?D11010101010101010"]
    Pause 200

    SerOut 0, Baudmode, [noparse][[/noparse]"?D21818181818181818"]
    Pause 200

    SerOut 0, Baudmode, [noparse][[/noparse]"?D31c1c1c1c1c1c1c1c"]
    Pause 200

    SerOut 0, Baudmode, [noparse][[/noparse]"?D41e1e1e1e1e1e1e1e"]
    Pause 200

    SerOut 0, Baudmode, [noparse][[/noparse]"?D51f1f1f1f1f1f1f1f"]
    Pause 200

    SerOut 0, Baudmode, [noparse][[/noparse]"?c0"] ' no cursor
    Pause 200

    SerOut 0, Baudmode, [noparse][[/noparse]"?y3?x00?l"] ' cursor to beginning of line 3 and clear line

    For N = 0 to 25 ' increasing bar
    SerOut 0, Baudmode, [noparse][[/noparse]"?y3?x00"]
    NN = 4 * N
    Num_5 = NN / 5
    Remainder = NN // 5
    For I = 1 to Num_5
    SerOut 0, Baudmode, 10,[noparse][[/noparse]"?5"]
    Next
    SerOut 0, Baudmode, 10, [noparse][[/noparse]"?", Dec1 Remainder]
    Next

    Pause 1000
    For N = 0 to 25 ' decreasing bar
    SerOut 0, Baudmode, [noparse][[/noparse]"?y3?x00?l"]
    NN = 4 * N
    NN = 100 - NN
    Num_5 = NN / 5
    Remainder = NN // 5
    For I = 1 to Num_5
    SerOut 0, Baudmode, 10, [noparse][[/noparse]"?5"]
    Next
    SerOut 0, Baudmode, 10, [noparse][[/noparse]"?", Dec1 Remainder]
    Next

    Do ' continually bring outputs 7 annd 6 high and low
    SerOut 0, Baudmode, [noparse][[/noparse]"?H7?L6"]
    Pause 500
    SerOut 0, Baudmode, [noparse][[/noparse]"?L7?H6"]
    Pause 500
    Loop




    Basic Stamp 2 - Big Number Example


    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    ' LCD117_2.BS2 (Parallax Basic Stamp 2)
    '
    ' Illustrates displaying quantities using the Big Number (3-wide) format.
    '
    ' Continually calls a stub program which returns temperatures in the range
    ' of -99.9 to 999.9 and display on the LCD in the 3-wide big number format.
    '
    ' Configured for 9600 baud, 8 bits, no parity.
    '
    ' Basic Stamp 2 LCD #117
    '
    ' P0 (term 5)
    > RX (term 7)
    '
    ' Sets geometry of LCD as 4X20, sets backlight intensity to 40 hex and configures
    ' for no cursor.
    '
    ' Note that PBASIC 2.5 is used.
    '
    ' copyright, Peter H. Anderson, Baltimore, MD, Oct, '06

    BaudMode CON 84 ' 9600 baud, non-inverted

    N VAR Byte
    T_10 VAR Word
    TWhole VAR Byte
    TFract VAR Byte
    Digit VAR Byte

    DIR0 = 1 ' make P0 an output
    HIGH 0 ' this is the steady state for non-inverted
    PAUSE 1000 ' allow to stabilize

    SEROUT 0, Baudmode, [noparse][[/noparse]"?G420"] ' configure LCD geometry
    PAUSE 200 ' pause to allow LCD EEPROM to program

    SEROUT 0, Baudmode, [noparse][[/noparse]"?B40"] ' set backlight to 40 hex
    PAUSE 200 ' pause to allow LCD EEPROM to program

    SEROUT 0, Baudmode, [noparse][[/noparse]"?c0"] ' clear the cursor
    PAUSE 200

    SEROUT 0, Baudmode, [noparse][[/noparse]"?f"] ' clear the LCD

    ' SEROUT 0, Baudmode, [noparse][[/noparse]"?>3"] 'note new line
    ' PAUSE 200 ' allow time for the new special characters to be downloaded.

    AGN:
    FOR N = 0 TO 7 ' for seven different temperatures
    SEROUT 0, Baudmode, [noparse][[/noparse]"?f"] ' clear the LCD
    SEROUT 0, Baudmode, [noparse][[/noparse]"?>3"]' big num 3 format
    PAUSE 200 ' allow time for the new special characters to be downloaded.

    GOSUB MeasTemp

    IF T_10 >= $8000 THEN ' if sign bit is one, its negative
    T_10 = -T_10
    TWhole = T_10 / 10 ' separate off whole and fractional parts
    TFract = T_10 // 10

    IF TWhole > 9 THEN ' -10 to -99
    SEROUT 0, Baudmode, [noparse][[/noparse]"-"]
    Digit = TWhole / 10
    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 Digit]
    Digit = TWhole // 10
    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 Digit]
    ELSE ' -0.0 to - 9.9
    SEROUT 0, Baudmode, [noparse][[/noparse]"?y0?x04"]
    SEROUT 0, Baudmode, [noparse][[/noparse]"-"]
    Digit = TWhole
    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 Digit]
    ENDIF

    ELSE ' its positive
    TWhole = T_10 / 10
    TFract = T_10 // 10
    IF TWhole > 99 THEN ' 100.0 - 999.0
    Digit = TWhole / 100
    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 Digit]
    TWhole = TWhole // 100
    Digit = TWhole / 10
    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 Digit]
    Digit = TWhole // 10
    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 Digit]
    ELSEIF TWhole > 9 THEN ' 10.0 to 99.0
    SEROUT 0, Baudmode, [noparse][[/noparse]"?y0?x02"]
    Digit = TWhole / 10
    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 Digit]
    Digit = TWhole // 10
    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 Digit]
    ELSE
    SEROUT 0, Baudmode, [noparse][[/noparse]"?y0?x06"]
    Digit = TWhole
    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 Digit]
    ENDIF
    ENDIF
    ' now the fractional part
    SEROUT 0, Baudmode, [noparse][[/noparse]"."]

    SEROUT 0, Baudmode, [noparse][[/noparse]DEC1 TFract]

    SEROUT 0, Baudmode, [noparse][[/noparse]"?<"] ' Display "Deg F" in normal text
    SEROUT 0, Baudmode, [noparse][[/noparse]"?y1?x17"]
    SEROUT 0, Baudmode, [noparse][[/noparse]"Deg"]
    SEROUT 0, Baudmode, [noparse][[/noparse]"?y2?x17"]
    SEROUT 0, Baudmode, [noparse][[/noparse]" F "]

    PAUSE 2500
    NEXT

    GOTO AGN

    MeasTemp:
    ' This is a stub which returns various values of a temerature T_10
    ' It is intended to illustrate examples from -99.9 to 999.0
    LOOKUP N, [noparse][[/noparse]-123, -42, -8, 1234, 723, 72, 2], T_10
    '-12.3, -4.2, -0.8, 123.4, 72.3, 7.2, 0.2
    RETURN
  • Radridz3Radridz3 Posts: 49
    edited 2009-04-28 01:42
    I understand the commands for the 117 but all the demo's are with parallax codes. I can put anything I want on the display right now just don't now how to get Andersons DS18S20 demo code to show on the display.. Both of the demo codes you posted above I have done and they work. But the only info about reading a temp in realtime is a stub routine and doesn't teach me anything. Here's the code Im using to read temp data on debug terminal . This code hasn't been changed to 18s20 yet its still on 18B20..So don't worry about that just haven't changed it yet. And also haven't changed it to farinhiet either... Tried just changing Debug commands to serout but didn't work. I didn't think it would but someone mentioned it.

    IF SignBit = 1 THEN
    DEBUG "-", DEC Whole, ".", DEC2 Fract, CR
    ELSE
    DEBUG DEC Whole, ".", DEC2 Fract, CR
    ENDIF

    I know this is where the code needs to be changed but what 117 commands do I use???????
    Here's the hole code \/ and this is the code to rrun the ph anderson 1 wire controller with a bs2
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    BaudMode CON 84 '9600 True

    X VAR Word
    Y VAR Word
    SignBit VAR Byte
    Whole VAR Byte
    Fract VAR Byte

    DIR7 = 0 ' serial input
    DIR8 = 1 ' serial output
    OUT8 = 0 ' be sure SerOut pin is stable at zero
    PAUSE 1000

    DO
    AGN:
    SEROUT 8, BaudMode, 10, [noparse][[/noparse]"P0", "W0cc", "S044"] 'perform temp meas
    ' note strong pullup
    PAUSE 1100 ' wait for conversion to complete

    SEROUT 8, BaudMode, 10, [noparse][[/noparse]"P0", "W0cc", "W0be"] ' send temperature data

    SEROUT 8, BaudMode, 10, [noparse][[/noparse]"R0"] ' fetch data
    SERIN 7, Baudmode, 1500, TimeOut, [noparse][[/noparse]DEC X.LOWBYTE]
    PAUSE 100
    SEROUT 8, BaudMode, 10, [noparse][[/noparse]"R0"] ' fetch data
    SERIN 7, Baudmode, 1500, TimeOut, [noparse][[/noparse]DEC X.HIGHBYTE]
    PAUSE 100
    ' now do the calculations
    SignBit = X / 256 / 128
    IF SignBit = 1 THEN ' its negative
    X = X ^ $ffff + 1 ' take the two's comp
    ENDIF
    ' multiply by 6.25 - This is 100 * Tc
    Y = X / 4 ' 0.25
    X = X * 6 + Y
    Whole = X / 100
    Fract = X // 100
    IF SignBit = 1 THEN
    DEBUG "-", DEC Whole, ".", DEC2 Fract, CR
    ELSE
    DEBUG DEC Whole, ".", DEC2 Fract, CR
    ENDIF

    PAUSE 1000 ' wait 1 secs

    LOOP

    TimeOut:
    DEBUG "Timeout Error", CR
    GOTO AGN


    AND IT WORKS GREAT ON THE COMPUTER!!!!!
  • Radridz3Radridz3 Posts: 49
    edited 2009-04-28 06:08
    Here'st the code I have done kinda...Temps on all three are accurate just can't seem to understand how to display on this backpack ////////
  • Radridz3Radridz3 Posts: 49
    edited 2009-04-28 06:14
    I think this is where I need to start understanding, this is from the lcd117 to bs2 demo code above.>

    For N = 0 to 25
    SerOut 0, Baudmode, [noparse][[/noparse]"?x00?y1"] ' locate cursor to beginning of line 1
    SerOut 0, Baudmode, [noparse][[/noparse]Dec N, "?t", Hex N, "?t"] ' display N in Dec and Hex
    SerOut 0, Baudmode, [noparse][[/noparse]Dec ByteVar, "?n"]
    SerOut 0, Baudmode, [noparse][[/noparse]Dec WordVar, "?n"] ' display a word
    ByteVar = ByteVar + 1
    WordVar = WordVar + 1
    For I = 1 to 4
  • Radridz3Radridz3 Posts: 49
    edited 2009-05-02 02:12
    OK this is my last straw, I have no problem display anything I want on my LCD's except (realtime data) ...I can write whatever , display custom characters , scroll lines an so on. All my hardware is up and running I can view my 3 temp sensors on the debug term. But cant for the life of me figure out how write the code to get it on my LCD...I'm new to BS2 code and dont have barely any programming skills. I just need a little EDU here to get me kickstarted........The commands for the lcd117 backpack are different they dont use [noparse][[/noparse]22] its completly different than the parallax serial lcd commands....Only thing I found that kinda helped is the big number 117 demo uses a stub routine to pull up random temps but thats not reltime data. So my question to you guys or the people that r good at code to throw me a bone here.... Can someone write some kind of explanitory example code.....With Some realtime data from a clock or sensor of some sort (with) 117 commands [noparse][[/noparse]"?>3"] [noparse][[/noparse]"?BFF"] ......The command list for the 117 & my temp sensor code is linked above in another post.... THIS is the only thing keeping this from going in dash and the only thing thats left to be done. I have very good patience but this 1's really testing me..
  • Larry~Larry~ Posts: 242
    edited 2009-05-02 17:33
    put something like this right after your second debug statement

    make sure the pin numbers and baudmodes are for the lcd.



    SerOut 0, Baudmode, [noparse][[/noparse]"?f,?a"]···· OR···· SerOut 0, Baudmode, [noparse][[/noparse]"?f", "?a"]

    SerOut 0, Baudmode, [noparse][[/noparse]Dec Whole, ]

    Post Edited (L_Gaminde) : 5/2/2009 5:44:49 PM GMT
  • Radridz3Radridz3 Posts: 49
    edited 2009-05-03 07:18
    Thank you so much Gaminde it works perfect..I attached the code so you could take a look. I think now the only thing I'm going to try to do is figure out how to keep the sensor name on the screen without going threw them everytime the program runs. And get it to where only the data changes on the screen. Help here would be great if you understand what I mean by that..This is how it looks now..........................................................
    > ENGINE TEMP 114.8
    > AIR TEMP 79.2
    > WATER TEMP 76.6
    When the program runs it will post 1 at a time on its correct row and then gets to clear screen and home cursor and starts over. My question now is how to make the Sensor names stay on all the time and just the temps update. Do I need to like store them in data and pull it up before every reading or like store it as a custom scrren to the lcd eeprom or something like that. I am a big rookie when it comes to something like this. I thouhgt I could only store 7 custom characters to the lcd eeprom so don't think thats right. Or should I just write what I want like [noparse][[/noparse]" Water Temp"] and then make it to where it will skip spaces before it posts the temp. Like this > [noparse][[/noparse]"?x09",

    SEROUT 0, 84, [noparse][[/noparse]" WATER TEMP "]
    SEROUT 0, Baudmode, [noparse][[/noparse]"?x09", REP "-"\x.BIT15, DEC ABS x/5, ".", DEC1 ABS x]
    PAUSE 400
  • Radridz3Radridz3 Posts: 49
    edited 2009-05-03 07:26
    SEROUT 0, 84, [noparse][[/noparse]" WATER TEMP "]
    SEROUT 0, Baudmode, [noparse][[/noparse]"?x09", REP "-"\x.BIT15, DEC ABS x/5, ".", DEC1 ABS x]
    PAUSE 400


    Scratch this 1 that didn't work..
  • Larry~Larry~ Posts: 242
    edited 2009-05-03 15:43
    The only gotcha here is if you have three digits on one reading and two digits on another (like Air Temp 100 and the next reading is 99 it could say 199) so always have leading spaces or leading zero's like 099.9. below is row and column position commands which should get you started.

    ?x## Position cursor on x column, (two characters are required), first column is column 0

    ?y# Position cursor at y row, first row is row 0, one digit only (no leading zero)
  • Larry~Larry~ Posts: 242
    edited 2009-05-03 16:02
    So you have something working or not, just the water temp didn't work, or they all don't work, or you have something its just not what you expect or, or, or???
    Radridz3 said...
    SEROUT 0, 84, [noparse][[/noparse]" WATER TEMP "]
    SEROUT 0, Baudmode, [noparse][[/noparse]"?x09", REP "-"\x.BIT15, DEC ABS x/5, ".", DEC1 ABS x]
    PAUSE 400


    Scratch this 1 that didn't work..
  • Radridz3Radridz3 Posts: 49
    edited 2009-05-04 04:30
    Yeah I know about those commands and was playing with them last night.....The hole thing works perfect and the space thing wont be an issue, as it is right now Air Temp And Water Temp are left 1 space. Which is OK Because once the boats running and its over 100 it lines them all up accordingly. But I see know with the previous post what kind of problem Im going to run into. I have decided to leave it alone and it has been installed in dash. Im just waiting on a 24lc16 eeprom to show up. For my DIY BS-2 Board.. Its built from WeetHet Websites PCB Design works good.....I did change the trace a little bit to get a SPST reset switch on the board. Thanks again for your help on the display
  • HotpuppyHotpuppy Posts: 10
    edited 2009-05-07 03:24
    You could check to see if the temp is over 99.... something like

    if temp>99 then displaytemp=" "+temp
    else displaytemp=temp

    serout blah,blah, "water: ",temp

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Callsign: NQ5I
    Interests: Robotics, Embedded Systems, Computers, Machining
  • planktonplankton Posts: 18
    edited 2009-06-14 20:05
    It worked for me as the single line does't flash any longer. Thanks.

    lcd117.jpg

    Here's your demo slighly modified.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    BaudMode CON 84 '9600 True

    X VAR Word

    DIR7 = 0 ' serial input
    DIR8 = 1 ' serial output
    OUT8 = 0 ' be sure SerOut pin is stable at zero
    PAUSE 1000 ' allow to stabilize

    SEROUT 0, BaudMode, [noparse][[/noparse]"?G420"] ' Sets geometry of LCD as 4X20
    PAUSE 200 ' pause to allow LCD EEPROM to program

    'SEROUT 0, 84, [noparse][[/noparse]"?BFF"] '100% backlight
    SEROUT 0, 84, [noparse][[/noparse]"?B0F"] '15% backlight
    'SEROUT 0, 84, [noparse][[/noparse]"?B7E"] '50% baclight
    PAUSE 200 ' pause to allow LCD EEPROM to program

    SEROUT 0, Baudmode, [noparse][[/noparse]"?f"] ' clear the LCD

    DO
    BOAT:

    SEROUT 8, BaudMode, 10, [noparse][[/noparse]"P0", "W0cc", "S044"] 'perform temp meas
    PAUSE 1100 ' wait for conversion to complete

    SEROUT 8, BaudMode, 10, [noparse][[/noparse]"P0", "W0cc", "W0be"] ' send temperature data

    SEROUT 8, BaudMode, 10, [noparse][[/noparse]"R0"] ' fetch data

    SERIN 7, Baudmode, 1500, TimeOut, [noparse][[/noparse]DEC X.LOWBYTE]
    PAUSE 100

    SEROUT 8, BaudMode, 10, [noparse][[/noparse]"R0"] ' fetch data

    SERIN 7, Baudmode, 1500, TimeOut, [noparse][[/noparse]DEC X.HIGHBYTE]
    PAUSE 100

    x = x + 160 * 9 / 5 ' covert to F

    SEROUT 0, BaudMode, [noparse][[/noparse]"?y1?x00"] ' cursor at line 1, col 0
    PAUSE 500

    SEROUT 0, 84, [noparse][[/noparse]" Engine Temp "]
    SEROUT 0, Baudmode, [noparse][[/noparse]"?x14", REP "-"\x.BIT15, DEC ABS x/5, ".", DEC1 ABS x]
    PAUSE 400

    LOOP

    TimeOut:
    DEBUG "Fail", CR
    GOTO BOAT:

    Post Edited (plankton) : 6/14/2009 8:20:27 PM GMT
Sign In or Register to comment.