Case A_COMMAND	‘Temperature sensor A reading
CommandInProcess = False   	‘End of current command                
If (CurrentStringSize >= 1) Then ‘Get any characters?
ArrayCount = 1          	‘Start of data
For i = ArrayCount To CurrentStringSize
TemperatureString = TemperatureString & TemperatureSerialData(i)	‘Make the string
Next i
Led1.LED_Colour = vbRed	‘Blink the virtual LED
Timer1.Enabled = True
TemperatureDecNum = Val(TemperatureString) ‘Convert string to decimal
DebugText.Text = “Raw A to D value = “ & TemperatureDecNum  ’Display 	‘raw A/D value as read from LM60 	‘sensor via the LPC2138’s ADC	
TemperatureDecNum = TemperatureDecNum * (3.3 / 1024) ‘Convert 		‘A/D reading, 3.3-V ref/10 bit A/D
TemperatureDecNum = TemperatureDecNum - 0.424 ‘Remove 424-mV offset
TemperatureDecNum = TemperatureDecNum / 0.00625 ‘6.25 mV per 		‘degree C 
Temperature = TemperatureDecNum  ‘Convert the converted value to 	‘an integer
TemperatureText.Text = Temperature & “°c” ‘Output the string
With MSChart1	‘Now lets graph it
 .Data = TemperatureDecNum	‘Plot data to current location 		‘(autoincrement is on)
End With
End If
End Select	‘Command finished

Listing 2—The Visual Basic code takes the serial string from the LPC2138, converts it, and then graphs it to the chart.