void Error :: Initialize (int16 metacode, char *pid, char *errclass, char *ttext ) { error = 0; tdspl = NO; tlist = NO; thier = NO; meta_error = metacode; error_handle = NULL; error_srce = NULL; throw_exception = NO; Initialize(); ResetError(); if ( errclass ) gvtxbts(err_class,errclass,sizeof(err_class)); if ( pid ) strncpy(proid,pid,sizeof(proid)); if ( ttext ) strncpy(title,ttext,sizeof(title)); }
char *Error :: GetErrorText (void *error_source, const int16 err_code, char *errvar1, char *errvar2, char *errvar3, char *errvar4, char *errvar5, char *errvar6 ) { static RessourceLock res_lock(NO); DWORD threadid = ThreadEntry::GetThreadID(); BEGINSEQ if ( !err_code && thread_id != threadid ) LEAVESEQ res_lock.ILock(); if ( errvar1 ) SetErrorVariable(1,errvar1); if ( errvar2 ) SetErrorVariable(2,errvar2); if ( errvar3 ) SetErrorVariable(3,errvar3); if ( errvar4 ) SetErrorVariable(4,errvar4); if ( errvar5 ) SetErrorVariable(5,errvar5); if ( errvar6 ) SetErrorVariable(6,errvar6); if ( err_code ) SetError(err_code,NULL,NULL); SetupErrText(error_source); ResetError(); res_lock.IUnlock(); ENDSEQ return(text); }
void SSL_Error_Status::TwoWayPointerActionL( TwoWayPointer_Target *action_source, uint32 action_val) { if(action_val == RESET_ERROR_STATUS) ResetError(); }
/** @param lpFilesPath Path of printer driver files @param hParent Handle to parent window @return 0 if succeeded, any other number for error */ int PrinterInstall::Install(LPCTSTR lpFilesPath, HWND hParent, LPTSTR sInstallPath) { // Reset the errors ResetError(); // Do we have a printer name? if (m_sPrinterName.empty()) { // No, can't continue SetError(-2); return m_nError; } // Do we have a folder to read files from? if ((lpFilesPath == NULL) || (_tcslen(lpFilesPath) == 0)) { // No, can't continue SetError(-1); return m_nError; } // Add the port if (!DoAddPort()) return m_nError; // Copy the printer driver files if (!DoCopyFiles(lpFilesPath)) { DoRemoveFiles(); DoDeletePort(hParent); return m_nError; } // Install the printer driver if (!DoInstallPrinterDriver()) { DoRemoveFiles(); DoDeletePort(hParent); return m_nError; } // Finally, add a printer HANDLE hPrinter = DoAddPrinter(); if (hPrinter == NULL) { DoUninstallPrinterDriver(); DoDeletePort(hParent); return m_nError; } // Also, set up the DB and images paths: // Get the printer handle // And set the values CCPrintRegistry::SetRegistryString(hPrinter, _T("DB Path"), ::ConcatPaths(sInstallPath, _T("cc2.db3")).c_str()); CCPrintRegistry::SetRegistryString(hPrinter, _T("Image Path"), ::ConcatPaths(sInstallPath, _T("Images\\")).c_str()); CCPrintRegistry::SetRegistryBool(hPrinter, _T("AutoOpen"), false); ::ClosePrinter(hPrinter); return 0; }
void PopSession::SyncCompleted() { if (m_state == State_SyncingEmails) { m_state = State_OkToSync; } ResetError(); CheckQueue(); }
inline void from_json(const json_t &noise, ResetError &error) { if (JSON::check_key("reset_error", noise)) { // Scalar value is p0, 1-p0 reset error if (noise["reset_error"].is_number()) { double p1 = noise["reset_error"].get<double>(); error = (p1 > 0.) ? ResetError(std::discrete_distribution<>({1 - p1, p1})) : ResetError(); } // node is a vector of reset probs else if (noise["reset_error"].is_array()) { error = ResetError(noise["reset_error"].get<rvector_t>()); } else { throw std::runtime_error(std::string("p_reset error invalid input")); } } else error = ResetError(); }
/** @param nArgs Number of command line arguments @param pArgs Pointer to an array of command line arguments @param bNoUI Reference to a silent command flag, filled upon exit @param lpRelativeDriverFolder Folder name (relative to the current module) where the printer driver files can be found @return true if any command lines variables were detected and acted upon Command line usage: To install the printer: <app.exe> [/NoUI] /InstallPrinter To uninstall the printer: <app.exe> [/NoUI] /UninstallPrinter Note that the object must be initialized for this to work! */ bool PrinterInstall::DoCommandLine(int nArgs, TCHAR** pArgs, bool& bNoUI, LPCTSTR lpRelativeDriverFolder) { // Initialize stuff bNoUI = false; ResetError(); // Go over variables for (int i = 1; i < nArgs; i++) { if (_tcscmp(pArgs[i], PARAM_NOUI) == 0) // NoUI (silent) parameter bNoUI = true; else if (_tcscmp(pArgs[i], PARAM_INSTALLPRINTER) == 0) { // Printer installation: TCHAR cPath[MAX_PATH + 2]; // Retrieve the current module path if (!::GetModuleFileName(NULL, cPath, MAX_PATH + 1)) // Can't?! SetError(-100); else { // Remove the actual module name (we need the folder) TCHAR* pSlash = _tcsrchr(cPath, '\\'); if (pSlash == NULL) SetError(-101); else { // Add the printer driver folder *(pSlash + 1) = '\0'; _tcscat_s(cPath, _S(cPath), lpRelativeDriverFolder); // And install Install(cPath, NULL, cPath); } } // We did something here return true; } else if (_tcscmp(__targv[i], PARAM_REMOVEPRINTER) == 0) { // Printer removal Uninstall(NULL); return true; } } // We didn't do nothing return false; }
static bool HandleError(void *pCodec) { if (!pCodec) return false; const char *error = GetError(pCodec); if (error) { int errCode = SQLITE_ERROR; const char *format = "Botan Error: %s"; sqlite3_log(errCode, format, error); sqlite3ErrorWithMsg((sqlite3*)(GetDB(pCodec)), errCode, format, error); ResetError(pCodec); return true; } return false; }
bool CProto::WriteDataByLocalIdentifier() { TRACE_FUN( Routine, "CProto::WriteDataByLocalIdentifier" ); bool ret( false ); ResetError(); _writeResultCode = wrcNotExecuted; l2max::CByteArray param; l2max::CBuffer paramStream( ¶m ); paramStream.open( l2max::CAbstractIODevice::omWriteOnly ); _abstractMode4->Serialize( paramStream ); l2max::CByteArray resp; if( ret = MakeTransaction( mECUFunc, param, resp ) ) { HAbstractMode4 abstractMode4Clone( _abstractMode4->clone() ); l2max::CBuffer respStream( &resp ); respStream.open( l2max::CAbstractIODevice::omReadOnly ); if( ret = abstractMode4Clone->Deserialize( respStream ) ) { if( *_abstractMode4 == *abstractMode4Clone ) { _writeResultCode = wrcAccept; } else { _writeResultCode = wrcReject; } } else { CAbstractProto::_errorCode = ecBinaryError; _errorCode = ecMode4Deserialization; } } return ret; }
void PopSession::Connected() { if (m_account->GetEncryption() == PopAccount::SOCKET_ENCRYPTION_TLS) { m_state = State_CheckTlsSupport; } else { m_state = State_UsernameRequired; } // if there was an connection error, reset it if (HasNetworkError()) { ResetError(); } MojLogInfo(m_log, "Connected to POP server. Need to send username."); CheckQueue(); }
bool CProto::StartDiagnosticSession() { TRACE_FUN( Routine, "CProto::StartDiagnosticSession" ); bool ret( false ); ResetError(); l2max::CByteArray resp; if( ret = MakeTransaction( mReturnToNormal, l2max::CByteArray(), resp ) ) { ret = !resp.size(); } return ret; }
Error :: Error ( ) : sts (), error(0), tdspl(NO), tlist(NO), thier(NO), meta_error(UNDEF), error_handle(NULL), error_srce(NULL), throw_exception(NO) { Initialize(); ResetError(); *proid = 0; *err_class = 0; *title = 0; }
/** @param hParent Handle to the parent window @return 0 if succeeded, any other number for error */ int PrinterInstall::Uninstall(HWND hParent) { // Reset the previous error, if any ResetError(); // Do we have a printer name? if (m_sPrinterName.empty()) { // No, can't continue SetError(-2); return m_nError; } // Try to remove all printers that use this driver if (!DoRemovePrinters()) { // Can't, just try the rest of the stuff and fail DoUninstallPrinterDriver(); DoDeletePort(hParent); return m_nError; } // Remove the printer driver itself if (!DoUninstallPrinterDriver()) { // Can't int nRet = m_nError; DoDeletePort(hParent); return m_nError; } // And finally, the port monitor if (!DoDeletePort(hParent)) return m_nError; return 0; }
bool CProto::ReadDataByLocalIdentifier() { TRACE_FUN( Routine, "CProto::ReadDataByLocalIdentifier" ); bool ret( false ); ResetError(); l2max::CByteArray param; l2max::CBuffer paramStream( ¶m ); paramStream << ( unsigned char )( 0x00 ); l2max::CByteArray resp; if( ret = MakeTransaction( mTransmitData, param, resp ) ) { l2max::CBuffer respStream( &resp ); respStream.open( l2max::CAbstractIODevice::omReadOnly ); if( ret = _abstractMode1Data0->Deserialize( respStream ) ) { if( !_abstractMode4.IsNull() ) { _abstractMode4->Synchronize(); } } else { CAbstractProto::_errorCode = ecBinaryError; _errorCode = ecMode1Data0Deserialization; } } return ret; }
int main(void) { unsigned char Arg0; //if DDRX,X=1 PORTX,X=OUT DDRA=0x61; PORTA = 0xff;//0xc0 prov DDRB=0x68; PORTB = 0xff; DDRC=0xfc; PORTC =0xff; DDRD=0xfe; PORTD=0xf7; TCCR2=0; TCCR1A=0; TCCR0=0; //INIT TWI; TWBR=0x7f;//F TWI TCCR1B=0x2;//0.5mkc TIMSK=TIMSK | 0x4;//enable Int overlowT1 TWAR=(NumberLink<<1)+4; TWCR =(1<<TWEA)|(1<<TWEN); _SEI(); for(Arg0=1;Arg0<=10;++Arg0) RomReceive[Arg0]=0; CtEeprom=1; RegimWork=0x10;//avt vent CtErrorLink=CtErrorLink0; CtKn=5; ResetError(); //WORK while(1) { _WDR(); if(RomReceive[3] & 0x1) ResetError(); SetError(); SetRegimError(); ControlRegim(); ControlPech(); if(RomReceive[1] & 1) OpenLuk1(); else if(RomReceive[2] & 1) CloseLuk1(); else PORTC |=0xc; if(RomReceive[1] & 2) OpenLuk2(); else if(RomReceive[2] & 2) CloseLuk2(); else { PORTC |=0x10; PORTB |=0x8; } ControlLed(); ControlRevun(); if(EnableLoad) { LoadRegTransmit(); LoadControlSum(); } if(TWCR & 0x80) { ReceiveTransmitSlave(); ++TestTransmit; } if(!CtErrorLink)//ErrorLink; { //INIT TWI; TWBR=0;//F TWI TWAR=0; TWCR =0; TWSR=0xf8; CtStart=50; while(CtStart--) _WDR(); TWBR=0x7f;//F TWI TWAR=(NumberLink<<1)+4; TWCR =(1<<TWEA)|(1<<TWEN); // TWCR |=(1<<TWINT); CtErrorLink=CtErrorLink0; CtStart=200; while(CtStart--) _WDR(); } } }
VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv) { char exe_path[MAX_PATH]; char config_dir[MAX_PATH]; char ext_string[16]; char log_dir[MAX_PATH]; char priority_string[64]; char append_string[2]; DWORD priority; bool append; ResetError (); if (!ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 3000)) { MSG (M_ERR, "ReportStatusToSCMgr #1 failed"); goto finish; } /* * Create our exit event */ exit_event = create_event (EXIT_EVENT_NAME, false, false, true); if (!exit_event) { MSG (M_ERR, "CreateEvent failed"); goto finish; } /* * If exit event is already signaled, it means we were not * shut down properly. */ if (WaitForSingleObject (exit_event, 0) != WAIT_TIMEOUT) { MSG (M_ERR, "Exit event is already signaled -- we were not shut down properly"); goto finish; } if (!ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 3000)) { MSG (M_ERR, "ReportStatusToSCMgr #2 failed"); goto finish; } /* * Read info from registry in key HKLM\SOFTWARE\OpenVPN */ { HKEY openvpn_key; LONG status; DWORD len; DWORD type; char error_string[256]; static const char error_format_str[] = "Error querying registry key of type REG_SZ: HKLM\\" REG_KEY "\\%s"; static const char error_format_dword[] = "Error querying registry key of type REG_DWORD: HKLM\\" REG_KEY "\\%s"; status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, REG_KEY, 0, KEY_READ, &openvpn_key); if (status != ERROR_SUCCESS) { SetLastError (status); MSG (M_SYSERR, "Registry key HKLM\\" REG_KEY " not found"); goto finish; } /* get path to openvpn.exe */ QUERY_REG_STRING ("exe_path", exe_path); /* get path to configuration directory */ QUERY_REG_STRING ("config_dir", config_dir); /* get extension on configuration files */ QUERY_REG_STRING ("config_ext", ext_string); /* get path to log directory */ QUERY_REG_STRING ("log_dir", log_dir); /* get priority for spawned OpenVPN subprocesses */ QUERY_REG_STRING ("priority", priority_string); /* should we truncate or append to logfile? */ QUERY_REG_STRING ("log_append", append_string); RegCloseKey (openvpn_key); } /* set process priority */ priority = NORMAL_PRIORITY_CLASS; if (!strcasecmp (priority_string, "IDLE_PRIORITY_CLASS")) priority = IDLE_PRIORITY_CLASS; else if (!strcasecmp (priority_string, "BELOW_NORMAL_PRIORITY_CLASS")) priority = BELOW_NORMAL_PRIORITY_CLASS; else if (!strcasecmp (priority_string, "NORMAL_PRIORITY_CLASS")) priority = NORMAL_PRIORITY_CLASS; else if (!strcasecmp (priority_string, "ABOVE_NORMAL_PRIORITY_CLASS")) priority = ABOVE_NORMAL_PRIORITY_CLASS; else if (!strcasecmp (priority_string, "HIGH_PRIORITY_CLASS")) priority = HIGH_PRIORITY_CLASS; else { MSG (M_ERR, "Unknown priority name: %s", priority_string); goto finish; } /* set log file append/truncate flag */ append = false; if (append_string[0] == '0') append = false; else if (append_string[0] == '1') append = true; else { MSG (M_ERR, "Log file append flag (given as '%s') must be '0' or '1'", append_string); goto finish; } /* * Instantiate an OpenVPN process for each configuration * file found. */ { WIN32_FIND_DATA find_obj; HANDLE find_handle; BOOL more_files; char find_string[MAX_PATH]; mysnprintf (find_string, "%s\\*", config_dir); find_handle = FindFirstFile (find_string, &find_obj); if (find_handle == INVALID_HANDLE_VALUE) { MSG (M_ERR, "Cannot get configuration file list using: %s", find_string); goto finish; } /* * Loop over each config file */ do { HANDLE log_handle = NULL; STARTUPINFO start_info; PROCESS_INFORMATION proc_info; struct security_attributes sa; char log_file[MAX_PATH]; char log_path[MAX_PATH]; char command_line[256]; CLEAR (start_info); CLEAR (proc_info); CLEAR (sa); if (!ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 3000)) { MSG (M_ERR, "ReportStatusToSCMgr #3 failed"); FindClose (find_handle); goto finish; } /* does file have the correct type and extension? */ if (match (&find_obj, ext_string)) { /* get log file pathname */ if (!modext (log_file, sizeof (log_file), find_obj.cFileName, "log")) { MSG (M_ERR, "Cannot construct logfile name based on: %s", find_obj.cFileName); FindClose (find_handle); goto finish; } mysnprintf (log_path, "%s\\%s", log_dir, log_file); /* construct command line */ mysnprintf (command_line, PACKAGE " --service %s 1 --config \"%s\"", EXIT_EVENT_NAME, find_obj.cFileName); /* Make security attributes struct for logfile handle so it can be inherited. */ if (!init_security_attributes_allow_all (&sa)) { MSG (M_SYSERR, "InitializeSecurityDescriptor start_" PACKAGE " failed"); goto finish; } /* open logfile as stdout/stderr for soon-to-be-spawned subprocess */ log_handle = CreateFile (log_path, GENERIC_WRITE, FILE_SHARE_READ, &sa.sa, append ? OPEN_ALWAYS : CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (log_handle == INVALID_HANDLE_VALUE) { MSG (M_SYSERR, "Cannot open logfile: %s", log_path); FindClose (find_handle); goto finish; } /* append to logfile? */ if (append) { if (SetFilePointer (log_handle, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER) { MSG (M_SYSERR, "Cannot seek to end of logfile: %s", log_path); FindClose (find_handle); goto finish; } } /* fill in STARTUPINFO struct */ GetStartupInfo(&start_info); start_info.cb = sizeof(start_info); start_info.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; start_info.wShowWindow = SW_HIDE; start_info.hStdInput = GetStdHandle(STD_INPUT_HANDLE); start_info.hStdOutput = start_info.hStdError = log_handle; /* create an OpenVPN process for one config file */ if (!CreateProcess(exe_path, command_line, NULL, NULL, TRUE, priority | CREATE_NEW_CONSOLE, NULL, config_dir, &start_info, &proc_info)) { MSG (M_SYSERR, "CreateProcess failed, exe='%s' cmdline='%s' dir='%s'", exe_path, command_line, config_dir); FindClose (find_handle); CloseHandle (log_handle); goto finish; } /* close unneeded handles */ Sleep (1000); /* try to prevent race if we close logfile handle before child process DUPs it */ if (!CloseHandle (proc_info.hProcess) || !CloseHandle (proc_info.hThread) || !CloseHandle (log_handle)) { MSG (M_SYSERR, "CloseHandle failed"); goto finish; } } /* more files to process? */ more_files = FindNextFile (find_handle, &find_obj); } while (more_files); FindClose (find_handle); } /* we are now fully started */ if (!ReportStatusToSCMgr(SERVICE_RUNNING, NO_ERROR, 0)) { MSG (M_ERR, "ReportStatusToSCMgr SERVICE_RUNNING failed"); goto finish; } /* wait for our shutdown signal */ if (WaitForSingleObject (exit_event, INFINITE) != WAIT_OBJECT_0) { MSG (M_ERR, "wait for shutdown signal failed"); } finish: ServiceStop (); if (exit_event) CloseHandle (exit_event); }
int main(void) { DDRA=0; PORTA=0; DDRB=0xb2; PORTB |= 0xf3;// Control UAB DDRC=0x2a; PORTC |=0x2a; DDRD=0xc7; PORTD=0xff;/*Reset=on*/ // INIT SPI SPSR=0;//f/64 SPCR=0x72; SPCR |=0x80;//enable Int SPI InitAd(); TCCR1A=0;//0x82; TCCR1B=0x2;//0.5mks // TIMSK=TIMSK | 0x20;//enable Int capture1 TIMSK=TIMSK | 0x4;//enable Int overlowT1 /*Interrupt1*/ // MCUCR=0x8;// Log1>0 Int1 // GICR |=(1<<INT1);/*Enable INT1*/ /*Timer0*/ TCCR0=0x61;//0x61;//1;//1; OCR0=0xe0; // TIMSK |=1;/*Enable Int Overlow Timer0*/ /*Timer2*/ TCCR2=0x4; TIMSK |=(1<<TOIE2);/*Enable Int Overlow Timer2*/ CtSetka=0; _SEI(); RegimWork=0; ResetError(); CtStart=50; RevunOff=0; // ClearRomReceive(); /*Work program*/ while(1) { _WDR(); if(!CtIndAd) { // IndicatorAd(2); CtIndAd=30; } ReadKn(); if(RegS & 0x10) ResetError(); ChangeRegim(); ControlRevun(); ControlMPP(); ControlPogar(); ControlNorma(); Indicator(); IndicatorAll(); SetRegimError(); SetError(); // DecSegm(RegS); // IndicatorSegment(); if(Error) PORTD |=0x40;//Error else PORTD &=0xbf;//Norma } }
CFile::CFile(const CString& sLongName) { m_iFD = -1; ResetError(); SetFileName(sLongName); }
CFile::CFile() { m_iFD = -1; ResetError(); }
CHttpClient::CHttpClient(const wchar_t *app_name) { ResetError(); hSession = WinHttpOpen(app_name? app_name:L"NVIDIA HTTP Client", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); }
int main(void) { DDRA=0; PORTA=0xf4; DDRB=0xe6; PORTB |= 0xf3;// Control UAB DDRC=0xf; PORTC |=0xff; DDRD=0x1a; PORTD=0xff;/*Reset=on*/ // INIT SPI SPSR=0;//f/64 SPCR=0x72; SPCR |=0x80;//enable Int SPI //INIT USART InitUsart(); TCCR1A=0;//0x82; TCCR1B=0x2;//0.5mks // TIMSK=TIMSK | 0x20;//enable Int capture1 TIMSK=TIMSK | 0x4;//enable Int overlowT1 /*Interrupt1*/ // MCUCR=0x8;// Log1>0 Int1 // GICR |=(1<<INT1);/*Enable INT1*/ /*Timer0*/ TCCR0=0x61;//0x61;//1;//1; OCR0=0xe0; // TIMSK |=1;/*Enable Int Overlow Timer0*/ /*Timer2*/ TCCR2=0x4; TIMSK |=(1<<TOIE2);/*Enable Int Overlow Timer2*/ CtSetka=0; _SEI(); RegimWork=0; ResetError(); CtStart=50; // ClearRomReceive(); /*Work program*/ while(1) { _WDR(); if(CtStart) { if(NumberBlok==1) { RegimWork=(RomReceiveRS[2][2]<<8) & 0xeff; RegimWork |=RomReceiveRS[1][2]; if(RegSWork & 0x100) RegimWork |=0x100; } else { RegimWork=(RomReceiveRS[2][1]<<8) & 0xeff; RegimWork |=RomReceiveRS[1][1]; if(RegSWork & 0x100) RegimWork |=0x100; } if(RegS1 & 1) NumberBlok=2; else NumberBlok=1; } else { if(NumberBlok==1) { /* if((RomReceiveRS[2][2] & 1)&&(!(Error & 4))) { RegimWork=(RomReceiveRS[2][2]<<8) & 0xeff; RegimWork |=RomReceiveRS[1][2]; } else*/ ChangeRegim(); } /* else { if((RomReceiveRS[2][1] & 1)&&(!(Error & 2))) { RegimWork=(RomReceiveRS[2][1]<<8) & 0xeff; RegimWork |=RomReceiveRS[1][1]; } else ChangeRegim(); }*/ } SetError(); SetRegTransmitRS(); { SetRegSegmentOn(); SetRegSegmentMig(); } IndicatorSegment(); ControlRevun(); } }
int main(void) { DDRA=0; PORTA=0; DDRB=0xbc; PORTB |= 0xff; DDRC=0x1c; // PORTC |=0xff; DDRD=0xba; PORTD=0xff; //INIT TWI; TWBR=0x7f;//F TWI CtStart=65000; while(CtStart--) _WDR(); //Init capture1 TCCR1B=0x82;//0.5mkc,falling edge TIMSK=TIMSK | 0x4;//enable Int overlowT1 // INIT SPI SPCR=0x72;//f/64 SPSR=0;//f/64 InitAd(); MCUCR=0; TCCR0=5;// /1024 ASSR=0; TCCR2=2;// T=0,5 mkc ASSR=0; NumberLink=1; CtUsart=NumberBlok; ResetError(); URef=ReadEepromWord(8); if(URef>275) URef=256; if(URef<230) URef=256; _SEI(); while(1) { _WDR(); ChangeRegimTest(); ControlOut(); CalcTM(); LoadIndicator(); SetRegimErrorLuk(); SetErrorLuk(); if(RomReceiveRS[5][3] & 4) ResetError(); else if(RomReceiveRS[5][6] & 4) ResetError(); else { RegTransmit[3][1] &=0xdf; RegTransmit[3][2] &=0xfe; } SetError(); if(RomReceiveRS[6][3] & 0x80) { RegTransmit[1][2]=0; RegTransmit[2][2] &=0xfe; } else ControlLuk(); if(!CtErrorLink[0]) { //INIT TWI; TWBR=0;//F TWI TWAR=0; TWCR =0; TWSR=0xf8; TWBR=0x7f;//F TWI CtStart=65000; while(CtStart--) _WDR(); CtErrorLink[0]=CtErrorLink0; CtErrorLink[1]=CtErrorLink0; CtErrorLink[2]=CtErrorLink0; } if(!CtErrorLink[1]) { //INIT TWI; TWBR=0;//F TWI TWAR=0; TWCR =0; TWSR=0xf8; TWBR=0x7f;//F TWI CtStart=65000; while(CtStart--) _WDR(); CtErrorLink[0]=CtErrorLink0; CtErrorLink[1]=CtErrorLink0; CtErrorLink[2]=CtErrorLink0; } if(!CtErrorLink[2]) { //INIT TWI; TWBR=0;//F TWI TWAR=0; TWCR =0; TWSR=0xf8; TWBR=0x7f;//F TWI CtStart=65000; while(CtStart--) _WDR(); CtErrorLink[0]=CtErrorLink0; CtErrorLink[1]=CtErrorLink0; CtErrorLink[2]=CtErrorLink0; } ReadKn(); if(NumberLink) --NumberLink; else NumberLink=2; LoadRegTransmit(); ReceiveTransmitMaster(); } }