Gallery, Projects and General > Neat Stuff |
DRO..... PC based |
<< < (5/8) > >> |
BillTodd:
Thanks for the reply Yuriy :-) That's clear, and exactly how i hoped it would work :-) My pic code simply reads and formats the data from the scale, waits for an open time slot on the serial bus (arbitrated by a separate bus) then squirts a formatted string onto the commoned txd line. I think i averaged eight samples to stop jitter. The older scales had two sampling speeds 300mS and 50mS (i think) The pic jiggles the scale data and clk lines to switch the scale speed. The newer scales appear to read at a fixed speed of about 100mS which is a little slow. Bill P.S. sourcecode for the pic and a diagram of the multi pic board is on the cnc zone thread. |
BillTodd:
I wonder if yuriy's dro.will.run on the ubislate 7ci (ice cream sandwich. No bluetooth) as this will soon be the cheapest tablet available - expected to.retail.at about £30! www.ubislate.co.uk/product.php?prodid=1 The display is only 800 by 480 but would still be useable.i think :) Bill |
Dawai:
IF you are going to use a old pc?? what do you need all that other stuff for?? this vb6 program I wrote in 2005 can read with a quadrature encoder (glass scales) or a serial digital caliper.. IF you want to go "blue tooth" and readout on a android bases tablet? I suggest purchasing the $60?? arduino mega 2560 I bought today, has a RN42 bluetooth module socket, and there is communication software on the net, and encoder reading software, and serial software.. and.. At one time, this vb6 software also ran power feed to "point" selected.. no clue which version this is thou. My software is in disarray.. too many pc crashes. (HOW it works, you can find the communication subroutine with the chinese scales and perhaps adapt it's logic to your arduino) THE forum didn't want me to post the whole program for you.. if you want it, code or compiled and running under windows? lemme know.. ' Private Sub Read_X_scale() Dim a$ MSComm1.PortOpen = True ' open the port using MSCOMM a$ = MSComm1.Input If a$ <> "" Then X_pos = Val(a$) / 25.4 'ProgressBar1.Value = Val(a$) End If MSComm1.PortOpen = False ' close the port using MSCOMM End Sub Private Sub Read_Y_scale() Dim a$ MSComm2.PortOpen = True ' open the port using MSCOMM a$ = MSComm2.Input If a$ <> "" Then X_pos = Val(a$) / 25.4 'ProgressBar1.Value = Val(a$) End If MSComm1.PortOpen = False ' close the port using MSCOMM End Sub Private Sub end_but_Click() 'end button pin_output = Out8255(port_address, 0) 'blip A off Run_Flag = False End End Sub Private Sub delay_mS_time(timetodelay) Dim time_out As Single Dim delayinMilliseconds delayinMilliseconds = HScroll1.Value ' ding time_out = delayinMilliseconds + timeGetTime() Do Until time_out <= timeGetTime() 'Text8.Text = delayinMilliseconds Loop End Sub Private Sub run_main() 'this sub reads/writes the io bits Run_Flag = True Dim j As Integer x_pos_txt.Text = X_pos 'write it to the block on the screen before exit sub leaves Y_pos_txt.Text = Y_pos If x_target.Text = "" Then x_target.Text = "0" If x_target.Text >= X_pos Then X_frame.BackColor = swon End If If x_target.Text < X_pos And foot_pedal.Value = False Then pin_output = Out8255(port_address, 0) 'blip A on/off Else pin_output = Out8255(port_address, 1) 'blip A on/off End If If x_target.Text < X_pos Then X_frame.BackColor = swoff x_pos_txt.Text = X_pos 'write it to the block on the screen before exit sub leaves End If If x_target.Text = "" Then x_target.Text = "0" If y_target.Text = "" Then y_target.Text = "0" If y_target.Text >= Y_pos Then Y_frame.BackColor = swon End If If y_target.Text < Y_pos And foot_pedal.Value = False Then pin_output = Out8255(port_address, 0) 'blip A on/off Else pin_output = Out8255(port_address, 2) 'blip A on/off End If If y_target.Text < Y_pos Then Y_frame.BackColor = swoff End If delay_mS_time (2) 'PortValues(0) = In8255(Port_Address) PortValues(1) = In8255(port_address + 1) 'PortValues(2) = In8255(Port_Address + 2) Return_word.Text = PortValues(0) & " " & PortValues(1) & " " & PortValues(2) ' Msg = "" ' For j = 7 To 0 Step -1 ' If (PortValues(0) And (2 ^ j)) > 0 Then ' Msg = Msg & "1" ' Else ' Msg = Msg & "0" ' End If ' Next ' Word_A.Text = Msg Msg = "" For j = 7 To 0 Step -1 If (PortValues(1) And (2 ^ j)) > 0 Then Msg = Msg & "1" Else Msg = Msg & "0" End If Next Word_B.Text = Msg ' Msg = "" ' For j = 7 To 0 Step -1 ' If (PortValues(2) And (2 ^ j)) > 0 Then ' Msg = Msg & "1" ' Else ' Msg = Msg & "0" ' End If ' Next ' Word_C.Text = Msg foot_pedal.Value = PortValues(1) And (2 ^ 5) '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '00,01,11,10 to right=cw, left = ccw '****************** Conditional statements, get the bits of encoder************ X_Anew = Left$(Word_B.Text, 2) 'pick two left hand bits MSB? 'if serial box checked then 'do not use this sub. 'If Serial_X.Value = 0 Then If X_Anew = X_Aold Then Exit Sub If X_Anew = "00" And X_Aold = "10" Then 'CW X_pos = X_pos + X_incr X_Aold = X_Anew GoTo endofx End If If X_Anew = "01" And X_Aold = "00" Then X_pos = X_pos + X_incr X_Aold = X_Anew GoTo endofx End If If X_Anew = "11" And X_Aold = "01" Then X_pos = X_pos + X_incr X_Aold = X_Anew GoTo endofx End If If X_Anew = "10" And X_Aold = "11" Then X_pos = X_pos + X_incr X_Aold = X_Anew GoTo endofx End If If X_Anew = "00" And X_Aold = "01" Then 'ccw X_pos = X_pos - X_incr X_Aold = X_Anew GoTo endofx End If If X_Anew = "01" And X_Aold = "11" Then X_pos = X_pos - X_incr X_Aold = X_Anew GoTo endofx End If If X_Anew = "11" And X_Aold = "10" Then X_pos = X_pos - X_incr X_Aold = X_Anew GoTo endofx End If If X_Anew = "10" And X_Aold = "00" Then X_pos = X_pos - X_incr X_Aold = X_Anew GoTo endofx End If ' Else Read_X_scale 'send to subroutine to read the chinese scale x_pos_txt.Text = X_pos 'set the returned value to reflect scale value ' End If endofx: |
Dawai:
https://littlemachineshop.com/Products/product_new.php This is the place that had the plugs to snap onto the chinese-calipers to get the serial data off them.. it was a continuous pulse train by the way, with a fixed data set. TO get it to where you can read it on the parallel port input pins, or into a ttl-rs232 adapter?? such as the max232 chip.. you bond the pc 5 volts to the scales 1.5-3 volts positive, the lower pulse can read that way, if you bond the common's (negative) the rising pulse, dependent upon battery voltage will never be seen by the pc.. or arduino.. It does not rise to the level seen by ttl logic gates. |
ycroosh:
--- Quote from: BillTodd on December 16, 2013, 03:41:06 PM ---I wonder if yuriy's dro.will.run on the ubislate 7ci (ice cream sandwich. No bluetooth) as this will soon be the cheapest tablet available - expected to.retail.at about £30! www.ubislate.co.uk/product.php?prodid=1 The display is only 800 by 480 but would still be useable.i think :) Bill --- End quote --- It will (using Arduino controller or Launchpad with FTDI breakout board). The app scales down to 480x320 screens. Second section on this page : http://www.yuriystoys.com/2013/08/android-dro-application-settings.html explains what settings to change for USB connectivity. Hope this helps Yuriy |
Navigation |
Message Index |
Next page |
Previous page |