Shop OBEX P1 Docs P2 Docs Learn Events
Expert coder needed - Page 6 — Parallax Forums

Expert coder needed

12346»

Comments

  • computer guycomputer guy Posts: 1,113
    edited 2008-02-15 09:51
    Does anyone know how to turn a BCD into a regular number using VB.net?

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-15 10:05
    Do it on the prop, it will probably be easier smile.gif It would be something like
    VAR bcdNum,decNum
    code
      decNum:=((bcdNum>>4)&$F)*10+(bcd&$F)*10
    



    I don't know if you need all the brackets but I couldn't be bothered to check smile.gif
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-15 10:17
    Thank you,

    I will try it in VB first with the same math and see how I go.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-15 10:45
    The VB code didn't work so I went with you idea.
    I ended up using this
    ser.tx(((time.byte >> 4) & $F) * 10 + (time.byte & $F) * 10)
    
    


    in the sendDataSerial function however I still don't get the correct time.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-15 10:49
    Sorry. I shouldn't have had the last *10 (smacks head) smile.gif

    Should be
    ser.tx(((time.byte >> 4) & $F) * 10 + (time.byte & $F))
    
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-15 12:22
    Thanks, That work's great now. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-02-15 16:13
    Check out my robot using the propeller RECONAUTOR

    videos?
    Not Found
    The requested URL /videos.htm was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/1.3.37 Server at robot.tmcp.com.au Port 80


    about?
    Not Found
    The requested URL /videos.htm was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/1.3.37 Server at robot.tmcp.com.au Port 80


    contributors?
    Not Found
    The requested URL /videos.htm was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/1.3.37 Server at robot.tmcp.com.au Port 80


    feedback?
    Not Found
    The requested URL /videos.htm was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/1.3.37 Server at robot.tmcp.com.au Port 80

    there is not much to check out about your robot
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-15 22:02
    Stefen,

    Sorry, I have been busy with several other projects and therefore the website has been delayed.
    I will send you a PM when the website is finished.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-15 23:03
    Here it is the VB.net program.
    Now to convert it to Java. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
    295 x 461 - 41K
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-15 23:09
    Thats nice smile.gif Have you figured out how to do serial on the MatchPort?
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-15 23:37
    Yes.

    The Matchport uses the Java serial object to communicate with the serial port.

    This page describes it in detail.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-15 23:49
    Have fun smile.gif
  • computer guycomputer guy Posts: 1,113
    edited 2008-02-15 23:49
    Thanks.
    I will smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • computer guycomputer guy Posts: 1,113
    edited 2008-03-06 09:00
    I have ordered the board for this project.
    Hope all goes well.
    This is the first time I have gotten a board made up. smile.gif

    Once I have it built I will tell you how it goes.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-03-06 09:09
    I was just about to ask if there was any progress on this. Have you tested anything on a breadboard?
  • computer guycomputer guy Posts: 1,113
    edited 2008-03-06 21:05
    I have tested most of it on a breadboard.
    The only thing I haven't tested is the Matchport as it has 2mm pitch pins.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller RECONAUTOR
    If you like my avatar then check this out Propeller Domed Sticker
  • computer guycomputer guy Posts: 1,113
    edited 2008-11-30 07:05
    Hi Steven,

    I have decided to dig the project out again after giving up on it some time ago.
    I have decided to just use a VB.net application for the moment and communicate with the device via telnet.

    After converting the serial port code to telnet I can use the device as before. The only problem is with adding a schedule.
    When I add a schedule
    day | hour | min | code
      4   |   12  | 45  |    3
    
    



    I get the following back when reading in the schedule.
    day | hour | min | code
     13  |   10  | 52  |   13
    
    



    I know the problem is in the vb.net application with the sending of data but don't know what specifically is wrong.
    I would appreciate your thoughts on the problem.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • Harrison.Harrison. Posts: 484
    edited 2008-11-30 09:18
    Can you post some code where this problem occurs? VB.NET handles strings and characters differently than it handles bytes, which could be a cause of your problem.
  • computer guycomputer guy Posts: 1,113
    edited 2008-11-30 09:31
    Here you go Harrison.
    Hope it helps.

    Edit: I uploaded an old copy from when I was playing with the code.
    Here is the current code I have.

        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            Try
                Dim day As Decimal = 0
                Dim code As Decimal = 0
                Dim hour As Decimal = 0
                Dim min As Decimal = 0
                If selday.Text = "Sunday" Then
                    day = 1
                ElseIf selday.Text = "Monday" Then
                    day = 2
                ElseIf selday.Text = "Tuesday" Then
                    day = 3
                ElseIf selday.Text = "Wednesday" Then
                    day = 4
                ElseIf selday.Text = "Thursday" Then
                    day = 5
                ElseIf selday.Text = "Friday" Then
                    day = 6
                ElseIf selday.Text = "Saturday" Then
                    day = 7
                End If
    
    
                If selcode.Text = "Start1" Then
                    code = 1
                ElseIf selcode.Text = "Stop1" Then
                    code = 2
                ElseIf selcode.Text = "Start2" Then
                    code = 3
                ElseIf selcode.Text = "Stop2" Then
                    code = 4
                ElseIf selcode.Text = "Start3" Then
                    code = 5
                ElseIf selcode.Text = "Stop3" Then
                    code = 6
                ElseIf selcode.Text = "Start4" Then
                    code = 7
                ElseIf selcode.Text = "Stop4" Then
                    code = 8
                ElseIf selcode.Text = "Start5" Then
                    code = 9
                ElseIf selcode.Text = "Stop5" Then
                    code = 10
                ElseIf selcode.Text = "Start6" Then
                    code = 11
                ElseIf selcode.Text = "Stop6" Then
                    code = 12
                ElseIf selcode.Text = "Start7" Then
                    code = 13
                ElseIf selcode.Text = "Stop7" Then
                    code = 14
                ElseIf selcode.Text = "Start8" Then
                    code = 15
                ElseIf selcode.Text = "Stop8" Then
                    code = 16
                End If
    
                hour = selhour.Value
                min = selmin.Value
    
                Dim msg() As Byte = {day, hour, min, code}
    
                objSocket.SendString("n")
                For i = 0 To 3
                    objSocket.Sleep(20)
                    objSocket.SendByte(msg(i))
                    Label7.Text = Label7.Text & " " & msg(i)
                Next
                Label7.Text = Label7.Text & " - "
            Finally
            End Try
        End Sub
    
    



    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE

    Post Edited (computer guy) : 11/30/2008 9:46:22 AM GMT
  • computer guycomputer guy Posts: 1,113
    edited 2008-12-01 05:43
    I am now getting the following
    day | hour | min | code
      4   |   12  | 45  |    3
    
    



    day | hour | min | code
      13   |   10  | 4  |    12
    
    



    which makes me think that the vb.net telnet component is sending a LF and CR before the bytes therefore resulting in the above data.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-12-01 05:55
    I managed to fix it my changing the following on the device side.
    PUB getItemSerial
      insertItem(newItem(ser.rx,ser.rx,ser.rx,ser.rx))
      backupSchedule
    
    



    to

    PUB getItemSerial|t1, t2
      t1 := ser.rx
      t2 := ser.rx 
      insertItem(newItem(ser.rx,ser.rx,ser.rx,ser.rx))
      backupSchedule
    
    



    Its a bit of a kludge so if there is any other suggestions I would be more than happy to hear them.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-12-01 11:29
    I'll try and have a look at it tomorrow. It could be mucking up because I think it may be expecting BCD numbers and not normal text but I'll have to check.

    Actually, forget that. The 13 and 10 are just a carriage return and line feed. So, so long as it happens consistently what you've done is fine.
Sign In or Register to comment.