Hallo topgunfb,
CHARGE.BAS ... Gibt es eine "Adaption" für die CC2?
Ja, charge.c2
Code:
/******************************************************************************/
/*        Akku-Ladeprogramm für CCRP5.C2 (SYSTEMTREIBER V2 FÜR CCRP5)         */
/******************************************************************************/
/* Autor     :       Dirk Ottensmeyer                                         */
/* Versionen :       2.3                                                      */
/* Datum     :       24. Juli 2005                                            */
/* Getestet  :       ja                                                       */
/*----------------------------------------------------------------------------*/
/* Bemerkung :   Laden Sie das Programm "Gateway_2.bas" in die C-Control I    */
/*               auf dem Roboter. Die Kommunikation zwischen CCRP5 und der    */
/*               CC2 erfolgt über SWCOM und die ser. Schnittstelle des CCRP5. */
/*               Ein spezieller "COMMAND-INTERPRETER" in GATEWAY_2 wertet die */
/*               übertragenen Kommandos aus und sendet die angeforderten Daten*/
/*               oder führt angeordnete Operationen aus (z.B. LED einschalten)*/
/*                                                                            */
/*               !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   */
/*               Beachten Sie bitte, dass die meisten Programme Werte auf das */
/*               als Zubehör erhältliche LCD ausgeben. Es ist kompatibel zum  */
/*               LCD des Applicationboard I u. II                             */
/*               !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   */
/*                                                                            */
/*----------------------------------------------------------------------------*/
/*NOTES:         Load the program "Gateway_2.bas" into the C-Control I.       */
/*               The communication between the robot and the C-Control II     */
/*               computer is done via SWCOM ond the CCRP5 serial interface.   */
/*               The COMMAND INTERPRETER located in GATEWAY_2 executes the    */
/*               requests and performs required actions (e.g. switching a LED)*/
/*                                                                            */
/*               !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   */
/*               Please note that most of the programs use the external LCD   */
/*               which is available as addon. It is compatible to the LCD     */
/*               of C-Control Applicationboard I and II                       */
/*               !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   */
/*                                                                            */
/*----------------------------------------------------------------------------*/
/*Aufgabe des Programms:                                                      */
/*        Das Programm dient zur Überwachung des Akku-Ladevorgangs und zeigt  */
/*        permanent die Akkuspannung in Volt und in der zweiten Zeile den     */
/*        Ladestrom als Bargraph (39 mA pro Einheit) auf dem LC-Display an.   */
/*        Ab einer Spannung von 8,4 Volt ist der Akku voll geladen. Dies wird */
/*        mit der Meldung "AKKU GELADEN!!" und einem Ton angezeigt.           */
/******************************************************************************/
//-------------------------------------------------------
//---          SHOW THE CHARGING PROCESS              ---
//-------------------------------------------------------
function showCHARGING()
{
float SYSVOLTS,CHRCURRENT;
string s;
         loop
         {
           ccrp5.getSYSTEMDATA();
           if ccrp5.SYSVOLTS > ccrp5.CHRCURRENT
             {ccrp5.CHRCURRENT=ccrp5.SYSVOLTS;}
           SYSVOLTS=ccrp5.SYSVOLTS*0.039;
           CHRCURRENT=ccrp5.CHRCURRENT-ccrp5.SYSVOLTS;
           s="";str.putfloatf(s,SYSVOLTS,2);
           lcdext.home();lcdext.print("AKKU: ");
           lcdext.print(s);lcdext.print(" [V]    ");
           lcdext.line(2);
           if SYSVOLTS < 8.4 {lcdext.bargraph(5*CHRCURRENT,75);} //39 mA /unit
           else {lcdext.print(" AKKU GELADEN!!");ccrp5.BEEP(368,1);}
           sleep (2000);
         }
}
//IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
//IIIIIII              THREAD                      IIIIII
//IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
thread main
{
//string s;
int VALUE;
//ports.set(11,0);ports.set(12,1);swcom.init();swcom.setspeed(5);
          VALUE=ccrp5.init();
          lcdext.clear();
// ------------- START MESSAGE -------------------------
          lcdext.print("C-CONTROL ROBOT");
          lcdext.line(2);
          lcdext.print(" AKKU-LADER 2.2");sleep 1000;
          lcdext.clear();
          if VALUE==0 {lcdext.print("CC1 RESET");sleep 200;lcdext.clear();}
//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

//---------- Zeigt Akkuspannung und Ladestrom während des Ladens an ------------
//   Wenn der Akku voll geladen ist, erscheint anstelle der Ladestromanzeige
//   die Meldung "AKKU GELADEN!!", und es ertönt ein Beep 0,5x/Sekunde. Der
//   Stecker des Ladegeräts muss dann abgezogen werden, um eine Überladung des
//   Akkus zu vermeiden!
          showCHARGING();
}
Gruß Dirk