I want to use 3 dosing pumps and use Internal Memory parms.

Do you have a question on how to do something.
Ask in here.
Post Reply
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

I want to use 3 dosing pumps and use Internal Memory parms.

Post by mudcat1 »

I am trying to use 3 BRS dosing pumps to dose Alk, Ca and Mg. I would like to use the internal memory parameters in the Android application to set the length of time to run each pump so that I do not have to upload code to the RA controller each time I want to change the length of time (in seconds) the pumps run. Here is the code that I think I need to add:

#define Dose_Alk Port2 // Dosing Pump Alk
#define Dose_Ca Port3 // Dosing Pump Ca
#define Dose_Mg Port4 // Dosing Pump Mg

#define Dose_Alk_Seconds 100 // Number of seconds to dose Alk
#define Dose_Ca_Seconds 101 // Number of seconds to dose Ca
#define Dose_Mg_Seconds 102 // Number of seconds to dose Mg

ReefAngel.DosingPumpRepeat( Dose_Alk,0,60,InternalMemory.read(Dose_Alk_Seconds));
ReefAngel.DosingPumpRepeat( Dose_Ca,0,60,InternalMemory.read(Dose_Ca_Seconds));
ReefAngel.DosingPumpRepeat( Dose_Mg,10,60,InternalMemory.read(Dose_Mg_Seconds));

Why is this not working for me?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: I want to use 3 dosing pumps and use Internal Memory par

Post by binder »

Did you initialize the memory locations before trying to use them? I mean, did you set the values to either 0 or to the desired value?
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: I want to use 3 dosing pumps and use Internal Memory par

Post by mudcat1 »

binder wrote:Did you initialize the memory locations before trying to use them? I mean, did you set the values to either 0 or to the desired value?
Yes, I think so. I went into the Memory menu option of the Android application and selected the "Custom Location" selection set the Location to 100 and selected entered 90 for the Byte and Int option (because I was not sure which one that it used), then I hit the "Write value" button.

When I select the "Read value" option it says...
Location 100 for Byte value = 90, Int value = 23130
Location 101 for Byte value = 90, Int value = 15450
Location 102 for Byte value = 60, Int value = 60

The Byte values are the values that I entered. The Int values have been changed for 100 and 101. 102 is correct though.

Does this seem correct?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: I want to use 3 dosing pumps and use Internal Memory par

Post by binder »

You will want to use Byte values. That is how your code is set to read from memory. So make sure the Byte values read the proper values.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: I want to use 3 dosing pumps and use Internal Memory par

Post by mudcat1 »

binder wrote:You will want to use Byte values. That is how your code is set to read from memory. So make sure the Byte values read the proper values.
Curt, I changed the code to use InternalMemory.read_int and now it works correctly.

Example:
ReefAngel.DosingPumpRepeat( Dose_Alk,0,60,InternalMemory.read_int(Dose_Alk_Seconds));

Thanks for your help.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: I want to use 3 dosing pumps and use Internal Memory par

Post by binder »

mudcat1 wrote:
binder wrote:You will want to use Byte values. That is how your code is set to read from memory. So make sure the Byte values read the proper values.
Curt, I changed the code to use InternalMemory.read_int and now it works correctly.

Example:
ReefAngel.DosingPumpRepeat( Dose_Alk,0,60,InternalMemory.read_int(Dose_Alk_Seconds));

Thanks for your help.
ok great. glad you got it working. the only thing that concerns me is that int's use 2 storage locations instead of 1. so your locations should be 100,102,104. However, since your values being stored are so small (less than 255), your code is working properly. i would just keep an eye on it and make sure it continues to work as planned.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: I want to use 3 dosing pumps and use Internal Memory par

Post by mudcat1 »

Curt, it is not working as expected. The values that I originally set are changing which makes me believe I am using memory locations that are already in use by some other standard code (ex 100, 102, 103...). Is there a range of memory locations that are reserved for the standard code? If so, what are they? Is there a range of memory locations that should be used for custom memory?
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: I want to use 3 dosing pumps and use Internal Memory par

Post by mudcat1 »

binder wrote:
mudcat1 wrote:
binder wrote:You will want to use Byte values. That is how your code is set to read from memory. So make sure the Byte values read the proper values.
Curt, I changed the code to use InternalMemory.read_int and now it works correctly.

Example:
ReefAngel.DosingPumpRepeat( Dose_Alk,0,60,InternalMemory.read_int(Dose_Alk_Seconds));

Thanks for your help.
ok great. glad you got it working. the only thing that concerns me is that int's use 2 storage locations instead of 1. so your locations should be 100,102,104. However, since your values being stored are so small (less than 255), your code is working properly. i would just keep an eye on it and make sure it continues to work as planned.
Curt, I changed my code to use "Byte" type as you suggested and it seems to be working now. I also think I found the answer to my other question in one of your other posts on the forum. You said that custom memory location are 0 to 199 and memory locations reserved for standard code are >= 200.

Thanks again for your help.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: I want to use 3 dosing pumps and use Internal Memory par

Post by binder »

mudcat1 wrote: Curt, I changed my code to use "Byte" type as you suggested and it seems to be working now. I also think I found the answer to my other question in one of your other posts on the forum. You said that custom memory location are 0 to 199 and memory locations reserved for standard code are >= 200.

Thanks again for your help.
Cool. Yeah, you are quite welcome.
Post Reply