#include #include #include "8000.h" #include "i8091.h" #define VERSION_1 1 #define VERSION_2 0 /* Flashdaten haben sich geändert */ #define VERSION_3 2 /* Größere Änderung */ #define VERSION_4 6 /* Fehlerbereinigung + kleinere Änderungen */ #define TIMER_HEAD_POS 7 int CtrSendAnalog; long unsigned int Restzeit; void main (int argc, char *argv[]); void Init8091 (void); void Clear5DigitLED(void); void main (int argc, char *argv[]) { int tt; // EnableWDT (); TimerOpen (); Clear5DigitLED(); Show5DigitLed(2,VERSION_1); Show5DigitLed(3,VERSION_2); Show5DigitLed(4,VERSION_3); Show5DigitLed(5,VERSION_4); CountDownTimerStart(1,1000); RefreshWDT (); Init8091(); RefreshWDT (); CountDownTimerReadValue(1,&Restzeit); while (Restzeit > 0) { RefreshWDT (); CountDownTimerReadValue(1,&Restzeit); } Clear5DigitLED(); CountDownTimerStart(TIMER_HEAD_POS,100); /********************************************************************************************* /********************************************************************************************* /** /** MainLoop /** /** /********************************************************************************************* /********************************************************************************************* */ while (!Kbhit()) { CountDownTimerReadValue(TIMER_HEAD_POS,&Restzeit); if (Restzeit == 0) { CountDownTimerStart(TIMER_HEAD_POS,100); // // // i8091_STOP_X(1); //when I delete this line, it doesn't reboot // // // CtrSendAnalog ++; if (CtrSendAnalog >= 10) CtrSendAnalog = 0; for (tt=0; tt<10000; tt++) Show5DigitLed(1,CtrSendAnalog); } RefreshWDT (); } } /********************************************************************************************* /********************************************************************************************* /** /** I N I T 8 0 9 1 /** /** /********************************************************************************************* /********************************************************************************************* */ void Init8091 (void) { /* i8091_REGISTRATION(7,0x1A0); i8091_RESET_SYSTEM (7); i8091_SET_NC(7,0x16); i8091_SET_VAR (7,250,2,10,100); i8091_SET_DEFDIR (7,0,0); i8091_SET_MODE (7,1,1); i8091_SET_SERVO_ON (7,1,0); */ i8091_REGISTRATION(1,0x0A0); i8091_RESET_SYSTEM (1); i8091_SET_NC(1,0x16); i8091_SET_VAR (1,250,2,10,100); i8091_SET_DEFDIR (1,0,0); i8091_SET_MODE (1,1,1); i8091_SET_SERVO_ON (1,1,0); } void Clear5DigitLED(void) { Show5DigitLed(1,16); Show5DigitLed(2,16); Show5DigitLed(3,16); Show5DigitLed(4,16); Show5DigitLed(5,16); }