本文整理汇总了C++中ClrWdt函数的典型用法代码示例。如果您正苦于以下问题:C++ ClrWdt函数的具体用法?C++ ClrWdt怎么用?C++ ClrWdt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ClrWdt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: taskExecuter
void taskExecuter(void *param)
{
printf(">>[Executer] Started\n");
ExeCmd RunCmd;
int cmdStat, queueStat, cmdParam;
while(1)
{
/* Read the CMD that Dispatcher sent - BLOCKING */
queueStat = xQueueReceive(executerCmdQueue, &RunCmd, portMAX_DELAY);
if(queueStat == pdPASS)
{
printf("[Executer] Running a command...\n");
/* Commands may take a long time, so reset the WDT */
ClrWdt();
/* Execute the command */
cmdParam = RunCmd.param;
cmdStat = RunCmd.fnct((void *)&cmdParam);
/* Commands may take a long time, so reset the WDT */
ClrWdt();
printf("[Executer] Command result: %d\n", cmdStat);
/* Send the result to Dispatcher - BLOCKING */
xQueueSend(executerStatQueue, &cmdStat, portMAX_DELAY);
}
}
}
示例2: SystemPwrSave
// Sleep mode - External peripherals all allowed to run unless specified
void SystemPwrSave(unsigned short NapSetting)
{
//KL WARNING - modified for simpler behaviour, manage your own interrupt wake sources
uint16_t IPLshadow; // Interrupt context saving
IPLshadow = SRbits.IPL;
SRbits.IPL = 0b111; // Stop all interrupts from vectoring
/*Note: Add/remove power down settings as needed*/
U1PWRCbits.USBPWR = 0; // MCHP Bug, not cleared in usb detach +120uA
// Wdt
if (NapSetting & WAKE_ON_WDT)
{ClrWdt();RCONbits.SWDTEN = 1;} // Turn on WDT
// Go to sleep... zzzzzzzzzzzzzz
if(NapSetting & LOWER_PWR_SLOWER_WAKE) RCONbits.PMSLP = 0;
else RCONbits.PMSLP = 1;
Sleep();
__builtin_nop();
// ON RETURN FROM SLEEP
if (NapSetting & WAKE_ON_WDT)
{ClrWdt();RCONbits.SWDTEN = 0;} // Turn off WDT
SRbits.IPL = IPLshadow; // Effectively re-enable ints - will vector if flags are set!
return ;
}
示例3: drp_debug5
void drp_debug5(void){
int value=0, res=0;
unsigned int index;
printf("dat_reset_Payload_Buff()..\n");
int pay_i; int lenBuff=10, r_nextIndx, r_MaxIndx;
for(pay_i=0; pay_i<dat_pay_last_one; pay_i++, lenBuff=lenBuff+1){
printf(" writing: ");
dat_reset_Payload_Buff(pay_i, lenBuff, 0);
printf(" dat_reset_Payload_Buff(%d, %d)\r\n", pay_i, lenBuff);
printf(" reading: ");
r_nextIndx = dat_get_NextPayIndx(pay_i);
printf(" dat_get_NextPayIndx(%u) = %d | ", pay_i, r_nextIndx);
r_MaxIndx = dat_get_MaxPayIndx(pay_i);
printf(" dat_get_MaxPayIndx(%u) = %d | \n", pay_i, r_MaxIndx);
printf(" comparing: ");
if( r_nextIndx==0 && r_MaxIndx==(lenBuff-1) ){ printf("ok\n"); }
else{ printf("fail\n"); return; }
ClrWdt();
}
printf("DAT_Payload_Buff..\n");
int maxind; BOOL st;
for(pay_i=0; pay_i<dat_pay_last_one; pay_i++){
value=20000;
st = TRUE;
maxind = dat_get_MaxPayIndx(pay_i);
for(index=0; st==TRUE; index++, value++){
printf(" writing: ");
dat_set_Payload_Buff(pay_i, value, DAT_PAYBUFF_MODE_NO_MAXINDX);
printf(" DAT_Payload_Buff[%u][%u] = %d | ",pay_i, index, value);
printf("%d/%d [NextIndx/MaxIndx] | \n", dat_get_NextPayIndx(pay_i), dat_get_MaxPayIndx(pay_i) );
printf(" reading: ");
dat_get_Payload_Buff(pay_i, index, &res);
printf(" DAT_Payload_Buff[%u][%u] = %d | \n",pay_i, index, res);
printf(" comparing: ");
if( value==res ){ printf("ok\n"); }
else{ printf("fail\n"); return; }
if( dat_isFull_Payload_Buff(pay_i)==TRUE){
printf(" DAT_Payload_Buff[%u] esta lleno\r\n", pay_i);
st = FALSE;
}
ClrWdt();
}
printf("*******************************************\n");
}
printf("End of drp_debug5\n");
}
示例4: APP_task
/*
*------------------------------------------------------------------------------
* void APP-task(void)
*------------------------------------------------------------------------------
*/
void APP_task(void)
{
UINT8 i,*ptr, data;
UINT32 addr;
UINT8 resetBuzzer = TRUE;
ias.curAppTime = GetAppTime(); //Fetches the application time from timer driver
if(ias.preAppTime != ias.curAppTime)
{
ias.preAppTime = ias.curAppTime;
for(i = 0; i <MAX_ISSUES; i++) //check for timeout of issues raised
{
if(ias.issues[i].state == ISSUE_RAISED )
{
ias.issues[i].timeout -= 1;
ptr = (UINT8*)&ias.issues[i].timeout;
data = *ptr;
addr = (i*ISSUE_ENTRY_SIZE)+ISSUE_TIMEOUT;
Write_b_eep((i*ISSUE_ENTRY_SIZE)+ISSUE_TIMEOUT, *ptr);
Busy_eep();
ClrWdt();
data=*(ptr+1);
addr = (i*ISSUE_ENTRY_SIZE)+ISSUE_TIMEOUT+1;
Write_b_eep((i*ISSUE_ENTRY_SIZE)+ISSUE_TIMEOUT+1, *(ptr+1));
Busy_eep();
ClrWdt();
}
}
if(update_timeouts() == TRUE)
{
LAMP_RED = 1;
if( ias.issues_raised == 0 )
{
LAMP_YELLOW = 0;
LAMP_GREEN = 0;
}
}
if(ias.updateCount >= 5)
{
ias.updateCount = 0;
update();
}
}
++ias.updateCount;
}
示例5: APP_clearIssues
void APP_clearIssues()
{
UINT16 i;
ias.state = ISSUE_RESOLVED;
ias.issues_raised = 0; //No. of raised issues should be 0 initially
ias.issues_critical = 0; //No. of critical issues should be 0 initially
ias.preAppTime = 0;
ias.curAppTime = 0;
ias.openIssue = 0;
log.index = 0;
log.prevIndex = 0;
for( i = 0 ; i < MAX_ISSUES; i++)
{
ias.issues[i].state = ISSUE_RESOLVED;
ias.issues[i].timeout = 0;
ias.issues[i].ackStatus = 0;
memset(ias.issues[i].data , 0 , MAX_KEYPAD_ENTRIES + 1);
ClrWdt();
}
for(i = 0; i < (ISSUE_ENTRY_SIZE * MAX_ISSUES); i++)
{
Write_b_eep(i,0);
Busy_eep();
ClrWdt();
}
for( i = 1 ; i <= MAX_DEPARTMENTS ; i++)
{
ias.department_raised[i] = 0 ;
}
writeDeptRaise();
/*
if( ias.logonStatus == 1 )
{
updateIndication(1,0,0,0);
}
else
updateIndication(0,0,0,0);
*/
}
示例6: drp_debug3
void drp_debug3(void){
int value=0, res=0;
unsigned int index;
unsigned long block;
con_printf("(Destructive) Testing -256block r/w- memSD\r\n");
for(block=0; block<1024; block=block+256){
printf("testing 256Block = %lu\n", block);
value=20000;
for(index=0; index<=0xFFFF; index++, value++){
con_printf("writing: ");
msd_setVar_256BlockExtMem( block, index, value);
printf("value[%u] = %d | ", index, value);
printf("reading: ");
msd_getVar_256BlockExtMem( block, index, &res);
printf("value[%u] = %d | ", index, res);
printf("comparing: ");
if( value==res ){ printf("ok\n"); }
else{ con_printf("fail\n"); return; }
ClrWdt();
}
}
//drp_memSD_BlockErase();
}
示例7: InitializeOS
void InitializeOS() {
ClrWdt();
// High priority tasks that must be run all the time
core_task = RegisterTask("Core", ProcessCore);
core_task->state = tsRun;
// Drawing, only needs to be run when screen is on
draw_task = RegisterTask("Draw", DrawLoop);
// Initialize button interrupts
_CNIEn(BTN1_CN) = 1;
_CNIEn(BTN2_CN) = 1;
_CNIEn(BTN3_CN) = 1;
_CNIEn(BTN4_CN) = 1;
cn_register_cb(_CNIDX(BTN1_CN), _PINREF(BTN1), OnBTN1Change);
cn_register_cb(_CNIDX(BTN2_CN), _PINREF(BTN2), OnBTN2Change);
cn_register_cb(_CNIDX(BTN3_CN), _PINREF(BTN3), OnBTN3Change);
cn_register_cb(_CNIDX(BTN4_CN), _PINREF(BTN4), OnBTN4Change);
uint i;
for (i=1; i<=4; i++) {
btn_debounce_tick[i] = 0;
btn_state[i] = 0;
}
}
示例8: main
//***************************************************************************
// Main() - Main Routine
//***************************************************************************
void main(){
OSCCON = 0xF0; //Initialitation of Internal Oscillator
OSCTUNEbits.PLLEN = 1;
hardware_setup(); //Hardware initialization
if ( !vscp_check_pstorage() ) // Check VSCP persistent storage and
init_app_eeprom(); // restore if needed
init_app_ram(); // Initialize data
vscp_init(); // Initialize the VSCP functionality
while(1){ //Handler scheduler
ClrWdt(); // Feed the dog
if(timeEvent._10mS){ //10mS Event
timeEvent._10mS = 0;
vscp_10mS_Running();
hardware_10mS();
}
if(timeEvent._100mS){ //100mS Event
timeEvent._100mS = 0;
vscp_100mS_Running();
vscp_ledActivity();
}
if(timeEvent._1s){ //1second Event
timeEvent._1s = 0;
vscp_doOneSecondWork(); // Do VSCP one second jobs
greenLed_pin = !greenLed_pin;
}
vscp_freeRunning();
//TODO: Handling the override event
}
}
示例9: _U2TXInterrupt
void _ISR_PSV _U2TXInterrupt(void) {
//InterruptTest5++;
_U2TXIF = 0; // interrupt flag reset
unsigned char debugTX;
IFS1bits.U2TXIF = 0;
// clear TX interrupt flag
__builtin_disi(0x3FFF); //disable interrupts up to priority 6 for n cycles
ClrWdt(); // [1]
if(TxNByte_UART2)
{ debugTX = *TxPointer_UART2++; // Trasmette il carattere del buffer puntato da TxPointer
U2TXREG = debugTX;
TxNByte_UART2 = TxNByte_UART2 - 1; // TxNByte_UART2--; non pare funzionare
}
else
{
TxComplete[PORT_COM2] = TRUE;
IEC1bits.U2TXIE = 0; // Disable Transmit Interrupts
}
DISICNT = 0; //re-enable interrupts
//InterruptTest5--;
}
示例10: IAS_acknowledgeIssues
void IAS_acknowledgeIssues(UINT8 ID)
{
UINT8 i;
ias.issues[ID].ackStatus = 0;
updateLog(ias.issues[ID].data);
Write_b_eep((ID*ISSUE_ENTRY_SIZE)+ISSUE_ACKSTATUS, ias.issues[ID].ackStatus);
Busy_eep();
ClrWdt();
//IAS_updateIssues(ias.issues[ID].data);
for( i = 0 ; i < MAX_ISSUES ;i++)
{
if( ias.issues[i].ackStatus == 1)
return;
}
BUZ_OP = 0;
}
示例11: _U2RXInterrupt
void _ISR_PSV _U2RXInterrupt(void) { // UART2 RX [6zb]
//InterruptTest6++;
__builtin_disi(0x3FFF); //disable interrupts up to priority 6 for n cycles
_U2RXIF = 0; // interrupt flag reset
ClrWdt(); // [1]
unsigned char DatoRx;
DatoRx = ReadUART2();
if(StatoSeriale[PORT_COM2] == WAIT_MESSAGE)
{ // time-out dei dati in ricezione non sia scaduto, altrimenti
if (!TimerOutRxModbus[PORT_COM2])
{ FreeRxBuffer(PORT_COM2);
}
TimerOutRxModbus[PORT_COM2] = TIME_OUT_MODBUS;
*RxPointer[PORT_COM2] = DatoRx; // Salva nel buffer il dato ricevuto
RxPointer[PORT_COM2]++;
RxNByte[PORT_COM2]++;
if (RxNByte[PORT_COM2] >= MODBUS_N_BYTE_RX) // se ricevuti più caratteri della lunghezza del buffer
{ RxPointer[PORT_COM2] = ModbusRxBuff[PORT_COM2]; // azzera il puntatore di ricezione
RxNByte[PORT_COM2] = 0; // e il numero di byte ricevuti
}
}
DISICNT = 0; //re-enable interrupts
//InterruptTest6--;
}
示例12: main
/**************************************************
* Function name : void main(void)
*
* Created by : Luca Lucci
* Date created : 07/10/12
* Description : Main program entry point
* Notes : -
**************************************************/
void main(void)
{
initialize_system();
// initialize usart
uart_init();
uart2_open();
// initialize interrupt
INTCON2bits.INTEDG0 = 0; // falling edge int0 interrupt
INTCONbits.INT0IE = 1; // enable int0 interrupt
INTCONbits.INT0IF = 0;
INTCONbits.PEIE = 1; // enable peripheral interrupts
INTCONbits.GIE = 1; // enable global interrupt
while(1)
{
ClrWdt();
// if the buffer isn't empty will send back the data
if(uart2_buffer_read(temp))
uart2_buffer_tx_load(temp);
// ProcessIO
}
}//main()
示例13: update_timeouts
/*---------------------------------------------------------------------------------------------------------------
* BOOL update_timeouts(void)
*----------------------------------------------------------------------------------------------------------------
*/
BOOL update_timeouts(void)
{
UINT8 i;
BOOL result = FALSE;
for(i = 0; i <MAX_ISSUES; i++) //check for timeout of issues raised
{
if(ias.issues[i].state == ISSUE_RAISED)
{
if(ias.issues[i].timeout == 0)
{
ias.issues_critical++;
ias.issues_raised--;
ias.issues[i].state = ISSUE_CRITICAL;
Write_b_eep((i*ISSUE_ENTRY_SIZE)+ISSUE_STATE,ias.issues[i].state);
Busy_eep();
ClrWdt();
ias.state = ISSUE_CRITICAL;//put up
result = TRUE;
}
}
}
return result;
}
示例14: BootMain
void BootMain(void)
#endif
{
//NOTE: The c018.o file is not included in the linker script for this project.
//The C initialization code in the c018.c (comes with C18 compiler in the src directory)
//file is instead modified and included here manually. This is done so as to provide
//a more convenient entry method into the bootloader firmware. Ordinarily the _entry_scn
//program code section starts at 0x00 and is created by the code of c018.o. However,
//the linker will not work if there is more than one section of code trying to occupy 0x00.
//Therefore, must not use the c018.o code, must instead manually include the useful code
//here instead.
//Make sure interrupts are disabled for this code (could still be on,
//if the application firmware jumped into the bootloader via software methods)
INTCON = 0x00;
//Initialize the C stack pointer, and other compiler managed items as
//normally done in the c018.c file (applicable when using C18 compiler)
#ifndef __XC8__
_asm
lfsr 1, _stack
lfsr 2, _stack
clrf TBLPTRU, 0
_endasm
#endif
//Clear the stack pointer, in case the user application jumped into
//bootloader mode with excessive junk on the call stack
STKPTR = 0x00;
// End of the important parts of the C initializer. This bootloader firmware does not use
// any C initialized user variables (idata memory sections). Therefore, the above is all
// the initialization that is required.
//Call other initialization code and (re)enable the USB module
InitializeSystem(); //Some USB, I/O pins, and other initialization
//Execute main loop
while(1)
{
ClrWdt();
//Need to call USBDeviceTasks() periodically. This function takes care of
//processing non-USB application related USB packets (ex: "Chapter 9"
//packets associated with USB enumeration)
USBDeviceTasks();
BlinkUSBStatus(); //When enabled, blinks LEDs on the board, based on USB bus state
LowVoltageCheck(); //Regularly monitor voltage to make sure it is sufficient
//for safe operation at full frequency and for erase/write
//operations.
ProcessIO(); //This is where all the actual bootloader related data transfer/self programming takes
//place see ProcessIO() function in the BootPIC[xxxx].c file.
}//end while
}
示例15: ADC_zero
/* switch to ADC chan 8 (shorted to ground) to reset ADC measurement cap to zero before next measurement */
void ADC_zero(void)
{
ClrWdt(); // reset the WDT timer
SetChanADC(ADC_CH8); // F3 grounded input
Delay10TCYx(ADC_CHAN_DELAY);
ConvertADC();
while (BusyADC());
}