Shop OBEX P1 Docs P2 Docs Learn Events
how can i use stamp plot lite without serial cable? — Parallax Forums

how can i use stamp plot lite without serial cable?

AizamiAizami Posts: 5
edited 2009-04-08 12:09 in BASIC Stamp
hello..

i need help on how to plot a graph with stamp plot with using serial cable. i use below program to get a temperature using ds1620.
i already set the threshold and can plot the graph using stamp plot.(program below is successful).
now, i want to plot the graph with using cable, i want to use a bluetooth as connection.in my project i need to tuse bluetooth to see the capanbilities.
i'm using eb500 bluetoth adapter for the transmission.
i hope anyone can help me with this problem..
thank you so much..


' {$STAMP BS2pe}
' {$PBASIC 2.5}


'
[noparse][[/noparse] Program Description ]
'
' This program measures temperature using the Dallas Semiconductor DS1620
' temperature sensor. Resolution is 0.5 degrees Celsius.
'
[noparse][[/noparse] I/O Definitions ]

DQ CON 3 ' DS1620.1 (data I/O)
Clock CON 2 ' DS1620.2
Reset CON 1 ' DS1620.3
'
[noparse][[/noparse] Constants ]
RdTmp CON $AA ' read temperature
WrHi CON $01 ' write TH (high temp)
WrLo CON $02 ' write TL (low temp)
RdHi CON $A1 ' read TH
RdLo CON $A2 ' read TL
RdCntr CON $A0 ' read counter
RdSlope CON $A9 ' read slope
StartC CON $EE ' start conversion
StopC CON $22 ' stop conversion
WrCfg CON $0C ' write config register
RdCfg CON $AC ' read config register
DegSym CON 186 ' degrees symbol
'
[noparse][[/noparse] Variables ]
tempIn VAR Word ' raw temperature
sign VAR tempIn.BIT8 ' 1 = negative temperature
tC VAR Word ' Celsius

'
[noparse][[/noparse] Initialization ]

Setup:
HIGH Reset ' alert the DS1620
SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]WrCfg, %10] ' use with CPU; free-run
LOW Reset
PAUSE 10

'
[noparse][[/noparse]Setting T_Hi]

HIGH Reset ' Tells the DS1620 that a command is coming.
SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]WrHi,$34\9] ' Command to set DS1620 TH to 32.
LOW Reset ' Completes the command cycle.
PAUSE 10

'
[noparse][[/noparse]Setting T_Lo]

HIGH Reset ' Tells the DS1620 that a command is coming.
SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]WrLo,$32\9] ' Command to set DS1620 TH to 31.
LOW Reset ' Completes the command cycle.
PAUSE 10

'

HIGH Reset
SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]StartC] ' start conversions
LOW Reset

Init_Graph:
DEBUG "!RSET", CR ' clear graph
DEBUG "!SPAN 25,35", CR ' disply 70 - 80 degrees
DEBUG "!AMUL 0.1", CR ' convert from tenths
DEBUG "!CLMM" ' clear min/max values
DEBUG "!TMAX 3600", CR ' 1 hour scale
DEBUG "!PNTS 60", CR ' graph every second
DEBUG "!MAXS", CR ' stop when graph full
DEBUG "!TSMP ON", CR ' enable time stamping
DEBUG "!TITL Temperature", CR ' set window title
DEBUG "!USRS Temperature in Celcius", CR ' graph legend
DEBUG "!CLRM", CR ' clear messages
DEBUG "Reset and monitoring temperature", CR' message box
DEBUG "!PLOT ON", CR ' enable plotting


'
[noparse][[/noparse] Program Code ]
Main:
'DO
GOSUB Read_DS1620 ' get the temperature

tempIn.BYTE1 = -sign ' extend sign bit
tC = tempIn * 5 ' convert to tenths

DEBUG DEC tC, CR ' send to Stamp Plot Lite

PAUSE 990 ' wait about 1 second
GOTO Main ' do it again


'
[noparse][[/noparse] Subroutines ]
Read_DS1620:
HIGH Reset ' alert the DS1620
SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]RdTmp] ' give command to read temp
SHIFTIN DQ, Clock, LSBPRE, [noparse][[/noparse]tempIn\9] ' read it in
LOW Reset ' release the DS1620

