Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
storing data in csv
#11
Agamemnus so what you are saying is that the value of dt will be the delay so if i want 5 minutes then make the value 300? yeah the prog runs a simple temp sensor that displays the temp what i want is to store the temp in a file in a givin time intraval on an on going bases. Then i can export to excel for graphing.

Thanks
smaug
Reply
#12
Oh, so you want to loop through it and get readings multiple times, then?
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#13
Quote:
Code:
1.1 PRINT "Hi."

This is not allowed in GWBASIC or BASICA. It is allowed in QB, but in QB you better don't use line numbers.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#14
yes i am planning on tracking the temp for several months. my project is to monitor the temp of a saltwater fish tank and the temp of the room so that i can see if a chiller will be essential. They are way to exspensive. If i can track the temp in a prog on an old laptop it would be great i have not tested the code yet still waiting on parts. But with the help i am getting from you peeps it should all fall together easily enough. I want to say thanks again some forums ignore or insult newbies it is nice to see that in the tech world you can still find good people.

Smaug
Reply
#15
Ah, I see. Interesting. I will keep updating this one so I don't have to repost it.

I am not exactly sure how you do your Exel data but I think someone explained it b4. Anyways it would be easier (for me) to just use PSET and draw the data..

So first you need an array to store the result.
Also, what is the variable "M"?
And, please tell me if the OUTs are what I think they are. Er, just tell me what they are.
And, is this QBASIC? Smile

Code:
CLS: KEY OFF
DIM cycle.max as INTEGER
cycle.max = 30
DIM time.period AS INTEGER, f1 as integer, f2 as integer, cur.cycle as integer, time.array(cycle.max, 3) as integer
cur.cycle = 0
time.period = 2 'seconds
ba = 1016 'ba = com address.

DO
f1 = 0: f2 = 0
redo1: tm = TIMER: IF tm > 86370! THEN goto redo1 'Midnight trap. (Hmm?)

OUT (BA + 4), 1 + M 'Starts the counter?
tm = TIMER + time.period: WHILE TIMER < tm: WEND
OUT ba + 3, 0: tm1 = TIMER: tm2 = TIMER: OUT ba + 3, 64

redo2:
IF f1 = 0 AND (INP(BA + 6) AND 128) = 0 THEN f1 = 1: p1 = TIMER - tm1
IF f2 = 0 AND (INP(BA + 6) AND 32) = 0 THEN f2 = 1: p2 = TIMER - tm2
IF f1 <> 1 OR f2 <> 1 then goto redo2

time.array(cur.cycle, 1) = TIMER

p1 = p1 * 100: p2 = p2 * 100
t1 = 522 - 88.6299 * LOG(p1) + 3.0209 * LOG(p1) ^ 2
t2 = 522 - 88.6299 * LOG(p2) + 3.0209 * LOG(p2) ^ 2

PRINT "Read Temperatures: "
PRINT USING "Period (1) = ###.## seconds."; p1 / 100
PRINT USING "Temp (1) = ###.## celcius."; t1
PRINT USING "Period (2) = ###.## seconds."; p2 / 100
PRINT USING "Temp (2) = ###.## celcius."; t2
time.array(cur.cycle, 2) = t1: time.array(cur.cycle, 3) = t2

LOOP until cycle.max = cur.cycle OR INKEY$ = CHR$(27)

OPEN "test.csv" FOR OUTPUT as #1
WRITE #1, date$
FOR I% = 1 to cycle.max
WRITE #1, time.array1(I%, 1), time.array(I%, 2), time.array(I%, 3):
NEXT I%
CLOSE #1

Yeah, or something like that....
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#16
the out commands start a curcuit on th serial port to time the discharge of a cap and a thermistor. the m vari the is not actually used for this part of the code ther are a couple of lines of code that allow you to trip an output the m variable is used in that part. If some wants to see it i will post. Yes it is qbasic.

I found some other code while searching and thought that i might apply it for saving the file by date. like i said i have not ran the code i am still waiting on parts. It wont do much without the curcuit Sad .

createfile:
'Build a file name from the month and year (not Y2K compliant but who
cares!)
'This file will contain a data record for each minute of the month
'(44,640 records for a 31-day month)
fileraw$ = "HDS_" + MID$(DATE$, 9, 2) + MID$(DATE$, 1, 2) + ".dat"
OPEN fileraw$ FOR APPEND AS #2
RETURN

logit:
'Log the raw data to the disk file
LOCATE 3, 62: PRINT "Logging . . . "
WRITE #2, DATE$, LEFT$(TIME$, 5), t1, t2

Not sure how i would add this but i will look into it.

Smaug
Reply
#17
ok the varible time.period is the delay if changed to 300 would that give me 5 min intravals
I am not sure why they set the midnight trap to 86370 i would have thought that you would want 86400(hmm)lol.

If anybody is interested in the mag it is nuts and volts april 2003. if you want the curcuit and parts list i will pm it. Do you think that you could rem the changes with a brief explanation. trying to figure it out :wink:

I think that it sould put out Fahrenheit but that is just a label but posted for peeps info.

Smaug
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)