Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Holding a value in a variable.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Arera

Bascom Member



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

germany.gif
PostPosted: Tue Sep 15, 2015 6:58 am    Post subject: Reply with quote

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...
Back to top
View user's profile
naseerak

Bascom Member



Joined: 08 Nov 2008
Posts: 138

pakistan.gif
PostPosted: Tue Sep 15, 2015 8:04 am    Post subject: Reply with quote

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
Back to top
View user's profile
Arera

Bascom Member



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

germany.gif
PostPosted: Tue Sep 15, 2015 9:03 am    Post subject: Reply with quote

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.
Back to top
View user's profile
Meister

Bascom Member



Joined: 27 May 2010
Posts: 314

PostPosted: Tue Sep 15, 2015 10:48 am    Post subject: Reply with quote

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
....
Back to top
View user's profile
Arera

Bascom Member



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

germany.gif
PostPosted: Tue Sep 15, 2015 12:23 pm    Post subject: Reply with quote

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...
Back to top
View user's profile
naseerak

Bascom Member



Joined: 08 Nov 2008
Posts: 138

pakistan.gif
PostPosted: Tue Sep 15, 2015 6:25 pm    Post subject: Reply with quote

V11 will also equal to V12 after 10 minutes, we need to hold the V11 some where temporarily at least for one session..
Back to top
View user's profile
Meister

Bascom Member



Joined: 27 May 2010
Posts: 314

PostPosted: Tue Sep 15, 2015 9:35 pm    Post subject: Reply with quote

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.
Back to top
View user's profile
Arera

Bascom Member



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

germany.gif
PostPosted: Tue Sep 15, 2015 10:05 pm    Post subject: Reply with quote

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?
Back to top
View user's profile
Visovian

Bascom Member



Joined: 31 Oct 2007
Posts: 584
Location: Czech

czechrepublic.gif
PostPosted: Tue Sep 15, 2015 11:38 pm    Post subject: Reply with quote

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?
Back to top
View user's profile
naseerak

Bascom Member



Joined: 08 Nov 2008
Posts: 138

pakistan.gif
PostPosted: Wed Sep 16, 2015 5:39 am    Post subject: Reply with quote

I am using proteus, so no HW error, in my setup both voltages are changing as they are tied to the same adc..
Back to top
View user's profile
Arera

Bascom Member



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

germany.gif
PostPosted: Wed Sep 16, 2015 7:17 am    Post subject: Reply with quote

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. Rolling Eyes
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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
You cannot download files in this forum