firefly Postat Octombrie 6, 2009 Partajează Postat Octombrie 6, 2009 ca un noob ce sunt, am zis ca daca altii pot si eu sunt in stare; si pina la urma tot nu ma voi lasa si tot o sa finalizez ceea ce vreau fiindca imi place sa bricolez si sunt ambitios. vreau intr-un final sa ajung sa imi cosntruiesc un microcontroller pentru acvariu care sa imi controleze totul (hranire, co2, lumina, UV, moonlight, ORP-ul daca va fi vreodata ...) pentru asta caut de ceva vreme pe net diferite scheme care sa faca asa ceva si pina acum am reusit sa gasesc mai multe dintre care una inclusiv cu fisierul "source cod" pentru a putea fi programat atmel-ul. toate bune si frumoase, dar inainte de a ma apuca sa construiesc ceva vreau sa inteleg tot ce e necesar, adiacent proiectului meu. cum nu am programat in viata mea un microcontroller si nici macar n-am invatat programare fiind de alta profesie, in momentul de fata pot doar spera sa colaborez cu cineva cu mai multa pricepere in acest domeniu. stiu ca fisierul meu BASCOM trebuie compilat pus in cod masina si "incarcat" in microntroller, gresesc pina aici? dar la incercarea de compilare primesc vreo 6 erori legate de 3-4 linii de genul: Error : 22 Line : 164 Out of SRAM space , in File : C:\.....\*.bas ce fel de eroare este asta? ce ar trebui sa verific intr-o prima faza? cum se poate inlatura? In Bascom-avr selectez tipul de microcontroller asa cum este el indicat atmega128 sau totusi nu am ales bine? din codul sursa citez inceputul, nu isi are sensul sa o afisez toata in formatul desfasurat. '**************************************************************************************************************************************' GS Controller V.0.1a ' Atmel Atmega128 based Aquarium controller ' ' NOTES: ' Remember to Set bit 6 of HighFuse(disable JTAG) to allow C.1 and C.0 to be I2C pins ' RS232 is 2400, 8, N, 1 ' In manual need to note that on initialization, any time based relays may turn on for up to 5 seconds during initialization ' LogSend takes 2 minutes with no alarm checking during sending ' Log Clear takes SIX minutes no alarm checking during clearing ' 'KNOWN BUGS: 'Don't think log is writing correctly must check ' 'Internet Module = Initialized...able to ping ' Will be finished post production ' Temporary "under construction" screen displayed presently ' '************************************************************************************************************************************** 'Dimension Statements 'Dstringa, Dstringb, Dstringc, Dstringd = STR = holds line one thru four of display 'Olddstringa, Olddstringb , Olddstringc, Olddstringd = holds last displayed lines = checks for screen update flags Asame/Bsame/Csame/Dsame 'updateflag = holds sum of asame-dsame to check for screen update 'Gslcdcontrolstr = STR = holds command value for display routine 'X = Integer = variable for loops not discreet 'Zerotemp , Onetemp = constants to allow pass to subroutines with reference 'settemp = Non-discreet byte for setting things with the menus 'Displaydietemp, Displaydietempex = Holds Temperature Values for Ambient 'Displayremtemp, Displayremtempex = Holds Temperature Values for Remote Sensor (tank) 'Displaydietempexstr = Holds Temperature display string for Ambient 'Displayremtempexstr = Holds Temperature display string for Remote Sensor (tank) 'temp2str = NOT discreet str for extended temperature byte conversion 'Tempconvert = passed variable to farenheit conversion routine 'Tempconvertstr = STR of Tempconvert to trim to 2 decimal places 'Temperatureoffset = value to subtract from remote sensor 'Temppause = holds compare value of seconds for temp every 5 seconds 'Temphold = temporary hold integer for Dsecond 'Fcdisplay = Holds flag value for "C" or "F" for farenheit vs Celcius display 00=C FF=F 'extend = variable passsed to extended temp subroutine to get the decimal places of temp sensor 'GSpH = STR = holds displayed pH value 'Gsorp = str = holds displayed orp value 'pHprobe = word = holdc ADC value for pH probe 'X10house = holds house code selected by user (A-P) 'X10uword = Two byte variable holding 16 bits representing use of X10 devices 1-16 used = 1 unused = 0 'Disprelay = holds string of relay or X10 module being set in action menus 'X10relaydisplaystr = Holds adjusted text to differentiate X10 relays from Direct Relays 'Relaymenunumpass = passes subsubmenu number to relay increment sub for action menu 'Thermalsensortype = byte = 1=room 2=tank (room for more sensors if needed) 'Tim0_interuptword, Tim1_interuptword = Timer variables for interupt delays 'Alertdisplaytimerhold = holds initial value of interrupt for compare in alert display routine 'Alertdisplaynum = holds number of alert being displayed 'Alertlinedisplay = holds text of alertline 'Alarmtimehold() = holds hour that a time based relay turned on and only turns on again after hour has changed ' 'I2C I/O expander variables 'Relay flags 'relayau, relaybu, relaycu, relaydu, relayeu = Relays A-E in use flag used =1 available =0 'Relay bytes 'relaybyte = I/O expander B read value binary pins 0-7 'PCFBstr = string = binary string holder to parse 'PCFpintempstr = Holds single pin 0 or 1 str 'pHpres, ORPpres, Internetpres, Relays 1-5pres = 1 = present 0=absent ' 'Display command bytes 'Gslcdbaud = GSLCD Display baud , Gslcdclear = cls , Gslcdlowerline = moves to begining of line 2 'Gslcdhome = homes cursor , GSlcdline3 = moves to beginning of line 3, GSlcdline4 = moves to beginning of line 4 'Gslcdcommand1 = command indicator for GSLCD (254) 'Gslcdcommand2 = passed command 'gslcdcontrolflag = Holds passed command flag true or false 'Gslcdnoline = holds command to turn off cursor ' 'RTC Variables 'Dsecond , Dminute , Dhour , Dday , Ddate , Dmonth , Dyear = bytes with these values from RTC in decimal within main program 'Displaytime , Displaydate , Displayam = Strings holding values for display of these parameters from RTC 'Amtemp = Temp byte to compare bitpattern for AM and 24 hour bits from RTC 'Settemp = holds year in year set menu 'Oldhour = Byte that holds value to check if new hour has passed for log entry 'Displaytimenosec = displays time without the seconds displayed ' 'ST I2C eprom variables 'Tempepromstr = holds read values from STeprom 'Tempeprombyte = holds value for writing to eprom 'Tempepromdisplaystr = testing variable holding memory value for display ' 'Menu arrays = holds text menus in arrays 'Mainmenu(4) , Settimemenu(5) , Setdatemenu(5) , Settempmenu(4) , Setresponsemenu(7) , RS232menu(6) , X10menu(3) ' 'Floatmodule and Topoff variables 'Topofffloatflag = byte = 00 if no floats assigned to topoff, AA if float module A is topoff, BB if B is topoff FF if both ' = FB if both used as sequential topoff 'FloatsApresent , FloatsBpresent = 1 if present 0 if absent 'Floatarelay , Floatbrelay As Byte = Holds Relays assigned to topoff controll if any FF=unasigned 'Floatatype , Floatbtype = 01 = Topoff, 02 = Sequential Topoff , 03=Individual defaults to 01 'Floatamode , Floatbmode = timed or level based 0=level 1 = timed 'Floatahi, Floatalow, Floatbhi, Floatblow = bits for floats 0=off 1=on 'Topoffrelaya, Topoffrelayb = flag for relay (pump) on 1=0n 0 =off 'Reservoiraempty, Reservoirbempty = 1 = empty, 0= not 'Topoffaincrinit , Topoffbincrinit as word = Holds Tim1_interruptword initial value when delay starts for topoff a and b if in delay mode 'Topoffadelayrollover , Topoffbdelayrollover As Word = Holds value if timer variable has rolled over ' 'Internet Module variables ' Iim7010agateway(4) = Aray holding 4 bytes of gateway address ' Iim7010asmr(4) = Aray holding 4 bytes of subnet mask ' Iim7010amac(6) = Aray holding the 6 byte MAC address ' Iim7010aip(4) = Aray holding the units IP ' Iim7010ainitread = byte for reading initialization_ok bit from 7010a 'Subroutines ' 'Menu variables 'Menupos = Vertical position in main menu 'Menuposl= Menupos +1 for displaying second line of display 'Menuposl3= Menupos +2 for third line 'Menuposl4= Menupos+3 for fourthline 'Submenu = Determines which submenu you are in 'Submenupos = Vertical position within submenu 'Submenuposl = submenupos +1 , Submenuposl3 = submenupos +2 , Submenuposl4 = submenupos+3 'Subsubmenu = Holds value for sub - submenu to be displayed by routine 'Subsubmenupos(4) = position within subsubmenu ' 'Flags '24hour = 12/24 hour flag : 1 = 24 hour mode 'Asame/Bsame/Csame/Dsame = Flag for screen update = signals changes in line 1 thru 4 'Line3clearflag, Line4clearflag = If 1 then clear the lower lines 'Skipflag = Set every 5 seconds to update temp, pH and ORP probes 'Tim0_interruptflag = controls auto-timeout of menu to return to main 'X10present = 1 if present 0 if absent 'Alertcodeflag = byte = flag for alerts being displayed incremented by one for each additional alert, decremented when alert over 'Relaysonflag = Long = Holds bits for relays 1-21 0=off 1 = on and bits 30/31 holds reservoir a/b empty 'Relayaalertflag , Relaybalertflag = indicates if alert is set fro topoff reservoirs 'Alertinterruptflag = used in routine to toggle interrupts being displayed if multiple need displayed ' '******************************************************************************************************************************* 'Called Subroutines ' Lcdisplay(gslcdcontrolflag As Byte , Gslcdcommand2 As Byte) = sends data to LCD ' Extendedtemp(extend As Byte) = Determines the extended temperature ' Fcconvert(tempconvertstr As String) = Converts C to F ' Stepromread(byval Msbeprom As Byte , Byval Lsbeprom As Byte , Byval Bytenumeprom As Byte) = Reads I2C eprom ' Stepromwrite(msbeprom As Byte , Lsbeprom As Byte , Bytenumeprom As Byte) = writes to eprom '******************************************************************************************************************************* ' '24C256 Eeprom memory laid out as follows: '21*16 bytes for relay settings including X-10 modules begins at &0010 'xx00=used(0/1) xx01=Trigger Type (1-9) xx02=Mode(0/1) xx03-08=On trigger value xx09-0E=Off trigger value '31*40 bytes for log Q1 hour daily holds a month of logs memory starts at 0100 'log layed out as follows: 'bytes 0-5 = Temproom, 6-B = TempTank, C-10 = pH, 11-14 = orp, 15-1C = Date, 1D-23 = time 'Display Variables for LCD Dim Dstringa As String * 16 , Dstringb As String * 16 , Dstringc As String * 16 , Dstringd As String * 16 Dim Gslcdcontrolstr As String * 2 , Displaydietempexstr As String * 6 , Displayremtempexstr As String * 6 Dim Gsph As String * 5 , Fcdisplay As Byte , Gsorp As String * 4 , Disprelay As Byte Dim Displaytime As String * 10 , Displaydate As String * 8 , Displayam As String * 2 , Displaytimenosec As String * 7 Dim X10relaydisplaystr As String * 7 , Alertlinedisplay As String * 16 'Display control Variables Dim Gslcdnoline As Byte , Dim Olddstringa As String * 16 , Olddstringb As String * 16 Dim Olddstringc As String * 16 , Olddstringd As String * 16 Dim Gslcdbaud As Integer , Gslcdclear As Byte , Gslcdcommand1 As Byte , Gslcdlowerline As Byte , Gslcdhome As Byte Dim Gslcdline3 As Byte , Gslcdline4 As Byte Dim Zerotemp As Byte , Onetemp As Byte , Onebit As Bit , Zerobit As Bit 'Menu Strings Dim Mainmenu(12) As String * 15 , Settimemenu(6) As String * 15 , Setdatemenu(5) As String * 15 , Settempmenu(4) As String * 15 Dim Setresponsemenu(9) As String * 15 , Rs232menu(9) As String * 15 , X10menu(7) As String * 15 , Timedrelaymenu(6) As String * 15 Dim Internetmenu(6) As String * 15 , Floatsmenu(5) As String * 15 , Phrelaymenu(6) As String * 15 , Orprelaymenu(6) As String * 15 Dim Floatrelaymenu(6) As String * 15 , Temprelaymenu(7) As String * 15 , Floatstopoffmenu(7) As String * 15 'Working variables Dim Phprobe As Single , Orpprobe As Single Dim Displaydietemp As Byte , Displayremtemp As Byte , Displaydietempex As Byte , Displayremtempex As Byte Dim Temperatureoffset As Byte , Temppause As Integer Dim Temphold As Integer , Tempadc As Word , Tempadcstr As String * 4 , Amtemp As Byte Dim Dsecond As Byte , Dminute As Byte , Dhour As Byte , Dday As Byte , Ddate As Byte , Dmonth As Byte , Dyear As Byte Dim Menupos As Byte , Menuposl As Byte , Submenu As Byte , Submenupos As Byte , Submenuposl As Byte Dim Menuposl3 As Byte , Menuposl4 As Byte , Submenuposl3 As Byte , Submenuposl4 As Byte , Loghourcheck As Byte Dim Settemp As Byte , Subsubmenu As Byte , Subsubmenupos(4) As Byte , Oldhour As Byte , X10temp As Byte , X10house As String * 1 Dim Floatbyte As Byte , Floatonnum As Byte , Floatoffnum As Byte Dim Floatarelay As Byte , Floatbrelay As Byte , Floatatype As Byte , Floatbtype As Byte , Floatamode As Bit , Floatbmode As Bit Dim Floatdelaytemp As Word , Alertdisplaytimerhold As Word , Alertdisplaytimerworking As Word , Alertdisplaytimerrollover As Word Dim Floatadelay As Word , Floatbdelay As Word , Floattypetemp As Byte , Floatmodetemp As Bit , Floatrelaytemp As Byte Dim Relaytimehourflag As Bit , Relaytimeonhour As Byte , Relaytimeonminute As Byte , Relaytimeoffhour As Byte , Relaytimeoffminute As Byte Dim Relayphonval As Word , Relayphoffval As Word , Relayphondisp As String * 5 , Relayphoffdisp As String * 5 Dim Relayorponval As Integer , Relayorpoffval As Integer , Relaytempondisp As String * 4 , Relaytempoffdisp As String * 4 Dim Relaytemponval As Byte , Relaytempoffval As Byte , Topoffaincrinit As Word , Topoffbincrinit As Word Dim Thermalsensortype As Byte , Tim0_interruptword As Word , Tim1_interruptword As Word , Topoffadelayrollover As Word , Topoffbdelayrollover As Word Dim Alertdisplaynum As Byte , Alarmrelaybit As Byte , Alarmtypebyte As Byte , Alarmon As String * 6 , Alarmoff As String * 6 Dim Alarmoffsingle As Single , Alarmonsingle As Single , Alarmrelay As Byte , Alarmonbyte As Byte , Alarmoffbyte As Byte Dim Alarmtimehold(21) As Byte , Loghourbyte As Byte , Receivesetupcommand As String * 2 , Rs232receivestr As String * 16 'Temporary nondiscrete variables Dim Tempconvert As Single , Tempconvertstr As String * 16 , X As Integer , Y As Byte , Z As Byte Dim Templong As Long , Temp2long As Long , Tempbyte As Byte , Tempbyte2 As Byte , Temp2str As String * 2 Dim Temp4str As String * 4 , Temp8str As String * 8 , Tempword As Word 'Flags Dim Skipflag As Bit , Farenheitflag As Bit , Asame As Bit , Bsame As Bit , Csame As Bit , Dsame As Bit Dim Updateflag As Byte , Line3clearflag As Bit , Line4clearflag As Bit , Alertcodeflag As Byte Dim Floatsapresent As Bit , Floatsbpresent As Bit , Floatsbsequential As Bit , X10present As Bit , Allrelaysusedflag As Bit Dim Floatsaused(3) As Byte , Floatsbused(3) As Byte , Topofffloatflag As Byte , Reservoiraempty As Bit , Reservoirbempty As Bit Dim Relaybyte As Byte , Phpres As Bit , Orppres As Bit , Internetpres As Bit , Relay1pres As Bit , Relay2pres As Bit , Relay3pres As Bit Dim Relay4pres As Bit , Relay5pres As Bit , Relayuse As Long , 24hour As Bit Dim Floatahi As Bit , Floatalow As Bit , Floatbhi As Bit , Floatblow As Bit , Topoffrelaya As Bit , Topoffrelayb As Bit Dim Hourskipflag As Bit , Tim0_interruptflag As Bit , Topofftimedaflag As Bit , Topofftimedbflag As Bit Dim Relaysonflag As Long , Relayaalertflag As Bit , Relaybalertflag As Bit , Alertinterruptflag As Bit Dim Flashcorruptcheckflag As Bit , Floatswitchflagchanged As Bit , Liveupdatetoggle As Bit , Floatsfirstcall As Bit 'I2C Eprom variables Dim Tempepromstr(8) As Byte , Tempeprombyte As Byte , Tempepromholdstr As String * 8 Dim Stepromday As Byte , Stepromtempaddress As Word , Stepromtempaddress2 As Word Dim Stepromtempaddrstr As String * 4 , Bytenumpass As Byte , Stepromaddress As Word Dim Msbeprom As Byte , Lsbeprom As Byte , Msblsbtemp As Word , Logenable As Byte 'Internet Module variables Dim Iim7010agateway(4) As Byte , Iim7010asmr(4) As Byte , Iim7010amac(6) As Byte , Iim7010aip(4) As Byte Dim Iim7010ainitread As Byte multumesc celui/celor care vor avea rabdarea sa ma ghideze peste toate "piedicile" care imi vor aparea Link spre comentariu
Postări Recomandate
Creează un cont sau autentifică-te pentru a adăuga comentariu
Trebuie să fi un membru pentru a putea lăsa un comentariu.
Creează un cont
Înregistrează-te pentru un nou cont în comunitatea nostră. Este simplu!
Înregistrează un nou contAutentificare
Ai deja un cont? Autentifică-te aici.
Autentifică-te acum