PIC PC Voltmeter
A complete voltmeter that uses a Microchip microcontroller to aquire voltage and send it through
one PC serial port.
Design rack in Rack Designer, or you may download example archive which contains the
voltmeter rack (see screenshot on the left side of this article).
Controls' names in this rack are :
Analog meter : ameter1
Numeric display : num1
Power button : pbutton1
and two borders, border1 and border2.
Code your microcontroller to do these easy jobs:
1) wait to receive on its serial input pin string "go"
2) read voltage value from one of its AD chanel
3) send on its serial output pin value read from AD, as a string, example a 123 value to be serout as "123"
4) send on its serial output pin crlf sequence (ascii 13, ascii 10)
5) jump to 1)
Write or open in Easy Control this script code (note: syntax is for Easy Control v1.4):
#open port and rack
#don't forget to supply path where you have rack
#check if power button (pause here) is pressed, and stay here until is depressed
#send query to microcontroller
#wait to receive data, ended with crlf
#cut crlf from the string received
#calculate real value of voltage, assumes that max voltage is 5 volts
#check if is a integer or has decimal point
#and set analog meter and numeric display
#has decimal point, cut string
#has not, leave it as is
#and again, and again, until you stop script
Less than 25 lines of code, and a few clicks in Rack Designer !
That's all !
On a AMD K6-II/300 Mhz and with a 4 Mhz PIC 16C711 it reads more than 10 times per second.
Further improvements: implementing software filtering, detecting in script on which port device is,
timeouts, file logging,autoscalling etc....
Download this project :