My colleague Jerome had solved the problem. I forward you his solution. 

Alexander

Begin forwarded message:

> From: Jérôme Guzzi <[email protected]>
> Date: March 18, 2010 9:26:21 AM GMT+01:00
> To: Alexander Förster <[email protected]>
> Cc: Gilles Caprari <[email protected]>
> Subject: Re: [E-puck-user] Sensing e-puck battery charge level
> 
> There is an interrupt (_LVDInterrupt) for low voltage detection on the dspic, 
> see datasheet "Section 9. Low Voltage Detect (LVD)". Below there is my code 
> segment where I implement the event "on_low_battery", which is fired by this 
> interrupt.
> 
> 
> static void init_lvd(){
>       on_low_battery=add_event();
>       on_low_battery->check_function=always_true;
>       set_action(on_low_battery,lowBattery);
> 
>       //set interrupt prority  ->  1
> 
>       IPC10=(IPC10 & 0xFF1F) + 0x0020;        
>       _LVDIE=0;
>       _LVDEN=1;
> 
>       //set voltage threshold  -> 7 (<3.1 V, see datasheet p. 184)
> 
>       RCON=(RCON & 0xF0FF) +0x0700;
>       while(!_BGST);
>       _LVDIF=0;
>       _LVDIE=1;
> }
> 
> void __attribute__((interrupt, auto_psv)) _LVDInterrupt(void)
> {
>       _LVDIF=0;
>       _LVDEN=0;
>       _LVDIE=0;
>       check(on_low_battery);
> }
> 
> //An example action
> 
> void lowBattery(Event *e,void *arg){
>       e_set_led(9,1);
> }
> 
> On Mar 18, 2010, at 7:12 AM, Alexander Förster wrote:
> 
>> Ciao Jerome,
>> 
>> What was your solution? Do you like to answer?
>> 
>> Alexander
>> 
>> 
>> Begin forwarded message:
>> 
>>> From: "Michael Bonani" <[email protected]>
>>> Date: March 17, 2010 10:45:43 PM GMT+01:00
>>> To: "'Francesco Mondada'" <[email protected]>, 
>>> <[email protected]>
>>> Cc: [email protected], 'M O Faruque Sarker' <[email protected]>
>>> Subject: Re: [E-puck-user] Sensing e-puck battery charge level
>>> 
>>>  
>>> Hi,
>>>  
>>> There is also a “batt_low” signal Pin RF1, same signal that made this red 
>>> led blinks. So if you read 1 at this dspic input, battery ok, if 0 battery 
>>> is low.
>>> Strange that it is not in the library.
>>>  
>>>  
>>> Bonani Michael
>>>  
>>>  
>>> From: [email protected] [mailto:[email protected]] On 
>>> Behalf Of Francesco Mondada
>>> Sent: Wednesday, March 17, 2010 9:20 PM
>>> To: [email protected]
>>> Cc: [email protected]; M O Faruque Sarker
>>> Subject: Re: [E-puck-user] Sensing e-puck battery charge level
>>>  
>>> The battery voltage is wired to the handset input (analog input) of the 
>>> codec (si3000). Reading this input (through I2S, not trivial) you should 
>>> get the battery level. Somebody already tried? 
>>>  
>>>                                                                             
>>>                 Francesco
>>>  
>>> On 17 mars 2010, at 18:00, [email protected] wrote:
>>> 
>>> 
>>> 
>>> 
>>> The e-puck tells you when the battery is low(near to the presence led there 
>>> is a small red led that blinks when the battery is low), i think that there 
>>> is no program to do that....
>>> 
>>> On Qua Mar 17 15:46 , M O Faruque Sarker sent:
>>> 
>>> 
>>> Hello all,
>>> 
>>> Does anybody know how to find out the level of  battery charge in e-puck ?
>>> 
>>> It would be interesting  if one can identify from program code  when the 
>>> battery level is critically low (say less than 10% charge).
>>> 
>>> Best regards,
>>> Faruque
>>> -- 
>>> ¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
>>> Md Omar Faruque Sarker
>>> PhD Student,
>>> Robotic Intelligence Lab,
>>> Department of Computing, 
>>> University of Wales, Newport,
>>> Allt-yr-yn Campus, Newport, NP20 5XR, UK
>>> ¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
>>>  
>>> Área de Clientes Clix – Toda a gestão dos seus serviços online! 
>>> http://cliente.clix.pt/. <ATT00001..txt>
>>>  
>>> ------------------------------
>>> Dr. Francesco Mondada
>>> Senior researcher, MER
>>>  
>>> Ecole Polytechnique Fédérale de Lausanne (EPFL)
>>> Laboratoire de Systèmes Robotiques (LSRO)
>>>  
>>> Postal address:
>>> Francesco Mondada 
>>> EPFL  - STI  - IMT - LSRO 
>>> bureau MEB330, Station 9
>>> CH-1015 Lausanne, Switzerland
>>>  
>>> tel: +41 21 693 73 57
>>> fax: +41 21 693 78 07
>>> http://lsro.epfl.ch
>>>  
>>>  
>>>  
>>>  
>>> 
>>> 
>>>  
>>> _______________________________________________
>>> E-puck-user mailing list
>>> [email protected]
>>> https://mail.gna.org/listinfo/e-puck-user
>> 
> 



--
Dr. Alexander Förster
IDSIA - Istituto Dalle Molle di Studi sull'Intelligenza Artificiale
Galleria 2                                   CH-6928 Manno -  Switzerland
Phone: +41 58 666-6714 /-66 35                       Fax: +41 58 666 6661
[email protected]                 http://www.idsia.ch/~alexander





_______________________________________________
E-puck-user mailing list
[email protected]
https://mail.gna.org/listinfo/e-puck-user

Reply via email to