Shop OBEX P1 Docs P2 Docs Learn Events
Project Help — Parallax Forums

Project Help

xhacksxhacks Posts: 8
edited 2009-12-12 02:16 in BASIC Stamp
Hi there,

i need help in my project.
i have a homeworkboard with the bs2 and i need to find a way to get the input data to the computer (not by display but by txt or direct into another program)

·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-09 13:10
    Look at StampPlot Pro and PLX-DAQ: www.parallax.com/tabid/441/Default.aspx

    These all use the SEROUT / SERIN statements to send / receive data from a PC.
  • xhacksxhacks Posts: 8
    edited 2009-10-10 05:50
    the data that i want to send and recieve is rpm and mph for my custom bike speedometer
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-10 13:03
    The way these forums work is that you describe what you have already whether it's hardware (by providing a description and a schematic) or software (by providing a description and a source file). Any files that you have you provide as an attachment to a message (by using "Post Reply" and the Attachment Manager) and NOT via cut and paste. You also provide specific questions rather than just general statements, something on the order of "I tried this and this happened and I wanted that" or "I tried this, but I don't understand how to make that happen". Someone here will make suggestions, perhaps suggest code or hardware changes, perhaps suggest something to read or look at, and you think about that and apply that if you choose. Then you report back with new observations and questions.

    If you don't have anything yet other than an idea, you say so. You describe your idea as best you can, in as much detail as you can. Someone will make suggestions and/or ask questions. You take their suggestions and follow them if you choose, think about them at the very least. You answer any questions as well as you can, and report back with new thoughts and your own questions.

    Post Edited (Mike Green) : 10/10/2009 1:11:14 PM GMT
  • xhacksxhacks Posts: 8
    edited 2009-10-10 16:16
    ok well first i have my bikes wheel magnet and sensor, the sensor is a reed switch so i send down vdd signal and with the other end going to pin 1 and a 10k resistor to vss. that gets my rps (rotations per second) * that by 60 to get rpm, which then i need to send to my laptop to do the math (that is because the bs2 wont allow 81.64 as a circumference and so i need the computer to deal with that). i have a lcd hooked up and would like to have that disp the mph and distance traveled (yet another thing i want computer to do because i want it to be stored and send data to disp) plus i want to have the lcd disp current time from pc


    NOTE i am farly good at pc progamming but need help on the bs2 end
  • xhacksxhacks Posts: 8
    edited 2009-10-10 17:55
    o im sorry i forgot in order to get rps i use count function
  • rixterrixter Posts: 95
    edited 2009-10-11 02:59
    What you could do is come up with a "multiplier" value in a formula that results in the end value you desire for wheel circumference. I also used odometer "wheel" variables to track 100ths, tenths and full miles. Basically you are incrementing the next ODO wheel when you trip past 9. The biggest challenge you will likely face is "missing" a sensing of a wheel revolution if you do too much processing in between checking for a sensing. If you are familiar with bike odometers, they are all slightly off from one another. Probably so with automobiles as well. You could build this into the multiplier as I did so it matches another reliable odometer that has traveled the same distance or revolved the same number of times, etc. I also only write to the LCD when at least a 100th is achieved. Here is a code segment from a program I wrote.

    cnt1 VAR Word
    miles VAR Word
    ten VAR Nib 'tenths
    hun VAR Nib 'hundreths
    flg VAR Bit '10th change flag
    miles=0
    ten=0
    hun=0

    SEROUT 14, 84, [noparse][[/noparse]22] ' start LCD 19200 baud
    SEROUT 14, 84, [noparse][[/noparse]12] ' clear display
    SEROUT 14, 84, [noparse][[/noparse]148,DEC3 miles,".",DEC ten,DEC hun]

    STRT:

    DO WHILE IN12=0 ' this handles the case of the wheel not rotating at all
    LOOP

    DO WHILE IN12=1 ' this handles the case if the wheel miraculously stops right on your sensor. In other words, we want a wheel revoltion count to be determined when the sensor passes, which is a change in state.
    LOOP

    cnt1=cnt1+2627 ' 10/1000ths multiplier (vary value for ODO wheel diameter)
    IF cnt1/10000>1 THEN
    hun=hun+1
    cnt1=cnt1//10000
    flg=1 ' set flag that determines if LCD is updated. i.e. no sense sending to LCD if nothing is different
    ENDIF
    IF hun>9 THEN
    ten=ten+1
    hun=0
    ENDIF
    IF ten>9 THEN
    miles=miles+1
    ten=0
    ENDIF
    IF flg THEN
    SEROUT 14, 84, [noparse][[/noparse]148,DEC3 miles,".",DEC ten,DEC hun]
    flg=0 ' reset flag after displaying
    ENDIF
    IF tflg THEN
    GOSUB rdtemp
    tflg=0 ' reset flag after displaying
    ENDIF

    GOTO STRT
  • xhacksxhacks Posts: 8
    edited 2009-12-11 22:47
    where is the subroutine rdtemp and the variable tflg?
  • rixterrixter Posts: 95
    edited 2009-12-12 00:16
    Wups... that's a typo. Or should I say a cut and paste error?

    These lines should not be there at the end.

    IF tflg THEN
    GOSUB rdtemp
    tflg=0 ' reset flag after displaying
    ENDIF


    I also incorporated a temperature display on my ODO. Thanks for pointing that out.

    Rick
  • xhacksxhacks Posts: 8
    edited 2009-12-12 02:16
    ok thx ill try that
Sign In or Register to comment.