Forum - MCS Electronics

 Holding a value in a variable. Goto page Previous  1, 2
Author Message
Arera

Joined: 23 Sep 2007
Posts: 375
Location: Wuppertal, Germany

Posted: Tue Sep 15, 2015 6:58 am    Post subject:

 Quote: V2 and V1 cant be differentiated as both are reading the same adc and cell.

But you GET V1 without load, then switch on the load, then GET V2, right?

Now threr are 8 cells; I STILL don't get what you are trying to achieve...
naseerak

Joined: 08 Nov 2008
Posts: 138

 Posted: Tue Sep 15, 2015 8:04 am    Post subject: Arera you are a nice person by taking intrest in this thread...the story is 1. Cell_reading: C1raw = Getadc(0) C1v = C1raw C1v = C1v * 5 ' to adjust it according to the measured voltage on aref pin C1v = C1v / 1024 this way I am reading 8 cells. right? (cell reading is a sub) 2. V1=C1v ok? The load is switched on and the cell starts to discharges now V2 = C1v ok? the C1v is also decremented due to load and I have to find V1-V2 to find DELTA_V, to find the discharge time in lets say 10minuts, now how much time the cell would take to reach 3.3V? 3. V1-V2/6.8(loadresistor) ok? V1 and V2 are the same sequences in reading the cell voltage, but V1-V2 = 0 being both equal due to 2.(see index) 4. as i mentioned earlier, how to keep V1 in such away that it does,nt changes till i read V2 too. 5. the slope of the DELTA v is actually the internal resistance of the cell which i want to find.. and the mAH capicity too. 6. the problem here is for 1 cell only if that is solved the other 7 will also be solved no problem as you know. 7. I have set up the timer with 32khz cystal and is working fine. hope fully i have made my self clear? Regards and thanks again
Arera

Joined: 23 Sep 2007
Posts: 375
Location: Wuppertal, Germany

 Posted: Tue Sep 15, 2015 9:03 am    Post subject: Hmmmm.... If you need to handle 8 cells having 2 values (load on/off), I'd expect 16 variables! Vcell1_off Vcell1_on Vcell2_off . . . Vcell8_on to keep it simple in the first attempt, I'd not use a sub, but go on step by step in the main loop: handle cell1 .. handle cell8 After getting this to work, you could think about using arrays and subs and MOD-counters, to make the code more elegant.
Meister

Joined: 27 May 2010
Posts: 314

 Posted: Tue Sep 15, 2015 10:48 am    Post subject: Seems that we all do not really understand your problem. Why not simply like this similar to the previous post: V11=getadc V12=getadc .... wait for 10 minutes V21=getadc v22=getadc DeltaV1=v11-v21 DeltaV2=V12-V22 ....
Arera

Joined: 23 Sep 2007
Posts: 375
Location: Wuppertal, Germany

 Posted: Tue Sep 15, 2015 12:23 pm    Post subject: yes I agree with MEISTER, extra vars for the Results are needed, and shure even some more. Be generous with vars, there are a lot of then avaliable in most chips... I guess the TO cannot see the wood for the trees...
naseerak

Joined: 08 Nov 2008
Posts: 138

 Posted: Tue Sep 15, 2015 6:25 pm    Post subject: V11 will also equal to V12 after 10 minutes, we need to hold the V11 some where temporarily at least for one session..
Meister

Joined: 27 May 2010
Posts: 314

 Posted: Tue Sep 15, 2015 9:35 pm    Post subject: Are you making jokes with us?? Do you think V11 is permantly tied to getadc? Otherwise I can't understand your question. V11 is measured once. You can measure the other ones as often as you like, V11 will not be affected anymore. DeltaV1=v11-v21: v11 is the value assigned to by the first statement and will not be changed if getadc changes.
Arera

Joined: 23 Sep 2007
Posts: 375
Location: Wuppertal, Germany

 Posted: Tue Sep 15, 2015 10:05 pm    Post subject: Ok, we are shifting from SW to HW. If V11 equals V12, and that is not what you expect, you need to find out what is going wrong. HW could have an error. SW could have errors. Your expectations could be false. Any mixtures of the three. Meister is right: V11 can only change by overwriting it, or by switching off power. Else it will keep its value for ever. You should not doubt V11, but your HW,SW and first of all your electrical knowledge. You mentioned capacity and inner resitance of cells. You cannot measure one of them in ten minutes. Ri needs to be measured very quickly. Capacity is very tricky to measure at all. Regarding Ri: what values do you expect. How do you measure? What is the used load and why? How does your measurement affect the outcome?
Visovian

Joined: 31 Oct 2007
Posts: 584
Location: Czech

Posted: Tue Sep 15, 2015 11:38 pm    Post subject:

 Quote: hope fully i have made my self clear?

Not at least.

Are you trying to measure a battery of 8 serially connected cells?
And you want to measure the internal resistance of each cell without disconnecting them, right?
naseerak

Joined: 08 Nov 2008
Posts: 138

 Posted: Wed Sep 16, 2015 5:39 am    Post subject: I am using proteus, so no HW error, in my setup both voltages are changing as they are tied to the same adc..
Arera

Joined: 23 Sep 2007
Posts: 375
Location: Wuppertal, Germany

 Posted: Wed Sep 16, 2015 7:17 am    Post subject: My last attempt: g show us at least a snippet of code that shows how you measure V11 and V12, and how getting V12 affects the content of V11.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT + 1 HourGoto page Previous  1, 2 Page 2 of 2

 Jump to: Select a forum BASCOM AVR/8051----------------BASCOM-AVRBASCOM-8051BASCOM-ARDUINOShare your working BASCOM-8051 code hereShare your working BASCOM-AVR code hereBASCOM BETA-SLA BASCOM Related----------------EASY TCP/IPAVR-DOSAR7212KokkeKat FAT-free SD card libBASCOM Project Blog Other Stuff----------------VariousPCB'sRoboticsNew WebSiteAnnouncementsAVR Archive----------------BASCOM-AVR ArchiveBASCOM-8051 ArchiveBASCOM-AVR Unsupported versionsEasy TCP/IP ArchiveBASCOM-EDB
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum