Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plotting point graphing
#1
Hi

Just looking for some help on graphing some temperature data in "real" time.

I have a program that reads temperature at 1 minute intervals. I would like to plot the points (maybe PSET) as the rest of the program is running.

How do I define where the points will be plotted? I have other things going on in the program like radio buttons that control pumps and solenoids.

I am using Quickbasic for MAC

Thanks in advance
Reply
#2
Here is a program in QuickBASIC 4.5 that plots some temperature points. Hopefully, you wll be able to adapt it to your requirements. Let us know.
Code:
'TEMP, by Ralph A. Esquivel, plots degrees F vs time in seconds

SCREEN 9: Xmax = 640: Ymax = 350

FG = 1 'blue foreground
BG = 7  'white background

COLOR FG, BG
CLS

READ TIME
MULT = 10
FOR I = MULT TO TIME * MULT + MULT STEP MULT
   READ T
   TEMP = Ymax - T
   CIRCLE (I, TEMP), 2
   PAINT (I, TEMP), 1
   SLEEP 1 'wait 1 second to simulate data at rate of 1 per second
NEXT I
PRINT "Press any key to terminate program
SLEEP
END

'Temperature data (first is number of temperature data:
DATA 14, 32, 42, 49, 55, 60, 64, 67, 69, 70, 69, 70, 71, 70, 71, 0
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#3
Here's that program, somewhat improved:
Code:
'TEMP, by Ralph A. Esquivel, plots degrees F vs time in seconds

SCREEN 9: Xmax = 640: Ymax = 350


FG = 1 'blue foreground
BG = 7 'white background

COLOR FG, BG
CLS

'draw x-axis
X = 40
LINE (X, Ymax - 60)-(Xmax - 10, Ymax - 60)
LOCATE 22, 5
MULT1 = 10
FOR I = MULT1 TO 170 STEP MULT1
  PRINT I - MULT1;
  IF I = 10 THEN LINE (X + 32, 140)-(X + 32, Ymax - 60)
NEXT I

'draw y-axis
LINE (X, 140)-(X, Ymax - 60)
LOCATE 10
FOR I = 10 TO 0 STEP -1
PRINT I * 10
IF I = 7 THEN LINE (X, Ymax - 60 - 102)-(Xmax - 10, Ymax - 60 - 102)
IF I = 3 THEN LINE (X, Ymax - 60 - 46)-(Xmax - 10, Ymax - 60 - 46)
NEXT I


'plot temperature points
MULT2 = 1.45
READ TIME
FOR I = 1 TO TIME
  X0 = I * 3 + 40 - 2
  READ T
  TEMP = Ymax - 60 - T * MULT2
  Y0 = TEMP
  CIRCLE (X0, Y0), 2
  PAINT (X0, Y0), 1
  SLEEP 1 'simulate data at rate of 1 per second
NEXT I

LOCATE 10, 10
PRINT "Press any key to terminate program"
SLEEP
END

'Temperature data:
DATA 14, 32, 42, 49, 55, 60, 64, 67, 69, 70, 69, 70, 71, 70, 71, 0
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#4
Thanks

What I am trying to do is graph temperatures that I am reading in from an external temperature sensor. I read the temperature sensor every minute. While this is going on, I have other parts of the program controlling heaters to either increase or decrease the temperature.

I would like to go to a sub routine that plots the current temperature being read by the sensor. The variable for temperature is called temp and the variable for time is called time2!.

What I would like would be for the graph to be drawn on the bottom of the screen (below all the othere radio buttons that control heater and pumps).

Would I not have to establish an Intial start point for the graphic curse to go to , to draw the first temperature point and then append this initial start point every time I call the sub, so that the next temperature point is where it should be in relation to time?
Reply
#5
I am sending you a PM, as this is too complex for me to carry on here.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#6
Where did you get Qbasic for Mac?
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)