RETURN

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-02 13:47
    Replace all your DEBUG statements with SEROUT statements. The EB500 expects the SEROUT statements to be for pin #1. If you have

    DEBUG XXXX

    you will need to change that to

    SEROUT 1,84,[noparse][[/noparse]XXXX]

    You'll also need a 1000ms pause at the beginning of your program to allow the EB500 to initialize and you'll need a few statements to put the EB500 into data mode once the PC responds to the request for a Bluetooth connection. Follow the examples in the EB500 documentation.

    You'll need to change the I/O pins you're using for the DS1620. The EB500 uses pins 0, 1 and 5, 6.
  • AizamiAizami Posts: 5
    edited 2009-04-04 13:41
    hello..

    i've change the pin, the DEBUG to SEROUT and add data mode command. (as below)
    but still cant get the graph plotted on the stamp plot.
    is it wrong with the code or something?
    i really need help with this..
    TQ



    'connect to remote device
    SEROUT 1,84,[noparse][[/noparse]"con 00:0c:84:00:77:3D",CR]
    SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]

    'wait for the connection to be established and switch to data mode
    waitForConnection:
    IF IN5 = 0 THEN waitForConnection
    HIGH 6
    PAUSE 300

    SEROUT 1,84, [noparse][[/noparse]"!RSET", CR] ' clear graph
    SEROUT 1,84, [noparse][[/noparse]"!SPAN 25,35", CR] ' disply 70 - 80 degrees
    SEROUT 1,84, [noparse][[/noparse]"!AMUL 0.1", CR] ' convert from tenths
    SEROUT 1,84, [noparse][[/noparse]"!CLMM"] ' clear min/max values
    SEROUT 1,84, [noparse][[/noparse]"!TMAX 3600", CR] ' 1 hour scale
    SEROUT 1,84, [noparse][[/noparse]"!PNTS 60", CR] ' graph every second
    SEROUT 1,84, [noparse][[/noparse]"!MAXS", CR] ' stop when graph full
    SEROUT 1,84, [noparse][[/noparse]"!TSMP ON", CR] ' enable time stamping
    SEROUT 1,84, [noparse][[/noparse]"!TITL Temperature Monitoring", CR] ' set window title
    SEROUT 1,84, [noparse][[/noparse]"!USRS Temperature in Celsius", CR] ' graph legend
    SEROUT 1,84, [noparse][[/noparse]"!CLRM", CR] ' clear messages
    SEROUT 1,84, [noparse][[/noparse]"Reset and monitoring temperature", CR]' message box
    SEROUT 1,84, [noparse][[/noparse]"!PLOT ON", CR] ' enable plotting


    SEROUT 1,84, [noparse][[/noparse]DEC tC, CR]
  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-04 14:09
    What happens? Does a connection get established? Does StampPlot do anything? What happens on the PC end of things?
  • AizamiAizami Posts: 5
    edited 2009-04-05 06:44
    hi again,

    This is my new program after the modification, but as before, stampplot unable to come out with the graph.

    Note: I used DS1620 and pin connection as following:
    DQ to PIN3
    CLK to PIN2
    RST to PIN1 - do I need to change any pin connected to DS1620? Pls advise... Thx


    Program:

    ' {$STAMP BS2pe}
    ' {$PBASIC 2.5}


    'Wait for the eb500 radio to be ready
    '
    PAUSE 1000 ' delay between readings,1000ms pause to allow the EB500 to initialize


    'connect to remote device
    SEROUT 1,84,[noparse][[/noparse]"con 00:0c:84:00:77:3D",CR]
    SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]

    'wait for the connection to be established and switch to data mode
    waitForConnection:
    IF IN5 = 0 THEN waitForConnection
    HIGH 6
    PAUSE 300

    '
    [noparse][[/noparse] Program Description ]
    '
    ' This program measures temperature using the Dallas Semiconductor DS1620
    ' temperature sensor. Resolution is 0.5 degrees Celsius.
    '
    [noparse][[/noparse] I/O Definitions ]

    DQ CON 3 ' DS1620.1 (data I/O)
    Clock CON 2 ' DS1620.2
    Reset CON 1 ' DS1620.3
    '
    [noparse][[/noparse] Constants ]
    RdTmp CON $AA ' read temperature
    WrHi CON $01 ' write TH (high temp)
    WrLo CON $02 ' write TL (low temp)
    RdHi CON $A1 ' read TH
    RdLo CON $A2 ' read TL
    RdCntr CON $A0 ' read counter
    RdSlope CON $A9 ' read slope
    StartC CON $EE ' start conversion
    StopC CON $22 ' stop conversion
    WrCfg CON $0C ' write config register
    RdCfg CON $AC ' read config register
    DegSym CON 186 ' degrees symbol
    '
    [noparse][[/noparse] Variables ]
    tempIn VAR Word ' raw temperature
    sign VAR tempIn.BIT8 ' 1 = negative temperature
    tC VAR Word ' Celsius

    '
    [noparse][[/noparse] Initialization ]

    Setup:
    HIGH Reset ' alert the DS1620
    SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]WrCfg, %10] ' use with CPU; free-run
    LOW Reset
    PAUSE 10

    '
    [noparse][[/noparse]Setting T_Hi]

    HIGH Reset ' Tells the DS1620 that a command is coming.
    SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]WrHi,$40\9] ' Command to set DS1620 TH to 32.
    LOW Reset ' Completes the command cycle.
    PAUSE 10

    '
    [noparse][[/noparse]Setting T_Lo]

    HIGH Reset ' Tells the DS1620 that a command is coming.
    SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]WrLo,$3E\9] ' Command to set DS1620 TH to 31.
    LOW Reset ' Completes the command cycle.
    PAUSE 10

    '

    HIGH Reset
    SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]StartC] ' start conversions
    LOW Reset

    Init_Graph:


    SEROUT 1,84, [noparse][[/noparse]"!RSET", CR] ' clear graph
    SEROUT 1,84, [noparse][[/noparse]"!SPAN 25,35", CR] ' disply 70 - 80 degrees
    SEROUT 1,84, [noparse][[/noparse]"!AMUL 0.1", CR] ' convert from tenths
    SEROUT 1,84, [noparse][[/noparse]"!CLMM"] ' clear min/max values
    SEROUT 1,84, [noparse][[/noparse]"!TMAX 3600", CR] ' 1 hour scale
    SEROUT 1,84, [noparse][[/noparse]"!PNTS 60", CR] ' graph every second
    SEROUT 1,84, [noparse][[/noparse]"!MAXS", CR] ' stop when graph full
    SEROUT 1,84, [noparse][[/noparse]"!TSMP ON", CR] ' enable time stamping
    SEROUT 1,84, [noparse][[/noparse]"!TITL Temperature Monitoring", CR] ' set window title
    SEROUT 1,84, [noparse][[/noparse]"!USRS Temperature in Celsius", CR] ' graph legend
    SEROUT 1,84, [noparse][[/noparse]"!CLRM", CR] ' clear messages
    SEROUT 1,84, [noparse][[/noparse]"Reset and monitoring temperature", CR]' message box
    SEROUT 1,84, [noparse][[/noparse]"!PLOT ON", CR] ' enable plotting




    '
    [noparse][[/noparse] Program Code ]
    Main:
    'DO
    GOSUB Read_DS1620 ' get the temperature

    tempIn.BYTE1 = -sign ' extend sign bit
    tC = tempIn * 5 ' convert to tenths

    SEROUT 1,84, [noparse][[/noparse]DEC tC, CR]
    'DEBUG DEC tC, CR ' send to Stamp Plot Lite

    PAUSE 990 ' wait about 1 second
    GOTO Main ' do it again


    '
    [noparse][[/noparse] Subroutines ]
    Read_DS1620:
    HIGH Reset ' alert the DS1620
    SHIFTOUT DQ, Clock, LSBFIRST, [noparse][[/noparse]RdTmp] ' give command to read temp
    SHIFTIN DQ, Clock, LSBPRE, [noparse][[/noparse]tempIn\9] ' read it in
    LOW Reset ' release the DS1620

    RETURN
  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-05 14:37
    You mention that if you include the "connect to remote device" code, it doesn't work at all. That can happen if you initiate the connection from your PC. You don't give any information about what you're actually doing, so the only thing I can suggest is to follow the instructions in the EB500 documentation. Either technique should work (initiate connection from the EB500 or from the PC).

    I think you should first make sure your EB500 is connecting properly with your PC. Use the examples in the EB500 documentation to verify this. Once the EB500 is connecting properly, Stamp Plot Lite should work with the Bluetooth connection just like it works with a wired connection. I can't be of more help.
  • AizamiAizami Posts: 5
    edited 2009-04-05 15:45
    The thing is, I want to get a temperature and send the temperature data to be plotted in the stamp plot.
    my eb500 is connect properly since i can read the temperature through hyper terminal using bluetooth.
    but when i open the stampplot to get the graph, it wont display.
    when i open the stamp plot, i disconnect the hyper terminal since it cant share same ports.
    i cant figure out whats wrong since the connection through bluetooth to hyper terminal is successful..
    maybe you have an idea?

    TQ..
  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-05 16:05
    If you don't have the most current version of Stamp Plot, you should download it and install it. It's now free for educational and home use. See www.selmaware.com for details. You want the Stamp Plot Pro version 3 release 8.1.

    I don't know what's wrong with your setup. I don't have a lot of experience with either the EB500 or Stamp Plot Pro, but I know that you can do wireless Stamp Plot using xBee. Bluetooth is not very different. Once you've established a serial connection, it's really the same.
  • AizamiAizami Posts: 5
    edited 2009-04-08 12:09
    hello..

    Thanks a lot for the help..
    If anyone ever try this please let me know.
    Until now i can get the stampplot connect with my pc through eb500,
    just it wont plot the graph since my ds1620 wont give the temperature value.
    I dont know whats wrong because if using cable ds1620 give the temperature reading..
    Any idea or help are welcome..

    TQ
Sign In or Register to comment.