/* \brief Send single character over UART */ static void PutChar(uint8_t ch) { while (AS1_SendChar(ch) != ERR_OK) { /* retry */ } }
/* ** =================================================================== ** Method : CLS1_SendChar (component Shell) ** Description : ** Sends a character (blocking) ** Parameters : ** NAME - DESCRIPTION ** ch - character to be sent ** Returns : Nothing ** =================================================================== */ void CLS1_SendChar(uint8_t ch) { uint8_t res; do { res = AS1_SendChar((uint8_t)ch); /* Send char */ if (res==ERR_TXFULL) { WAIT1_WaitOSms(10); } } while(res==ERR_TXFULL); }
void main(void) { /* Write your local variable definition here */ long t=sizeof(byte*); ++t; --t; ++g; --g; g=t; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ AS1_SendChar('a'); for(;1;){AS1_SendChar('a');Cpu_Delay100US(1000); } /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* ** =================================================================== ** Method : CLS1_SendChar (component Shell) ** Description : ** Sends a character (blocking) ** Parameters : ** NAME - DESCRIPTION ** ch - character to be sent ** Returns : Nothing ** =================================================================== */ void CLS1_SendChar(uint8_t ch) { uint8_t res; int timeoutMs = 20; do { res = AS1_SendChar((uint8_t)ch); /* Send char */ if (res==ERR_TXFULL) { WAIT1_WaitOSms(10); } if(timeoutMs<=0) { break; /* timeout */ } timeoutMs -= 10; } while(res==ERR_TXFULL); }
void ModBus_OnSend(void) { static byte StepTx=0; //Pasos en la transmision if (StepTx == 0) trx_SetVal(); if (StepTx<cant_msjs_out){ if (AS1_SendChar(msj_out[StepTx])==ERR_OK) StepTx++; } else if(StepTx==cant_msjs_out) { // Timer_Restart(&comu_timer);// ckeckeo que no pasen 3ms AS1_Tx=FALSE; //Termino el proceso de transmision StepTx=0; trx_ClrVal(); } }