Hi skimask,
Is the code that complicated? Yea I guess it is somewhat but what I was thinking to do when I was writing it, well for one code segment below:
The Dummy_Water_Valve holds the value of Water_Valve_1 to 6 for PORTB.2 to PORTB.7 so I use the Dummy_Water_Valve var to turn On or Off any of the 6 Water valves. The same thing applies to the Dummy_Nutrient_Valve variable but with different PORT pins of course.
I wanted to know if a Water Valve on PORTB.2 to PORTB.7 was involved in a watering cycle, so for that I'm using the Dummy_Water_Valve_Number variable. What happens is when a Moisture meter sends a request to start a watering cycle then its valve is turned on using the Dummy_Water_Valve var and at the same time the
Dummy_Water_Valve_Number var is set to Is_Watering so the program can use this var to know that there's an active watering cycle happening for that Moisture Meter. One way that the watering cycle can be turned Off is when the Moisture Meter that started the watering cycle sends a + signal for 2500ms to stop the watering and that sets Dummy_Water_Valve = Is_Turned_Off and at the same time the Dummy_Water_Valve_Number = Is_Not_Watering so the program knows what's going on. The other way of turning off the watering cycle is to use the Dummy_Off_Tm timer and that's pretty straight forward, its just a timer that when set it enables the auto Off, it counts up to a set time and shuts off the watering cycle using the exact same code segment that the Moisture meter uses to shut Off the watering cycle.
Using that logic then when we're implementing the watering cycle then we first check if the Dummy_Water_Valve_Number is watering and if so then if the Dummy_Water_Valve is On, then we implement the On_Time_counter or if the Dummy_Water_Valve is Off then we implement the Off_Time_Counter. Also (ELSE) if the Dummy_Water_Valve_Number is not watering then we just implement a Calibration Pause to maintain a one second time base for the timers.
That seems pretty basic to me but that's only one segment of the code. What part of the code were you having problems following or think is over done or complicated (not that it isn't somewhat complicated)? I'm sure that some of the other beginners here might be interested, I know I would if you have the time to try and follow the flow of the program. If you (or anyone else here for that mater) finds a part of the code that's confusing or redundant then I'll try and explain my logic for that part and or change it to flow better.
Back to the PortE.2 thing, I'm sure its not the bread board because when I set pin 10 to an output then I test a Led to make sure that its working then I touched the led directly on the port pin and it doesn't turn On/Off like it should. Real strange, I tried 4 different 452's and the same results, mind you they are all ones that are used but still? I'll try getting a few more new ones and play around with the config settings to see what results I get.
Thanks
jessey
Bookmarks