I remember at some point you asking the same thing and finding the answer…
VA VB VC VD
However many of those you send, that’s how many bytes you’ll get back. Each byte should be evaluated numerically as they represent values from 0-255 which will correlate to 0-5V.
So… I tried it, and I think it works (at least, my testing of it has proven true, so far).
Here’s the code that I wrote:
Feel free to borrow it, anyone.
Imports System
Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Manually set the proper timer settings.
Timer1.Enabled = True
' Do the timer sub every second.
Timer1.Interval = 1000
' Manually set the proper serial port settings.
' Stick whatever port number you are connecting to here.
SerialPort1.PortName = "COM4"
' Set the baud rate equal to the baud rate of the SSC-32.
SerialPort1.BaudRate = 115200
SerialPort1.DataBits = 8
SerialPort1.StopBits = Ports.StopBits.One
SerialPort1.Parity = Ports.Parity.None
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim i As Integer
' In PID control, "plant" is the term
' for the object being controlled.
Dim PlantValue(2) As Byte
' Open the serial port.
SerialPort1.Open()
' Go to the subroutine named "RequestByte".
RequestByte()
' Go to the function named "ReadByte" twice.
For i = 1 To 2
' Store the VA and VB value in an array.
PlantValue(i) = ReadByte()
Next i
' Close the serial port.
SerialPort1.Close()
' Remove the below comments to display
' the read data in a text box.
' TextBox1.Text = ""
' For i = 1 To 2
' TextBox1.Text &= PlantValue(i) & " "
' Next i
End Sub
Private Sub RequestByte()
'Send VA VB <cr> to the SSC-32
SerialPort1.Write("VA VB " & vbCrLf)
End Sub
Private Function ReadByte() As Byte
' Store a byte within the varialbe ReadByte,
' and send that variable back to the timer sub.
Return SerialPort1.ReadByte
End Function
End Class
I want to connect an IR sensor (which outputs an analog voltage) to the analog inputs on the SSC-32, inputs ABCD but the manual is not clear on what pins are what
usually when you measure an analog voltage this is with respect to ground, therefore I am assuming that since each of the ABCD inputs has 2 pins, one is connected to ground, and one is conencted to the analog input on the SCC-32 onboard mictocontroller.
Looking at the board ABCD and written horizontally, with two pins vertically above each letter, above these are 2 ‘+’ symbols and 2 ‘-’ symbols, specifically the ‘+’ above A & C, and ‘-’ above B & D.
Can someone identify which pin is the ground pin and which is the input pin for each of ABCD
OK, now I understand, 2 supplies and 2 connections to ground
since I’m running the sensor from the same supply as the SSC-32 and they share the same ground that means I can just connect directly to the ABCD inputs and bingo, thanks