KhaledOsmani
Full Member level 6
- Joined
- May 4, 2014
- Messages
- 384
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 18
- Activity points
- 3,933
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 BSF ADCON2,ADFM CLRF R0L CALL A001 MOVF ADRESL,W MOVWF 0x047 MOVF ADRESH,W MOVWF 0x048 CLRF 0x049 CLRF 0x04A MOVF 0x047,W MOVWF AARGB3 MOVF 0x048,W MOVWF AARGB2 MOVF 0x049,W MOVWF AARGB1 MOVF 0x04A,W MOVWF AARGB0 CALL FLO3232 MOVF AARGB2,W MOVWF 0x053 MOVF AARGB1,W MOVWF 0x054 MOVF AARGB0,W MOVWF 0x055 MOVF AEXP,W MOVWF 0x056 CLRF BARGB2 CLRF BARGB1 MOVLW 0x20 MOVWF BARGB0 MOVLW 0x81 MOVWF BEXP MOVF 0x053,W MOVWF AARGB2 MOVF 0x054,W MOVWF AARGB1 MOVF 0x055,W MOVWF AARGB0 MOVF 0x056,W MOVWF AEXP CALL FPM32 MOVF AARGB2,W MOVWF 0x03B MOVF AARGB1,W MOVWF 0x03C MOVF AARGB0,W MOVWF 0x03D MOVF AEXP,W MOVWF 0x03E CLRF BARGB2 MOVLW 0xC0 MOVWF BARGB1 MOVLW 0x7F MOVWF BARGB0 MOVLW 0x88 MOVWF BEXP MOVF 0x03B,W MOVWF AARGB2 MOVF 0x03C,W MOVWF AARGB1 MOVF 0x03D,W MOVWF AARGB0 MOVF 0x03E,W MOVWF AEXP CALL FPD32 MOVF AARGB2,W MOVWF 0x03B MOVF AARGB1,W MOVWF 0x03C MOVF AARGB0,W MOVWF 0x03D MOVF AEXP,W MOVWF 0x03E MOVF 0x03B,W MOVWF 0x057 MOVF 0x03C,W MOVWF 0x058 MOVF 0x03D,W MOVWF 0x059 MOVF 0x03E,W MOVWF 0x05A CLRF BARGB2 CLRF BARGB1 MOVLW 0x48 MOVWF BARGB0 MOVLW 0x85 MOVWF BEXP MOVF 0x057,W MOVWF AARGB2 MOVF 0x058,W MOVWF AARGB1 MOVF 0x059,W MOVWF AARGB0 MOVF 0x05A,W MOVWF AEXP CALL FPM32 MOVF AARGB2,W MOVWF 0x035 MOVF AARGB1,W MOVWF 0x036 MOVF AARGB0,W MOVWF 0x037 MOVF AEXP,W MOVWF 0x038 CLRF BARGB2 CLRF BARGB1 CLRF BARGB0 MOVLW 0x80 MOVWF BEXP MOVF 0x035,W MOVWF AARGB2 MOVF 0x036,W MOVWF AARGB1 MOVF 0x037,W MOVWF AARGB0 MOVF 0x038,W MOVWF AEXP CALL FPD32 MOVF AARGB2,W MOVWF 0x035 MOVF AARGB1,W MOVWF 0x036 MOVF AARGB0,W MOVWF 0x037 MOVF AEXP,W MOVWF 0x038 CLRF BARGB2 CLRF BARGB1 MOVLW 0x20 MOVWF BARGB0 MOVLW 0x83 MOVWF BEXP MOVF 0x035,W MOVWF AARGB2 MOVF 0x036,W MOVWF AARGB1 MOVF 0x037,W MOVWF AARGB0 MOVF 0x038,W MOVWF AEXP CALL FPS32 MOVF AARGB2,W MOVWF 0x035 MOVF AARGB1,W MOVWF 0x036 MOVF AARGB0,W MOVWF 0x037 MOVF AEXP,W MOVWF 0x038
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 RLCF R0L,F RLCF R0L,F MOVLW 0x80 ANDWF ADCON2,F MOVLW 0x3C ANDWF R0L,W IORLW 0x01 MOVWF ADCON0 MOVLW 0x03 IORWF ADCON2,F MOVLW 0x12 MOVWF R4L RCALL DL01 BSF ADCON0,GO A002: BTFSC ADCON0,GO BRA A002 BCF PIR1,ADIF BCF ADCON0,ADON RETURN
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 R0L EQU 0x000 R0H EQU 0x001 R1L EQU 0x002 R1H EQU 0x003 R2L EQU 0x004 R2H EQU 0x005 R3L EQU 0x006 R3H EQU 0x007 R4L EQU 0x008 R4H EQU 0x009 R5L EQU 0x00A R5H EQU 0x00B R6L EQU 0x00C R6H EQU 0x00D R7L EQU 0x00E R7H EQU 0x00F R8H EQU 0x011 R9L EQU 0x012 R9H EQU 0x013 R0HL EQU 0x000 R1HL EQU 0x002 R2HL EQU 0x004 R3HL EQU 0x006 R4HL EQU 0x008 R5HL EQU 0x00A R6HL EQU 0x00C R7HL EQU 0x00E R9HL EQU 0x012 R1HL0HL EQU 0x000 R3HL2HL EQU 0x004 R5HL4HL EQU 0x008 R7HL6HL EQU 0x00C AARGB5 EQU 0x014 AARGB4 EQU 0x015 AARGB3 EQU 0x016 AARGB2 EQU 0x017 AARGB1 EQU 0x018 AARGB0 EQU 0x019 AEXP EQU 0x01A BARGB3 EQU 0x01B BARGB2 EQU 0x01C BARGB1 EQU 0x01D BARGB0 EQU 0x01E BEXP EQU 0x01F TEMPB1 EQU 0x020 TEMPB0 EQU 0x021 SIGN EQU 0x022 FPFLAGS EQU 0x023
testing 12 testing 12 testing 12
ASM: org 0x800
Define LCD_BITS = 8 'allowed values are 4 and 8 - the number of data interface lines
Define LCD_DREG = PORTD
Define LCD_DBIT = 0 '0 or 4 for 4-bit interface, ignored for 8-bit interface
Define LCD_RSREG = PORTB
Define LCD_RSBIT = 1
Define LCD_EREG = PORTB
Define LCD_EBIT = 3
Define LCD_RWREG = PORTB 'set to 0 if not used, 0 is default
Define LCD_RWBIT = 2 'set to 0 if not used, 0 is default
Define LCD_COMMANDUS = 2000 'delay after LCDCMDOUT, default value is 5000
Define LCD_DATAUS = 100 'delay after LCDOUT, default value is 100
Define LCD_INITMS = 100 'delay used by LCDINIT, default value is 100
'the last three Define directives set the values suitable for simulation; they should be omitted for a real device
Lcdinit 0 'initialize LCD module; cursor is blinking
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim code As Word
Dim tempdig As Long
Dim tempan As Single
Dim lightdig As Long
Dim lightan As Single
Dim soildig As Long
Dim soilan As Single
Dim k As Single
Dim kk As Single
Dim kkk As Single
Dim k1 As Single
Dim kk1 As Single
Dim kkk1 As Single
Dim k2 As Single
Dim kk2 As Single
Dim kkk2 As Single
Dim i As Byte
Dim accuratetemp As Single
Dim accuratetempp As Single
ConfigPin PORTA = Input
ADCON1 = 0
ADCON2 = 0xbe
main:
Lcdcmdout LcdClear
Lcdout "System ACTIVATED"
WaitMs 750
Lcdcmdout LcdClear
Lcdcmdout LcdLine2Home
Lcdout "System ACTIVATED"
WaitMs 750
Lcdcmdout LcdClear
Lcdcmdout LcdLine1Home
Lcdout "System ACTIVATED"
WaitMs 750
Lcdcmdout LcdClear
Lcdout "Welcome To The Automated Green House"
Lcdcmdout LcdLine2Home
Lcdout "VERSION: 1.0.0"
WaitMs 2200
Lcdcmdout LcdClear
Lcdout "We are controlling three plants: "
Lcdcmdout LcdLine2Home
Lcdout "Potatoes / Tomatoes / Gardenia"
WaitMs 2000
Lcdcmdout LcdClear
Lcdout "!!NOTE!! "
WaitMs 750
Lcdcmdout LcdClear
Lcdout " !!NOTE!! "
WaitMs 750
Lcdcmdout LcdClear
Lcdout " !!NOTE!!"
WaitMs 750
Lcdcmdout LcdClear
Lcdout "Press the RED push-button to stop"
Lcdcmdout LcdLine2Home
Lcdout "Monitoring and start to Harvest."
WaitMs 2000
here:
Lcdcmdout LcdClear
Lcdout "Please choose from the following menu:"
Lcdcmdout LcdLine2Home
Lcdout "1.Potatoes 2.Tomatoes 3.Gardenia"
idiot:
If PORTC.3 Then
High PORTB.0
Lcdcmdout LcdClear
Lcdout "You Cannot harvest, unpress push-button"
WaitMs 750
Lcdcmdout LcdLine2Home
Lcdout "To Choose your plant first:"
WaitMs 750
Goto idiot
Else
Low PORTB.0
Goto readcode
Endif
readcode:
WaitMs 1000
If PORTC.3 Then
High PORTB.0
Lcdcmdout LcdClear
Lcdout "You Cannot harvest, unpress push-button"
WaitMs 750
Lcdcmdout LcdLine2Home
Lcdout "To Choose your plant first:"
WaitMs 750
Low PORTB.0
Goto idiot
Endif
High PORTC.0
If PORTC.4 = 1 Then
Lcdcmdout LcdClear
Lcdout "Your choice is: 1"
Lcdcmdout LcdLine2Home
WaitMs 1500
Gosub potatoes
Endif
If PORTC.5 = 1 Then
code = code * 10 + 4
Lcdcmdout LcdClear
High PORTB.0
Lcdout " !WRONG ENTRY! "
Lcdcmdout LcdLine2Home
Lcdout " TRY AGAIN: "
WaitMs 1500
Low PORTB.0
Goto readcode
Endif
If PORTC.6 = 1 Then
code = code * 10 + 7
Lcdcmdout LcdClear
High PORTB.0
Lcdout " !WRONG ENTRY! "
Lcdcmdout LcdLine2Home
Lcdout " TRY AGAIN: "
WaitMs 150
Low PORTB.0
Goto readcode
Endif
If PORTC.7 = 1 Then
Lcdcmdout LcdClear
High PORTB.0
Lcdout " !WRONG ENTRY! "
Lcdcmdout LcdLine2Home
Lcdout " TRY AGAIN: "
WaitMs 1500
Low PORTB.0
Goto readcode
Endif
Low PORTC.0
High PORTC.1
If PORTC.4 = 1 Then
code = code * 10 + 2
Lcdcmdout LcdClear
Lcdout "Your Choice is: 2"
WaitMs 1500
Gosub tomatoes
Endif
If PORTC.5 = 1 Then
code = code * 10 + 5
Lcdcmdout LcdClear
High PORTB.0
Lcdout " !WRONG ENTRY! "
Lcdcmdout LcdLine2Home
Lcdout " TRY AGAIN: "
Low PORTB.0
WaitMs 1500
Goto readcode
Endif
If PORTC.6 = 1 Then
code = code * 10 + 8
Lcdcmdout LcdClear
High PORTB.0
Lcdout " !WRONG ENTRY! "
Lcdcmdout LcdLine2Home
Lcdout " TRY AGAIN: "
WaitMs 1500
Low PORTB.0
Goto readcode
Endif
If PORTC.7 = 1 Then
code = code * 10 + 0
Lcdcmdout LcdClear
High PORTB.0
Lcdout " !WRONG ENTRY! "
Lcdcmdout LcdLine2Home
Lcdout " TRY AGAIN: "
WaitMs 1500
Low PORTB.0
Goto readcode
Endif
Low PORTC.1
High PORTC.2
If PORTC.4 = 1 Then
code = code * 10 + 3
Lcdcmdout LcdClear
Lcdout "Your Choice is: 3"
WaitMs 1300
Gosub gardenia
Endif
If PORTC.5 = 1 Then
code = code * 10 + 6
Lcdcmdout LcdClear
High PORTB.0
Lcdout " !WRONG ENTRY! "
Lcdcmdout LcdLine2Home
Lcdout " TRY AGAIN: "
WaitMs 1500
Low PORTB.0
Goto readcode
Endif
If PORTC.6 Then
code = code * 10 + 9
Lcdcmdout LcdClear
High PORTB.0
Lcdout " !WRONG ENTRY! "
Lcdcmdout LcdLine2Home
Lcdout " TRY AGAIN: "
WaitMs 1500
Low PORTB.0
Goto readcode
Endif
Low PORTC.2
Goto readcode
Goto main
End
potatoes:
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: POTATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
Lcdcmdout LcdClear
Lcdout "Testing POTATOES Plant..."
WaitMs 1500
Lcdcmdout LcdClear
Lcdout "The POTATOES Plant has the following: "
Lcdcmdout LcdLine2Home
Lcdout "(Scanning in Progress...)"
WaitMs 1300
ok1:
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdcmdout LcdClear
Lcdout "You have chosen to harvest the: POTATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
i = 0
accuratetemp = 0
acctemp:
WaitMs 1500
If i < 10 Then
Adcin 0, tempdig
WaitMs 1000
k = tempdig
tempan = k * 5 / 1023
kk = tempan
kkk = kk * 100
kkk = kkk / 2
kkk = kkk - 20
i = i + 1
accuratetemp = accuratetemp + kkk
Goto acctemp
Else
Endif
accuratetemp = accuratetemp / 10
accuratetempp = accuratetemp - 30
WaitMs 2000
Adcin 1, lightdig
WaitMs 1000
k1 = lightdig
kk1 = k1 / 10
kkk1 = kk1
WaitMs 2000
Adcin 2, soildig
WaitMs 1000
k2 = soildig
kk2 = k2 / 10
kkk2 = kk2 - 10
WaitMs 1000
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: POTATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
Lcdcmdout LcdClear
Lcdout "TEMPERATURE: ", #accuratetempp, "C"
Lcdcmdout LcdLine2Home
Lcdout "LIGHT: ", #kkk1, "lux & MOISTURE: ", #kkk2, "%"
WaitMs 1300
Lcdcmdout LcdClear
If accuratetempp = 17 And kkk1 = 70 And kkk2 = 23 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "The Plant is under optimum conditions"
Lcdcmdout LcdLine2Home
Lcdout "To Harvest Press the Red Push Button"
WaitMs 1100
Goto ok1
Endif
Lcdout "The following executions will be taken: "
Lcdcmdout LcdLine2Home
WaitMs 1200
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: POTATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
checktemp:
If accuratetempp < 17 Then
High PORTB.5
Low PORTB.4
Lcdout "HEATER ON "
WaitMs 1300
Endif
If accuratetempp = 17 Then
Low PORTB.5
Low PORTB.4
Lcdout "H&C OFF "
WaitMs 1300
Endif
If accuratetempp > 17 Then
High PORTB.4
Low PORTB.5
Lcdout "COOLER ON "
WaitMs 1300
Endif
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: POTATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
checklight:
If kkk1 < 70 Then
High PORTB.6
Lcdout "LIGHTS ON "
WaitMs 1300
Else
Low PORTB.6
Lcdout "LIGHTS OFF "
WaitMs 1300
Endif
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: POTATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
checkhum:
If kkk2 < 23 Then
High PORTB.7
Lcdout "SPRINKLER ON"
WaitMs 1300
Else
Low PORTB.7
Lcdout "SPRINKLER OFF"
WaitMs 1300
Endif
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: POTATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
Goto ok1
Return
tomatoes:
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: TOMATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
Lcdcmdout LcdClear
Lcdout "Testing TOMATOES Plant..."
WaitMs 1300
Lcdcmdout LcdClear
Lcdout "The TOMATOES Plant has the following: "
Lcdcmdout LcdLine2Home
Lcdout "(Scanning in Progress...)"
WaitMs 1300
ok2: If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: TOMATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
i = 0
accuratetemp = 0
acctemp:
WaitMs 1500
If i < 10 Then
Adcin 0, tempdig
WaitMs 1000
k = tempdig
tempan = k * 5 / 1023
kk = tempan
kkk = kk * 100
kkk = kkk / 2
kkk = kkk - 20
i = i + 1
accuratetemp = accuratetemp + kkk
Goto acctemp
Else
Endif
accuratetemp = accuratetemp / 10
accuratetempp = accuratetemp - 30
WaitMs 2000
Adcin 1, lightdig
WaitMs 1000
k1 = lightdig
kk1 = k1 / 10
kkk1 = kk1
WaitMs 2000
Adcin 2, soildig
WaitMs 1000
k2 = soildig
kk2 = k2 / 10
kkk2 = kk2 - 10
WaitMs 1500
Lcdcmdout LcdClear
Lcdout "TEMPERATURE: ", #accuratetempp, "C"
Lcdcmdout LcdLine2Home
Lcdout "LIGHT: ", #kkk1, "lux & MOISTURE: ", #kkk2, "%"
WaitMs 1300
Lcdcmdout LcdClear
If accuratetempp = 22 And kkk1 = 50 And kkk2 = 46 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "The Plant is under optimum conditions"
Lcdcmdout LcdLine2Home
Lcdout "To Harvest Press the Red Push Button"
WaitMs 1100
Goto ok2
Endif
Lcdout "The following executions will be taken: "
Lcdcmdout LcdLine2Home
WaitMs 1100
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: TOMATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
checktemp:
If accuratetempp < 22 Then
High PORTB.5
Low PORTB.4
Lcdout "HEATER ON "
WaitMs 1300
Endif
If accuratetempp = 22 Then
Low PORTB.5
Low PORTB.4
Lcdout "H&C OFF "
WaitMs 1300
Endif
If accuratetempp > 22 Then
High PORTB.4
Low PORTB.5
Lcdout "COOLER ON "
WaitMs 1300
Endif
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: TOMATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
checklight:
If kkk1 < 50 Then
High PORTB.6
Lcdout "LIGHTS ON "
WaitMs 1300
Else
Low PORTB.6
Lcdout "LIGHTS OFF "
WaitMs 1300
Endif
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: TOMATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
checkhum:
If kkk2 < 46 Then
High PORTB.7
Lcdout "SPRINKLER ON"
WaitMs 1300
Else
Low PORTB.7
Lcdout "SPRINKLER OFF"
WaitMs 1300
Endif
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: TOMATOES"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
Goto ok2
Return
gardenia:
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: GARDENIA"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
Lcdcmdout LcdClear
Lcdout "Testing GARDENIA Flower..."
WaitMs 1300
Lcdcmdout LcdClear
Lcdout "The GARDENIA Flower has the following: "
Lcdcmdout LcdLine2Home
Lcdout "(Scanning in progress...)"
WaitMs 1300
ok3: If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: GARDENIA"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
i = 0
accuratetemp = 0
acctemp:
WaitMs 1500
If i < 10 Then
Adcin 0, tempdig
k = tempdig
tempan = k * 5 / 1023
kk = tempan
kkk = kk * 100
kkk = kkk / 2
kkk = kkk - 20
i = i + 1
accuratetemp = accuratetemp + kkk
Goto acctemp
Else
Endif
accuratetemp = accuratetemp / 10
accuratetempp = accuratetemp - 30
WaitMs 2000
Adcin 1, lightdig
k1 = lightdig
kk1 = k1 / 10
kkk1 = kk1
WaitMs 2000
Adcin 2, soildig
k2 = soildig
kk2 = k2 / 10
kkk2 = kk2 - 10
WaitMs 1500
Lcdcmdout LcdClear
Lcdout "TEMPERATURE: ", #accuratetempp, "C"
Lcdcmdout LcdLine2Home
Lcdout "LIGHT: ", #kkk1, "lux & MOISTURE: ", #kkk2, "%"
WaitMs 1300
Lcdcmdout LcdClear
If accuratetempp = 30 And kkk1 = 5 And kkk2 = 10 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "The Plant is under optimum conditions"
Lcdcmdout LcdLine2Home
Lcdout "To Harvest Press the Push Button"
WaitMs 1100
Goto ok3
Endif
Lcdout "The following executions will be taken: "
Lcdcmdout LcdLine2Home
WaitMs 1100
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: GARDENIA"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
checktemp:
If accuratetempp < 30 Then
High PORTB.5
Low PORTB.4
Lcdout "HEATER ON "
WaitMs 1300
Endif
If accuratetempp = 30 Then
Low PORTB.5
Low PORTB.4
Lcdout "H&C OFF "
WaitMs 1300
Endif
If accuratetempp > 30 Then
High PORTB.4
Low PORTB.5
Lcdout "COOLER ON "
WaitMs 1300
Endif
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: GARDENIA"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
checklight:
If kkk1 < 5 Then
High PORTB.6
Lcdout "LIGHTS ON "
WaitMs 1300
Else
Low PORTB.6
Lcdout "LIGHTS OFF "
WaitMs 1300
Endif
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: GARDENIA"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
checkhum:
If kkk2 < 10 Then
High PORTB.7
Lcdout "SPRINKLER ON"
WaitMs 1300
Else
Low PORTB.7
Lcdout "SPRINKLER OFF"
WaitMs 1300
Endif
If PORTC.3 Then
Lcdcmdout LcdClear
Low PORTB.4
Low PORTB.5
Low PORTB.6
Low PORTB.7
Lcdout "You have chosen to harvest the: GARDENIA"
Lcdcmdout LcdLine2Home
Lcdout "Choose Another plant(1/2/3), or turn off"
WaitMs 2000
Goto here
Endif
Goto ok3
Return
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?