本文整理汇总了C++中DelayMs函数的典型用法代码示例。如果您正苦于以下问题:C++ DelayMs函数的具体用法?C++ DelayMs怎么用?C++ DelayMs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DelayMs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timer0_ISR
void timer0_ISR(void)
{
DelayMs(100);
cont--;
D8Led_symbol(numbers[cont]);
if (cont == 0) {
rINTMSK = rINTMSK | BIT_TIMER0; //disable timer0
rI_ISPC = BIT_TIMER0;
//key = -1;
//DelayMs(200);
//rINTMSK = rINTMSK & ~(BIT_TIMER4); //enable timer4
rINTMSK = rINTMSK & ~(BIT_TIMER1); //enable timer1
}
rI_ISPC = BIT_TIMER0;
}
示例2: iic_putByte_stop
void iic_putByte_stop(uint8 byte) {
// Escribe el dato
IICDS = byte;
// Comienza la trasmisión del dato (borrando pending bit del IICCON)
IICCON &= ~(1 << 4);
// Espera la recepción de ACK
while (!(IICCON & 0x10)); //while (IICSTAT & 0x1);
// Máster Tx, stop condition, Tx/Rx habilitada
IICSTAT = (IICSTAT & 0x0F) | 0xD0;
// Comienza la trasmisión de STOP (borrando pending bit del IICCON)
IICCON &= ~(1 << 4);
// Espera a que la stop condition tenga efecto (5 ms para la at24c04)
DelayMs(5);
}
示例3: write_code_P18F67KXX
void write_code_P18F67KXX( unsigned long address, unsigned char* data, char blocksize, char lastblock )
{
char blockcounter;
//FIXME: this only needs to be done on FIRST_BLOCK
if( (address & 0x60) == 0 ) //package must be 128 bytes, so only do this every four packages.
{
pic_send( 4, 0x00, 0x8E7F ); //BSF EECON1, EEPGD
pic_send( 4, 0x00, 0x9C7F ); //BSF EECON1, CFGS
pic_send( 4, 0x00, 0x847F ); //BSF EECON1, WREN
set_address_P18( address );
}
for( blockcounter = 0; blockcounter < (blocksize - 2); blockcounter += 2 )
{
//write 2 bytes and post increment by 2
// MSB LSB
pic_send( 4, 0x0D, ((unsigned int) *(data + blockcounter))
| (((unsigned int) *(data + 1 + blockcounter)) << 8) );
}
if( (address & 0x60) == 0x60 || (lastblock & BLOCKTYPE_LAST) )
{
//write last 2 bytes of the block and start programming
pic_send( 4, 0x0F, ((unsigned int) *(data + blockcounter))
| (((unsigned int) *(data + 1 + blockcounter)) << 8) );
pic_send_n_bits( 3, 0 );
PGChigh(); //hold PGC high for P9 and low for P10
DelayMs( P9 );
PGClow();
DelayMs( P10 );
pic_send_word( 0x0000 );
}
else
pic_send( 4, 0x0D, ((unsigned int) *(data + blockcounter))
| (((unsigned int) *(data + 1 + blockcounter)) << 8) );
}
示例4: ServerDrv_CheckDataSent
int32_t ServerDrv_CheckDataSent(uint8_t sock)
{
uint16_t timeout = 0;
uint8_t _data = 0;
uint8_t _dataLen = 0;
const uint16_t TIMEOUT_DATA_SENT = 25;
do
{
//WAIT_FOR_SLAVE_SELECT();
SpiDrv_WaitForSlaveReady();
SpiDrv_SlaveSelect();
// Send Command
SpiDrv_SendCmd(DATA_SENT_TCP_CMD, PARAM_NUMS_1);
SpiDrv_SendParam(&sock, sizeof(sock), LAST_PARAM);
//Wait the reply elaboration
SpiDrv_WaitForSlaveReady();
// Wait for reply
if (!SpiDrv_WaitResponseCmd(DATA_SENT_TCP_CMD, PARAM_NUMS_1, &_data, &_dataLen))
{
//WARN("error waitResponse isDataSent");
}
SpiDrv_SlaveDeselect();
if (_data)
{
timeout = 0;
}
else
{
++timeout;
DelayMs(100);
}
}while((_data==0)&&(timeout<TIMEOUT_DATA_SENT));
if(timeout==TIMEOUT_DATA_SENT)
{
return (0);
}
else
{
return (1);
}
}
示例5: SetupMenu
void SetupMenu() // Set up menu
{
uint8 i;
while(1)
{
i = GetMenuItem("TERMINAL SETUP","WiFi Setup","ESPUSB Fudge","Scan WiFi","Test Wifi","Exit");
if(i==1) SetupWIFI();
if(i==2) // Open USB in CDC Mode passthough to ESP-01
{
SerialPurge(WIFI_UART);
CLS();
LCDWriteStrAt(0,4, " USB <-> ESP01 ");
LCDWriteStrAt(0,6, " PROGRAMMIING ");
LCDWriteStrAt(0,10," PRESS KEY TO ");
LCDWriteStrAt(0,12," CONTINUE ");
PORTSetPinsDigitalIn(IOPORT_C, BIT_2 );
PPSUnLock; // Unlock PPS (Peripheral Pin Select) to allow PIN Mapping
PPSOutput(4,RPC2,NULL);
PPSLock; // lock PPS
ESP_PGM(0);
WIFI_PWR(1);
i = WaitEvent(9999);
CLS();
WIFI_PWR(0);
ESP_PGM(1);
DelayMs(500);
WIFI_PWR(1);
LCDWriteStrAt(0,4, " USB <-> ESP01 ");
LCDWriteStrAt(0,6, " PASSTHROUGH ");
LCDWriteStrAt(0,10," POWER OFF TO ");
LCDWriteStrAt(0,12," RESUME ");
while(1);
}
if(i==4)
{
if(CheckWIFI()) LCDInform("SUCCESS","Connection OK");
}
if(i==3) { LCDInform("WARNING","Not Implemented"); }
if(i==0 ||i==5) return;
}
}
示例6: MODEM_Wait
// wait for reponse from modem within specific time out
// maximum waiting period = (time / 10) seconds
uint8_t MODEM_Wait(const uint8_t *res, uint32_t time)
{
uint8_t c, i=0;
time *= 100;
while(time--){
DelayMs(1);
while(RINGBUF_Get(&commBuf, &c)==0){
if(c==res[i]){
if(res[++i]==0)return 1;
}else if(c==res[0]) i = 1;
else i = 0;
}
}
return 0;
}
示例7: KEY_Scan
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
** 函数名称: KEY_Scan
** 功能描述: 按键扫描程序
** 参数描述:KEY_Status标志位
返回的值分别对应按键值
** 作 者: Dream
** 日 期: 2011年6月20日
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
uint8_t KEY_Scan(void)
{
static uint8_t KEY_Status =1; //定义一个按键标志位
if(KEY_Status&&(KEY_USER==0||KEY_S==0||KEY_D==0||KEY_L==0||KEY_R==0||KEY_U==0))//判断是否有按键按下
{
DelayMs(10);//去抖动
KEY_Status =0;
if(KEY_USER==0) return 1; //按键USER按下返回1
else if(KEY_S==0) return 2; //按键JOY-SEN按下返回1
else if(KEY_D==0) return 3; //按键JOY-DOWN按下返回1
else if(KEY_L==0) return 4; //按键JOY-LEFT按下返回1
else if(KEY_R==0) return 5; //按键JOY-RIGHT按下返回1
else if(KEY_U==0) return 6; //按键JOY-DOWN按下返回1
}else if(KEY_USER==1&&KEY_S==1&&KEY_D==1&&KEY_L==1&&KEY_R==1&&KEY_U==1)KEY_Status=1;
return 0; //无按键按下返回0
}
示例8: TouchGetCalPoints
/*********************************************************************
* Function: void TouchGetCalPoints(WORD* ax, WORD* ay)
*
* PreCondition: InitGraph() must be called before
*
* Input: ax - pointer to array receiving 3 X touch positions
* ay - pointer to array receiving 3 Y touch positions
*
* Output: none
*
* Side Effects: none
*
* Overview: gets values for 3 touches
*
* Note: none
*
********************************************************************/
void TouchGetCalPoints(WORD* ax, WORD* ay){
static const XCHAR calStr[] = {'C','A','L','I','B','R','A','T','I','O','N',0};
XCHAR calTouchLeft[] = {'3',' ','t','o','u','c','h','e','s',' ','l','e','f','t',0};
SHORT counter;
SHORT x,y;
SetFont((void*)&GOLFontDefault);
SetColor(BRIGHTRED);
OutTextXY((GetMaxX()-GetTextWidth((XCHAR*)calStr,(void*)&GOLFontDefault))>>1,
(GetMaxY()-GetTextHeight((void*)&GOLFontDefault))>>1,
(XCHAR*)calStr);
for(counter=0; counter<3; counter++){
SetColor(BRIGHTRED);
calTouchLeft[0] = '3' - counter;
OutTextXY((GetMaxX()-GetTextWidth(calTouchLeft,(void*)&GOLFontDefault))>>1,
(GetMaxY()+GetTextHeight((void*)&GOLFontDefault))>>1,
calTouchLeft);
// Wait for press
do{
x=ADCGetX(); y=ADCGetY();
}while((y==-1)||(x==-1));
Beep();
*(ax+counter) = x; *(ay+counter) = y;
// Wait for release
do{
x=ADCGetX(); y=ADCGetY();
}while((y!=-1)&&(x!=-1));
SetColor(WHITE);
OutTextXY((GetMaxX()-GetTextWidth(calTouchLeft,(void*)&GOLFontDefault))>>1,
(GetMaxY()+GetTextHeight((void*)&GOLFontDefault))>>1,
calTouchLeft);
DelayMs(500);
}
}
示例9: main
int main(void)
{
//初始化系统时钟 使用外部50M晶振 PLL倍频到100M
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
DelayInit();
//初始化LED
LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
//将LED1设置为高电平
LED_Set(kLED1);
while(1)
{
//2LED闪烁
LED_Toggle(kLED1);
LED_Toggle(kLED2);
DelayMs(500);
}
}
示例10: LCDUpdate
/******************************************************************************
* Function: void LCDUpdate(void)
*
* PreCondition: LCDInit() must have been called once
*
* Input: LCDText[]
*
* Output: None
*
* Side Effects: None
*
* Overview: Copies the contents of the local LCDText[] array into the
* LCD's internal display buffer. Null terminators in
* LCDText[] terminate the current line, so strings may be
* printed directly to LCDText[].
*
* Note: None
*****************************************************************************/
void LCDUpdate(void)
{
BYTE i, j;
// Go home
LCDWrite(0, 0x02);
DelayMs(2);
// Output first line
for(i = 0; i < 16u; i++)
{
// Erase the rest of the line if a null char is
// encountered (good for printing strings directly)
if(LCDText[0][i] == 0u)
{
for(j=i; j < 16u; j++)
{
LCDText[0][j] = ' ';
}
}
LCDWrite(1, LCDText[0][i]);
Delay10us(5);
}
// Set the address to the second line
LCDWrite(0, 0xC0);
Delay10us(5);
// Output second line
// for(i = 16; i < 32u; i++)
for(i = 0; i < 16u; i++)
{
// Erase the rest of the line if a null char is
// encountered (good for printing strings directly)
if(LCDText[1][i] == 0u)
{
//for(j=i; j < 32u; j++)
for(j=i; j < 16u; j++)
{
LCDText[1][j] = ' ';
}
}
LCDWrite(1, LCDText[1][i]);
Delay10us(5);
}
}
示例11: SelfTest
/****************************************************************************
Function:
void SelfTest()
Description:
This routine performs a self test of the hardware.
Precondition:
None
Parameters:
None - None
Returns:
None
Remarks:
None
***************************************************************************/
static void SelfTest(void)
{
char value = 0;
char* buf[32];
Exosite_Init("microchip","dv102412",IF_WIFI, 1);
// Configure Sensor Serial Port
UARTConfigure(SENSOR_UART, UART_ENABLE_PINS_TX_RX_ONLY);
UARTSetFifoMode(SENSOR_UART, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY);
UARTSetLineControl(SENSOR_UART, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1);
UARTSetDataRate(SENSOR_UART, GetPeripheralClock(), 9600);
UARTEnable(SENSOR_UART, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));
// Verify MRF24WB/G0MA MAC Address
if(AppConfig.MyMACAddr.v[0] == 0x00 && AppConfig.MyMACAddr.v[1] == 0x1E)
{
//********************************************************************
// Prints a label using ESC/P commands to a Brother PT-9800PCN printer
//********************************************************************
// Send ESC/P Commands to setup printer
UARTTxBuffer("\033ia\000\[email protected]\033X\002",9); // ESC i a 0 = Put Printer in ESC/P Mode
// ESC @ = Reset Printer to Default settings
// ESC X 2 = Specify Character Size
// Send the Info to Print for the MAC Address label
UARTTxBuffer("MRF24WB0MA\r",11);
sprintf((char *)buf,"MAC: %02X%02X%02X%02X%02X%02X",AppConfig.MyMACAddr.v[0],AppConfig.MyMACAddr.v[1],AppConfig.MyMACAddr.v[2],AppConfig.MyMACAddr.v[3],AppConfig.MyMACAddr.v[4], AppConfig.MyMACAddr.v[5]);
UARTTxBuffer((char *)buf, strlen((const char *)buf));
// Print the label
UARTTxBuffer("\f",1);
// Toggle LED's
while(1)
{
LED0_IO = value;
LED1_IO = value >> 1;
LED2_IO = value >> 2;
DelayMs(400);
if(value == 8)
value = 0;
else
value++;
}
}
示例12: iic_putByte_stop
void iic_putByte_stop( uint8 byte )
{
// Escribe el dato
rIICDS = byte;
// Comienza la trasmisión del dato (borrando pending bit del IICCON)
rIICCON= rIICCON & 0xef;
// Espera la recepción de ACK
while ((rIICCON & 0x10) == 0);
// Máster Tx, stop condition, Tx/Rx habilitada
rIICSTAT= 0xd0;
// Comienza la trasmisión de STOP (borrando pending bit del IICCON)
rIICCON= rIICCON & 0xef;
// Espera a que la stop condition tenga efecto (5 ms para la at24c04)
DelayMs(5);
}
示例13: ADXL362_PolledInit
void ADXL362_PolledInit(void)
{
SpiInitPolledMode(ACCEL_ADXL362);
// Software Reset
ADXL362_WriteReg(ADXL362_SOFT_RESET, ADXL362_RESET_CMD);
DelayMs(10);
ADXL362_WriteReg(ADXL362_SOFT_RESET, 0x00);
// Enable Measurement
ADXL362_WriteReg(ADXL362_POWER_CTL, (2 << ADXL362_MEASURE));
s_adxl362_state = ADXL362_WaitForCommand;
SpiStop(BARO_MS5611);
}
示例14: MotoOpen
/**********************************************函数定义*****************************************************
* 函数名称: void MotoSet(u8 moto, u8 sleep)
* 输入参数: u8 moto, u8 sleep
* 返回参数: void
* 功 能: 打开电机
* 作 者: by lhb_steven
* 日 期: 2016/7/14
************************************************************************************************************/
u8 MotoOpen(u8 moto, u8 dir) {
//压纸电机
if(moto == 0) {
moto1.zero_time = 0;
if(dir == 0) {
//压纸
moto1.dir = ste_dr_pla_counter;
moto1.pla_hd_time = 0;//转速时间
} else {
//收刀
moto1.dir = ste_dr_pla_positive;
}
if(autu_n.specal_old == 0) {
UART1_CR2_RIEN = 0;//关闭接收中断使能
}
PHASE_EN = 1;//开启转速中断
moto1.en = 1;//打开压纸电机
TIM2_CR1 = 0x01;
//压纸电机方向
PLATEN_DIR = moto1.dir;
} else {
//操作切纸电机
moto2.zero_time = 0;
if(dir == 0) {//复位
moto2.dir = ste_dr_cut_counter;
} else {//切纸
autu_n.specal_rst = 0;
EepromWrite(13,autu_n.specal_rst);
moto2.dir = ste_dr_cut_positive;
}
if(autu_n.specal_old == 0) {
UART1_CR2_RIEN = 0;//关闭接收中断使能
}
moto2.en = 1;//打开切纸电机
CUTTER_SLEEP = 0;//低电平有效
//切纸电机方向使能
CUTTER_DIR = moto2.dir;
}
//开启中断
//等待继电器稳定
DelayMs(300);
//使能电源
POWER_EN = 1;
return 0;
}
示例15: main
int main(void) {
UINT8 mpu_address = MPU6050_ADDRESS_AD0_LOW;
initAll();
UINT8 acc[2] = {0};
INT16 acc16 = 0;
float acc_g = 0;
UINT8 data = 0;
while(TRUE) {
requestReadBytes(MPU6050_ADDRESS_AD0_LOW, (UINT8)MPU6050_RA_ACCEL_XOUT_H, acc, 2); // burst read two bytes.
PORTToggleBits(IOPORT_F, BIT_0); // LED5.
DelayMs(1000);
acc16 = (INT16)((acc[0] << 8) | acc[1]);
acc_g = (float)acc16 / 16384.0;
printf("\n\rACC X: %f\n\r", acc_g);
}
return (EXIT_SUCCESS);
}