please dont rip this site

Scenix Contest Aquamon Aq_bas.txt

 '--------------------------------------------------------------------------------
'--- Title: Aquarium Logger
'--- Date:  05-03-02
'---
'--- By:   Mike Woods
'--- Desc: Reads the temperature and pH from the aquarium and send the values 
'---       out the serial port to a computer.  The PC then updates a Database
'---       where the results can be viewed from a webpage with graphs from 
'---       any date/time.  Eventually I would like to add more features like
'---       Lighting, feeding, etc....
'--------------------------------------------------------------------------------

TITLE AQ.BAS
			
			DEVICE SX28L, TURBO, STACKX_OPTIONX
			
			DIM ADC_Data, Temp_Data, X, I
			DIM ADCCNT1_
			DIMBIT ADCD1_=RC.5,ADCCK1_=RC.6,ADCCS1_=RC.7
			
			DIMBIT D1W_=RC.4, Presence=X.0
			DimBIT TX=RC.2
			
			LEVEL RC=$E0	' port is Cmos 11110000

			GOSUB DINIT
			



		DINIT:
			ADCCS1_=TRUE
			ADCCK1_=FALSE
			OUTDIR ADCCS1_
			OUTDIR ADCCK1_
			CONFIG_D1W_
		ENDINIT
		
		SUBROUTINE CONFIG_D1W_()
	
			Presence = D1RS_()	'--- Reset
			D1W_ = $CC		'--- Skip Row
			D1W_ = $4E		'--- Write Scratch
			
			FOR I=1 TO 3		'--- Send 3 byte Configuration
				D1W_ = $7F	'--- 12 Bit, Hi Alarm
			NEXT I

			Presence = D1RS_()	'--- Reset
			D1W_  = $CC		'--- Skip Row
			D1W_ = $48		'--- Copy Scratch to EEPROM
			D1W_ = TRUE		'--- POwer ON
			PAUSE 10000,10		
			D1W_ = FALSE		'--- POwer Off
		ENDSUB
			
		SUBROUTINE ADC1_()
			

			ADCCS1_=FALSE
			
			DO ADCCNT1_ = 8
				SHIFTINL ADC_Data,ADCD1_
				ADCCK1_=TRUE
				DELAY 1
				DELAY 0
				ADCCK1_=FALSE
				NOP 6
			LOOP ADCCNT1_

			NOP 2
			SHIFTINL ADC_Data,ADCD1_

			DO ADCCNT1_=2
				ADCCK1_=TRUE
				DELAY 1
				DELAY 0
				ADCCK1_=FALSE
				DELAY 1
			LOOP ADCCNT1_
			ADCCS1_=TRUE
		ENDSUB



		FUNCTION D1RS_()
			
			D1W_ = False	'--- Pull the line Low
			PAUSE 48,10	'--- Wait 480uS
			D1W_ = True	'--- allow line to return to high
			PAUSE 6,10	'--- Wait for presense to return (60uS)
			Presence = D1W_ '--- Get Presence signal
			PAUSE 42,10	'--- Finsih waiting out the timeslot (420uS) 420+60=480

		ENDF


		SUBROUTINE TEMP1_()

			Presence = D1RS_()
			D1W_ = $CC
			D1W_ = $44
			D1W_ = TRUE		'--- POWER ON
			PAUSE 65000,10		'--- Wait 750Ms
			PAUSE 10000,10		
			D1W_ = FALSE		'--- Power OFF
		
			D1W_ = $CC
			D1W_ = $8E		'--- Read Scratch
			
	 		'--- Read  temperature
			SHIFTINL Temp_DAta,D1W_,16
						
		ENDSUB

	
	LOOP1:

		'--- Get pH Level
		ADC1_

		'--- Get the temperature
		Temp1_

		'--- Send the data to serial port
		SEROUT TX, ADC_Data ,3,1	 
		SEROUT TX, "|",3,1 
		SEROUT TX, Temp_Data ,3,1 
		SEROUT TX, "~",3,1 

		'--- Wait for 10 minutes before sending next set of values
		FOR I = 1 TO 10
			WAIT 60000
		NEXT I
	GOTO LOOP1

	




END

file: /Techref/scenix/contest/aquamon/AQ_BAS.TXT, 2KB, , updated: 2002/6/4 10:34, local time: 2024/11/26 20:58,
TOP NEW HELP FIND: 
3.139.67.228:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://techref.massmind.org/Techref/scenix/contest/aquamon/AQ_BAS.TXT"> scenix contest aquamon AQ_BAS</A>

Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .