本文整理汇总了C++中Delay1KTCYx函数的典型用法代码示例。如果您正苦于以下问题:C++ Delay1KTCYx函数的具体用法?C++ Delay1KTCYx怎么用?C++ Delay1KTCYx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Delay1KTCYx函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LCD_init
void LCD_init(void)
{
unsigned char inits[7] = {0x33, 0x32, 0x28, 0x01, 0x0c, 0x06, 0x00};
unsigned char temp;
char i;
TRISD &= 0b00001111; //set high nibble of portd to output
RS_SIG = 0;
E_SIG = 0;
E_TRIS = 0;
RS_TRIS = 0;
memset(lcdtext, ' ', sizeof(lcdtext)-1);
Delay10KTCYx(25);
for( i = 0; i < 7; i++ )
{
E_SIG = 1;
temp = inits[i];
temp &= 0b11110000;
LATD &= 0b00001111;
LATD |= temp;
E_SIG = 0;
Delay1KTCYx(25);
E_SIG = 1;
temp = inits[i] << 4;
temp &= 0b11110000;
LATD &= 0b00001111;
LATD |= temp;
E_SIG = 0;
Delay1KTCYx(25);
}
}
示例2: LCD_w
void LCD_w(unsigned char a)
{
unsigned char cs = SPI_CUR_SEL;
unsigned char ret=1;
if(cs == SPI_LCD) {
SPI_Device_Select(SPI_MEM);
Delay1KTCYx(1);
}
while(ret) {
SPI_Device_Select(SPI_LCD);
Delay1KTCYx(1);
ret = rw_spi_byte(MAX3100_WRITE);
if(ret & 64) {
rw_spi_byte(a);
ret = 0;
} else
ret = 1;
if(cs != SPI_LCD)
SPI_Device_Select(cs);
else
SPI_Device_Select(SPI_GPS);
}
}
示例3: piscaVermelho
void piscaVermelho (void){
LED2=1;
Delay1KTCYx(15);
LED2=0;
Delay1KTCYx(85);
}
示例4: config_SPI_devs
void config_SPI_devs(void)
{
char a = 0;
if(SPI_CUR_SEL == 0) {
SPI_Device_Select(1);
Delay1KTCYx(10);
}
for(a=0;a<4;a++) {
SPI_Device_Select(a);
Delay1KTCYx(10);
switch(a) {
case SPI_GPS:
rw_spi_byte(MAX3100_WCONFIGR);
rw_spi_byte(UART_4800);
break;
case SPI_UART:
rw_spi_byte(MAX3100_WCONFIG);
rw_spi_byte(UART_115200);
break;
case SPI_LCD:
rw_spi_byte(MAX3100_WCONFIG);
rw_spi_byte(UART_9600);
break;
case SPI_MEM:
rw_spi_byte(MAX3100_WCONFIG);
rw_spi_byte(UART_9600); //Change Speed Later
break;
default:
Nop();
break;
}
}
SPI_Device_Select(SPI_GPS); //Unselect last device to let config take place
}
示例5: HeartBeat
void HeartBeat(void)
{
ACT_LED_01 = 0;
Delay1KTCYx(100);
ACT_LED_01 = 1;
Delay1KTCYx(100);
WriteUSART('#'); // :
while (BusyUSART());
}
示例6: OpenXLCD
void OpenXLCD(unsigned char lcdtype)
{
// 4-bit mode
#ifdef UPPER // Upper 4-bits of the port
DATA_PORT &= 0x0f;
TRIS_DATA_PORT &= 0x0F;
#else // Lower 4-bits of the port
DATA_PORT &= 0xf0;
TRIS_DATA_PORT &= 0xF0;
#endif
TRIS_RW = 0; // All control signals made outputs
TRIS_RS = 0;
TRIS_E = 0;
RW_PIN = 0; // R/W pin made low
RS_PIN = 0; // Register select pin made low
E_PIN = 0; // Clock pin made low
// Delay for 15ms to allow for LCD Power on reset
DelayPORXLCD();
//-------------------reset procedure through software----------------------
WriteCmdXLCD(0x30);
Delay1KTCYx(33);
WriteCmdXLCD(0x30);
Delay1KTCYx(0x01);
WriteCmdXLCD(0x32);
while( BusyXLCD() );
//------------------------------------------------------------------------------------------
// Set data interface width, # lines, font
while(BusyXLCD()); // Wait if LCD busy
WriteCmdXLCD(lcdtype); // Function set cmd
// Turn the display on then off
while(BusyXLCD()); // Wait if LCD busy
WriteCmdXLCD(DOFF&CURSOR_OFF&BLINK_OFF); // Display OFF/Blink OFF
while(BusyXLCD()); // Wait if LCD busy
WriteCmdXLCD(DON&CURSOR_ON&BLINK_ON); // Display ON/Blink ON
// Clear display
while(BusyXLCD()); // Wait if LCD busy
WriteCmdXLCD(0x01); // Clear display
// Set entry mode inc, no shift
while(BusyXLCD()); // Wait if LCD busy
WriteCmdXLCD(SHIFT_CUR_LEFT); // Entry Mode
// Set DD Ram address to 0
while(BusyXLCD()); // Wait if LCD busy
SetDDRamAddr(0x80); // Set Display data ram address to 0
return;
}
示例7: sendTest
void sendTest() {
Write1USART(Test[0]);
Delay1KTCYx(4);
Write1USART(Test[1]);
Delay1KTCYx(4);
Write1USART(Test[2]);
Delay1KTCYx(4);
Write1USART(Test[3]);
Delay1KTCYx(4);
Write1USART('\n');
}
示例8: delay_ms
/*******************************************************************************
* PUBLIC FUNCTION: delay_ms
*
* PARAMETERS:
* ~ ui_millisecond
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* delay for for period millisecond base on ui_millisecond
* based on _XTAL_FREQ value, ui_millisecond range from 0-65,535.
*******************************************************************************/
void delay_ms(unsigned int ui_millisecond)
{
for( ; ui_millisecond > 0; ui_millisecond --)
{
#if (_XTAL_FREQ == 20000000)
Delay1KTCYx(5); //5K instruction cycle with 20MHz oscillator is 1ms
#elif (_XTAL_FREQ == 48000000)
Delay1KTCYx(12); //12K instruction cycle with 48MHz oscillator is 1ms
#endif
}
}
示例9: delayms
void delayms(int x){
if (MNML){
Delay1KTCYx(x);
Delay1KTCYx(x);
Delay1KTCYx(x);
}
else{
Delay1KTCYx(x);
}
}
示例10: sendAccel
void sendAccel()
{
Write1USART(accArr[0]);
Delay1KTCYx(4);
Write1USART('.');
Delay1KTCYx(4);
Write1USART(accArr[1]);
Delay1KTCYx(4);
Write1USART(accArr[2]);
Delay1KTCYx(4);
Write1USART('\n');
}
示例11: Init_LCD
void Init_LCD(void)
{
LCD_CMD(0x02); //Dat che do giao tiep 4-bit, man hinh 2 dong
Delay1KTCYx(1);
LCD_CMD(0x28); //Tat man hinh
Delay1KTCYx(1);
LCD_CMD(0x0C); //Che do nhap du lieu binh thuong
Delay1KTCYx(1);
LCD_CMD(0x06 ); //Bat man hinh, hien con tro nhap nhay
Delay1KTCYx(1);
//LCD_CMD(0x01); //Xoa man hinh
Delay1KTCYx(1);
}
示例12: GPS_r
char GPS_r(void)
{
unsigned char cs = SPI_CUR_SEL;
unsigned char ret;
char gval;
if(cs == SPI_GPS) {
SPI_Device_Select(SPI_MEM);
Delay1KTCYx(1);
}
SPI_Device_Select(SPI_GPS);
ret = rw_spi_byte(MAX3100_READ);
if(ret & READ_READY) {
gval = rw_spi_byte(0);
} else
gval = 0;
if(cs != SPI_GPS)
SPI_Device_Select(cs);
else
SPI_Device_Select(SPI_MEM);
return gval;
}
示例13: block_on_To_msgqueues
// only called from "main"
void block_on_To_msgqueues()
{
if (!in_main()) {
return;
}
//LATBbits.LATB3 = 1;
MQ_Main_Willing_to_block = 1;
while (1) {
if (check_msg(&ToMainHigh_MQ)) {
MQ_Main_Willing_to_block = 0;
//LATBbits.LATB3 = 0;
return;
}
if (check_msg(&ToMainLow_MQ)) {
MQ_Main_Willing_to_block = 0;
//LATBbits.LATB3 = 0;
return;
}
if (check_msg(&adReadQueue))
{
MQ_Main_Willing_to_block = 0;
//LATBbits.LATB3 = 0;
return;
}
Delay1KTCYx(10);
//LATBbits.LATB3 = !LATBbits.LATB3;
}
}
示例14: main
//main function
void main(void)
{
unsigned char st1[]="STARTING";
unsigned char st2[]=".";
//pins for drive LCD
TRISB = 0x80;
//Initialize modules
Init_LCD();
i2c_config();
set_ds1307_time(AM,0,0,6);
set_ds1307_day(8,11,8,13);
lcd_putstr(st1);
for(i=0;i<7;i++)
{
lcd_putstr(st2);
Delay1KTCYx(200);
}
LCD_CMD(LCD_clear);
while(1)
{
lcd_gotoxy(1,1);//hang 1, cot 1.
Display_time(get_ds1307_time());
lcd_gotoxy(1,2);//hang 2, cot 1
Display_day(get_ds1307_day());
Delay10KTCYx(70);
};
}
示例15: main
void main (void)
{
OSCCON = 0x60; // IRCFx = 110
OSCTUNEbits.PLLEN = 0; // x4 PLL disabled
// Port D used for diagnostic LEDs
TRISD = 0b00111111; // PORTD bit 7 to output (0) ; bits 6:0 are inputs (1)
LATDbits.LATD7 = 0; // RED LED
LATDbits.LATD6 = 0; // YLW LED
// Setup MSSP in 7 bit I2C Slave mode
TRISC = 0b00011000; // TRISC 3&4 (SCL & SDA) inputs
LATC = 0b00011000;
SSPADD = I2C_ADDR; // Set I2C address
SSPCON1 = 0x36; // SSPEN: Synchronous Serial Port Enable bit - Enables the serial port and configures the SDA and SCL pins as the serial port pins
// CKP: SCK Release Control bit - Release clock
// SSPM3:SSPM0: SSP Mode Select bits - 0110 = I2C Slave mode, 7-bit address
SSPSTAT = 0x00;
SSPCON2 = 0x01; // GCEN: General Call address (00h) (Slave mode only) 0 = General call address disabled
// SEN: Start Condition Enable/Stretch Enable bit(1) ()Slave mode) 1 = Clock stretching is enabled
PIR1bits.SSPIF = 0; // Clear MSSP interrupt request flag
PIE1bits.SSPIE = 1; // Enable MSSP interrupt enable bit
INTCONbits.GIE_GIEH = 1; // GIE/GIEH: Global Interrupt Enable bit
INTCONbits.PEIE_GIEL = 1; // PEIE/GIEL: Peripheral Interrupt Enable bit
while (1)
{
Delay1KTCYx(50); // Delay 50 x 1000 = 50,000 cycles; 200ms @ 1MHz
}
}