Tilt Sensor Reading


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Location
    Las Vegas, NV USA
    Posts
    5

    Default Here is what I have so far....

    Let me caveat this by saying I am a schlub and forgot to look and find out what version
    of PBP I am running currently. I just received the upgrade disk for 2.60 yesterday, and will take it to work next week.

    Here is a snippet of one of the variations of the code I have tried:


    Code:
    sd_tran VAR portC.6
    sd_receive VAR portC.7
    
    hexout VAR BYTE[4]
    one VAR hexout[0]
    two VAR hexout[1]
    three VAR hexout[2]
    four VAR hexout[3]
    
    mainloop:
    serout2 sd_tran, 32, ["C", 13, 10]
    pause 200
    serin2 sd_receive, 32, [hexout]
    pause 200
    LCDOUT $fe, 1, HEX one, HEX two, HEX three, HEX four
    PAUSE 500
    GOTO mainloop
    END
    What I get displayed on the LCD looks something like this 5F 00 00 00

    What I am trying to do is display the actual hex string of characters that I get back from
    the sensor. When connected to the computer via a terminal window, I usually get back something like "7AF", the last character is an ASCII "10" which get's dropped in the terminal window because it is a line feed. What I would like to display would be the whole four byte string, like "7AFA". Once I can do that, I know I can do the math to be able to get my angular number. I know it is a matter of telling PBP which bytes to to receive, store, retreive and display, but the correct way to do that is eluding me at the moment. I've tried various combination's of the SERIN2, LCDOUT, and BYTE or WORD variable to no avail. I keep getting very unlikely numbers.
    Any assistance would be greatly appreciated.

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default

    sincity337

    Remove the PAUSE 200 between serout2 and serin2. Pause in that place will delay the receiver and you will loose characters.

    Cheers

    Al.
    All progress began with an idea

  3. #3
    Join Date
    Sep 2010
    Location
    Las Vegas, NV USA
    Posts
    5

    Default Thx

    Thanks, I'll give that a shot, I appreciate it.

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