int main(void) { GPIO_Configuration(); InitLCD(); RCC_Configuration(); uint8_t Pos=60; while (1) { /*ClrScr(); Pos+=1; DrawRectangle(Pos,Pos,242-2*Pos,130-2*Pos,clBlack); DrawRectangle(Pos-20,Pos-20,242-2*(Pos-20),130-2*(Pos-20),clBlack); DrawRectangle(Pos-40,Pos-40,242-2*(Pos-40),130-2*(Pos-40),clBlack); ShowForm(165,5,70,80); DrawRectangle(1,1,240,128,clBlack); RefreshLCD(); if (Pos==64) {Pos=44;};*/ DrawFillRectangle(1,1,240,128,clWhite); RefreshLCD(); Delay(500); DrawFillRectangle(1,1,240,128,clBlack); RefreshLCD(); Delay(500); } }
// Main function void main(void) { InitLCD(); // Initialize LCD InitI2C(); // Initialize i2c pins // Set initial time Set_DS1307_RTC_Time(TwentyFourHoursMode, 12, 59, 50); // Set time 08:32:59 AM // Set initial date Set_DS1307_RTC_Date(15, 12, 12, Saturday); // Set 15-12-2012 @ Saturday while(1) { SetTime(); // Display RTC time on first line of LCD DisplayTimeToLCD(Get_DS1307_RTC_Time()); // Display RTC date on second line of LCD DisplayDateOnLCD(Get_DS1307_RTC_Date()); __delay_ms(100); // 1 second delay } }
void setup() { uint8_t vid,pid; uint8_t temp; UTFT(); PiCAM(OV7670); printf("ArduCAM Start!\n"); //Check if the ArduCAM SPI bus is OK write_reg(ARDUCHIP_TEST1, 0x55); temp = read_reg(ARDUCHIP_TEST1); if(temp != 0x55) { printf("SPI interface Error!"); while(1); } //Change MCU mode write_reg(ARDUCHIP_MODE, 0x00); //Initialize the LCD Module InitLCD(); InitCAM(); }
int main(void) { // wdt_disable(); /* Stop watchdog timer */ configurePorts(); InitLCD(0x03); /** Initialise the OS stuff, setup the control and receive tasks, and jump to the OS. */ initNartos(); // controlTaskID = taskStart((uint16_t)*controlTask,FALSE); testLCDID = taskStart((uint16_t)*testLCD,FALSE); nartos(); // for (;;) // { // LCDByte(0,0x00); // LCDByte(0,0x08); // LCDWriteString("Hello"); // LCDWriteString("A"); // LCDByte(1,0x41); // LCDByte(1,0x43); // LCDByte(1,0x50); // LCDByte(1,0x49); // LCDByte(1,0x41); // } // for (;;) // { // uint8_t x=0; // } }
void initializeSystem(void ) { OSCCON = 0x0701; // Use fast RCoscillator with Divide by 16 CLKDIV = 0x0100; // Divide by 2 OSCTUN = 17; // Tune for Fcpu = 2 MHz TMR1 = 0; // Initialize Timer1 to zero PR1 = 20000 - 1; // LoopTime = 10 ms with 4Mhz clock T1CON = 0x8000; // Count CPU clock cycles //Setup Avago Color Sensor setupAvagoColorSensor(); //Setup Taos LTF setupTaosLightToFreqSensor(); //Setup LED Enable Pin pinModeSet(&LED_EN_PORT, LED_EN_PIN, outputMode); //Setup Pushbutton Pin pinModeSet(&PB_PORT, PB_PIN, inputModeWithPullup); //Setup LCD InitLCD(); // Initialize LCD Display(RedStr); // Display initial message Display(GreenStr); Display(BlueStr); }
void main(void) { TRISA = 0xff; TRISC = 0X00; TRISD = 0X00; InitLCD(); // Initialize LCD InitI2C(); // Initialize i2c pins state = 1; // Khoi tao gia mac dinh //__delay_ms(10000) // Tre 1s Set_DS1307_RTC_Time(PM_Time, 2, 30, 30); // kh?i t?o ngày tháng m?c ??nh Set_DS1307_RTC_Date(04, 04, 16, Tuesday); DisplayFirstTimeToLCD(Get_DS1307_RTC_Time()); while (1) { switch (state) { case 1: displayState1(); break; case 2: displayState2(); break; case 3: displayState3(); break; case 4: displayState4(); break; } } }
/** ****************************************************************************** ** Main application to control the program flow *****************************************************************************/ void main(void) { // Initialize all interrupt levels of resources Vectors_InitIrqLevels(); // Allow all interrupt levels __set_il(7); // Enable interrupts __EI(); Flash_EnableWriting(); InitLCD(); #if ((SMC_TYPE != SMC_TYPE_R200) && (ZPD == ZPD_ENABLE)) ZPD_Init(); //ќжидание окончани¤ ZPD while (m_enSmcMode == Zpd) { WDTCP = 0x00; } #else m_enSmcMode = NormalDriving; #endif InitSMC(20); Timer_Init(); InitADC(); InitRTC(); // ≈сли двигатель R200 или ZPD не активно #if ((SMC_TYPE == SMC_TYPE_R200) || (ZPD == ZPD_DISABLE)) ZeroPosSMC(); Timer_Wait(TIMER_ID_MAIN, 2000, TRUE); #endif ClearPosSMC(); DriverInit(); InitFRTimer0(); InitExtInt0(); //test Init_4_imp(); InitBacklight(); Button_Init(ButtonCallback); CAN_Init(); J1939_init(); InitUsart0(); if (Button_GetCurrentButtonState(BUTTON_ID_B1) == StateLow) SetModePass(); while(1) { WDTCP_ = 0x00; Timer_Main(); } }
void main() { InitLCD(); while(1) { GetTime(); xian1(); xian2(); } }
int main(void) { ms = 0; InitGPIO(); InitLCD(); InitSysTick(); limpaLCD(); for(;;) { } }
int main( void ) { unsigned int i; InitPorts(); InitLCD(); clearDisplay(); printString("Test LCD"); Delay(10000); return 0; }
void initRobit() { //Initialize POB-EYE (lib), POB-LCD (lib), POB-PROTO(file Functions.c) and Servomotors InitPobeye2(); InitI2C(I2C_100_KHZ); InitCameraPobeye2(); InitLCD(); // Even though this project doesn't directly use the joystick, still set up // the ports to allow reading/writing of values to the DC motors SetupJoystick(); SwitchOnAllServo(); initCameraAndLCD(); }
/************************************************************************ * Initial() * * This function performs all initializations of variables and registers. * * DO NOT CHANGE ANYTHING IN THIS FUNCTION ************************************************************************/ void Initial() { ADCON1 = 0b10001110; // Enable PORTA & PORTE digital I/O pins TRISA = 0b11100001; // Set I/O for PORTA TRISB = 0b11011100; // Set I/O for PORTB TRISC = 0b11010000; // Set I/0 for PORTC TRISD = 0b00001111; // Set I/O for PORTD TRISE = 0b00000000; // Set I/O for PORTE PORTA = 0b00010000; // Turn off all four LEDs driven from PORTA RPGCNT = 0; // Clear counter to be displayed InitLCD(); // Initialize LCD }
int Playback() { int nmemb = 1; FILE *bmppath,*fnum,*photo; system("dir /home/pi/*.bmp > /home/pi/bmp.txt"); printf("Camera Playback. \n"); write_reg(ARDUCHIP_MODE, 0x00); //Switch to MCU InitLCD(PORTRAIT); fnum = fopen("/home/pi/bmp.txt","r"); fseek(fnum, 0, SEEK_END); int size = ftell(fnum); fclose(fnum); printf("There are %d bmp photos.\n",size/28); char files[size]; bmppath = fopen("/home/pi/bmp.txt","r+"); fread(files,size,nmemb,bmppath); fclose(bmppath); //printf("%s",files); char *p; char str[28]; p = index(files,'/'); while(p!=0) { memset(str,'\0',28); memcpy(str,p,27); printf("display photo %s.\n",str); memset(p,'0',27); p = index(files,'/'); //if(read_reg(ARDUCHIP_TRIG)& SHUTTER_MASK) //{ //p=0; //break; //} //Open the new file photo = fopen(str,"r"); if (photo == NULL) { printf("open file failed.\n"); //return 0; } //clrScr(); //myGLCD.resetXY(); dispBitmap(photo); fclose(photo); } printf("Finish playback.\n"); return 1; }
/** * @fn void MCUInit() * * @brief Sets the microcontroller to a predetermined state. Handles initialization * for all categories of peripherals: Analog, Architecture, Communication, * Data Converters, GPIO, LCD, Special Modules, Timers. * */ void MCUInit() { #if defined(__MCU_MSP430_SERIES) InitAnalog(); // Initialize the Analog modules InitArchitecture(); // Initialize the Architecture modules InitCommunication(); // Initialize the Communication modules InitDataConverters(); // Initialize the Data Converter modules InitGPIO(); // Initialize the GPIO modules InitLCD(); // Initialize the LCD modules InitSpecialModules(); // Initialize the Special modules InitTimers(); // Initialize the Timers modules #endif }
void LCDconfig() { // Configure the LCD pins for output LCD_RS_TRIS = 0; //TRISH1 LCD_E_TRIS = 0; //TRISH2 LCD_DATA_TRIS = 0b00001111; // TRISJ, Note the LCD is only on the upper nibble // The lower nibble is all inputs // Initialize the LCD and print to it InitLCD(); DisplayC(LCDRow1); DisplayC(LCDRow2); }
int main() { InitRCC(); InitVTimers(); InitControllerPeripheral(); SetInitialConditions(); InitLCD(); while(1) { ControllerDisplayDataTask(); } return 0; }
int main(int argc, char** argv) { WORD KeyVal; char ResString[10]; void Ludacris_Speed_GO(void); Ludacris_Speed_GO(); InitGlobals(); InitLCD(); Timer1_Setup(); UART1_Config(); Pin_Setup(); printf("\nUART Configured\n\n"); while(1) { __delay_ms(250); PutsXLCD("No Workie! "); if(!Calculate) { if(TriggerGetKeys) { KeyVal = GetKeyPressed(); FindKey(KeyVal); if(Key != NULL) { ParseInput(Key); } TriggerGetKeys = 0; } } else { DoCalculate(); printf("%f\n", Terms.Result); sprintf(ResString, "%f", Terms.Result); PutsXLCD(ResString); TriggerGetKeys = 0; Calculate = 0; GotOperand1 = 0; GotOperand2 = 0; Operation = NO_OP; } } return (EXIT_SUCCESS); }
int main(void) { // wdt_disable(); /* Stop watchdog timer */ configurePorts(); InitLCD(); uint8_t data[16]; uint8_t control = 0; for (uint8_t i=8; i>0; i--) { data[i] = 35; } displayLCD(data,control); for (;;) { displayLCD(data,control); } }
void _init(){ /******************* Pin Configuration ***********************/ DDRA = 0xff; // PORTA = output DDRB = 0x1; // PORTB.0 = output (backlight) BUTTON_PORT = 0x13; // pins 0,1,4 of BUTTON_PORT (portE) are pulled high /******************* ADC Setup / Temperature first *********************/ ADCSRA = (1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); // ADC Prescaler = Fck/128 ADCSRA |= (1<<ADFR)|(1<<ADEN)|(1<<ADIE); // Free-running mode, enabling ADC and ADC Interrupt /******************* PWM Setup *********************/ //DDRB |= (1<<PB7); //OCR2 = 64; //TCCR2 = (1<<WGM21)|(1<<WGM20)|(1<<COM21)|(1<<CS20)|(1<<CS21); /******************* LCD Setup *********************/ InitLCD(0); LCDClear(); LCDWriteStringXY(CLOCK_CURSOR_POSITION,0,"00:00"); LCDWriteStringXY(0,1,"T=00.0"); LCDByte(0b11011111, 1); // Scrive il carattere °: dalla tabella 4 del datasheet HD44780.pdf vediamo che il carattere è 11011111; // lo mandiamo come byte (LCDByte()) sapendo che dobbiamo mettere RS a 1 (dato!) LCDWriteStringXY(HUM_CURSOR_POSITION-4, 1, "C_H=88%"); LCDWriteStringXY(ZONE_CURSOR_POSITION-1,1,"_1"); /******************* RTC Setup *********************/ TCCR0 |= (1<<CS02)|(1<<CS01)|(1<<CS00); // clock: F_CPU / 1024 TCCR0 |= (1<<WGM01)|(0<<WGM00); // Clear Timer on Compare TIMSK |= (1<<OCIE0); // Output compare match interrupt enable OCR0 = 156; // Interrupt every 10ms /******************* Timer2 setup: backlight *********************/ //TCCR2 |= (1<<CS22)|(0<<CS21)|(1<<CS20); // clock: F_CPU / 1024 TCCR2 |= (1<<WGM21)|(0<<WGM20); // Clear Timer on Compare TIMSK |= (1<<OCIE2); // Output compare match interrupt enable OCR2 = 156; // Interrupt every 10ms sei(); ADCSRA |= 1<<ADSC; // ADC Start Conversion }
void main() { P1=0x00; P2=0x00; SerialInput(); InitLCD(); EA=1; ES=1; EX1=1; while(1) { ClearLCDScreen(); WriteStringToLCD("IDLE"); delayms(100); } }
void main (void) { int cnt = 0; InitDevice (); Delay10KTCYx (250); InitializeUSB (); InitLCD (); /* UCONbits.USBEN = 0; */ /* UCFGbits.UTRDIS = 0; */ /* UCFGbits.UPUEN = 1; */ /* UCFGbits.FSEN = 1; */ USBDeviceAttach (); while (1) { WriteLCDChar (UCONbits.USBEN ? '0' : '1'); WriteLCDChar (UCFGbits.FSEN ? '0' : '1'); WriteLCDChar (UCFGbits.UTRDIS ? '0' : '1'); WriteLCDChar (UCFGbits.UPUEN ? '0' : '1'); WriteLCDChar ('0' + UCFGbits.PPB); WriteLCDChar ('-'); WriteLCDChar ('0' + USTATbits.ENDP); WriteLCDChar ('0' + USTATbits.DIR); WriteLCDChar ('0' + USTATbits.PPBI); WriteLCDChar ('-'); putNumber (USBDeviceState); WriteLCDChar ('-'); putNumber (cnt++); // if (USBDeviceState == DETACHED_STATE) // USBDeviceAttach (); Delay10KTCYx (1000); LCDHome (); Delay10KTCYx (10); } // if (USBDeviceState < CONFIGURED_STATE) // continue; // bitset (PORTB, E_PORT); // Delay10TCYx (10); // ClearLCD (); // bitclr (PORTB, E_PORT); // Delay10TCYx (10); // } }
main() { P2=0xff; //make output port SerialInput(); InitLCD(); EA=1; ES=1; while(1) { ClearLCDScreen(); while(ps2_clk==1); keyval=scan_data(); WriteDataToLCD(keyval); encrypt_data=keyval+3 35SerialTransmit(); delayms(100); } }
//---------------------------- void main() { char ru; InitSystemClock(); InitPortsIO(); InitSPI(); //InitTimers(); //EnableInterrupts(); InitLCD(); DrawFillRectangle(1,1,130,130,0x000000);//Background ru=PIND; //DrawText(1,1,"Hello /@",1); for (char i=1;i<=255;i+=2) { DrawFillRectangle(1,i/2,130,1,i); }; while (1) { } }
/** Main program entry point. This routine contains the overall program flow, including initial * setup of all components and the main program loop. */ int main(void) { SetupHardware(); InitLCD(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { CheckJoystickMovement(); /* Must throw away unused bytes from the host, or it will lock up while waiting for the device */ CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); CDC_Device_USBTask(&VirtualSerial_CDC_Interface); HID_Device_USBTask(&Mouse_HID_Interface); USB_USBTask(); } }
void ClearGraf(void){ int i; InitLCD(); Send2(cmdAddrPtr,GrfHomeAddr); SendCmd(cmdOnAutoWr); //---- очистка графического экрана ------- for(i=0; i < 40*64; i++) { ReadStatus(8); // CLREA; LCD_DATA_OUT(0); ClrCMD; ClrCE; //Разрешение записи в дисплей ClrWR; Delay(1); SetWR; SetCE; //Запрещение записи в дисплей // SETEA; } SendCmd(cmdOffAuto); }
void main() { P5M1 &= ~(0xff); P5M0 |= 0xff; P0M1 &= ~(0xff); P0M0 |= (0xff); P6M1 &= ~(0xff); P6M0 |= (0xff); LCD_LED = 1; InitLCD(); CleanLCD(0x00); // wlc(0xae); // wlc(0xaf); // wlc(0xaf); // // CleanLCD(0xf0); // wlc(0xae); // wlc(0xaf); // wlc(0xaf); // while(1); // DisplayString1608(0,0,"ABCDEFGHIJKLMNOPQRSTUVWX"); // DisplayString1608(2,0,"YZabcdefghijklmnopqrstuv"); // DisplayString1608(4,0,"wxyz12345678901234567890"); // DisplayString1608(6,0,"123456789012345678901234"); //------------------------------------------------ DisplayString1608(3,8*0,"Qu Ming Yang"); DisplayString1608(6,8*18,"4GOT10"); // DisplayString1616(6,96,"中国建设银行"); //------------------------------------------------ // DisplayString1616(6,96,"中国建设银行"); LCD_LED = 0; while(1); }
//********************************************************** //Set it all up void initialize(void) { //set up the ports // PortA: Buzzer, output DDRA=0xff; PORTA=0; // PortB: LEDs, output DDRB=0xff; PORTB=0; // PortD: Switches, input DDRD=0x00; //set up timer 0 for 1 mSec ticks TIMSK0 = 2; //turn on timer 0 cmp match ISR OCR0A = 249; //set the compare reg to 250 time ticks TCCR0A = 0b00000010; // turn on clear-on-match TCCR0B = 0b00000011; // clock prescalar to 64 //init the LED status (all off) buzzer = 0; //init the task timers elapsedTime = 0; gameState = INITIAL; readyDisplayed = 0; randomTimeChosen = 0; ledTurnedOn = 0; scoreDisplayed = 0; cheatDisplayed = 0; //initialize the LCD InitLCD(); //init the UART -- uart_init() is in uart.c //uart_init(); //stdout = stdin = stderr = &uart_str; //fprintf(stdout,"Starting...\n\r"); //crank up the ISRs sei(); }
void setup() { uint8_t vid,pid; uint8_t temp; UTFT(); arducam(smOV5642); printf("ArduCAM Start!\n"); //Check if the ArduCAM SPI bus is OK arducam_write_reg(ARDUCHIP_TEST1, 0x55); temp = arducam_read_reg(ARDUCHIP_TEST1); if(temp != 0x55) { printf("SPI interface Error!\n"); exit(EXIT_FAILURE); } //Change MCU mode arducam_write_reg(ARDUCHIP_MODE, 0x00); InitLCD(); //Check if the camera module type is OV5642 arducam_i2c_word_read(OV5642_CHIPID_HIGH, &vid); arducam_i2c_word_read(OV5642_CHIPID_LOW, &pid); if((vid != 0x56) || (pid != 0x42)) { printf("Can't find OV5642 module!\n"); exit(EXIT_FAILURE); } else { printf("OV5642 detected\n"); } //Change to BMP capture mode and initialize the OV5642 module arducam_set_format(fmtBMP); arducam_init(); }
// Main function void main() { InitLCD(); // Initialize LCD InitI2C(); // Initialize i2c pins // Set initial time Set_DS1307_RTC_Time(AM_Time, 8, 32, 59); // Set time 08:32:59 AM // Set initial date Set_DS1307_RTC_Date(2, 11, 12, Friday); // Set 02-11-2012 @ Friday while(1) { // Display RTC time on first line of LCD DisplayTimeToLCD(Get_DS1307_RTC_Time()); // Display RTC date on second line of LCD DisplayDateOnLCD(Get_DS1307_RTC_Date()); delay(65000); // Roughly about 1 second delay } }
void main( void ) { /* Configure the peripherals used by this demo application. This includes configuring the joystick input select button to generate interrupts. */ prvSetupHardware(); InitButton(); InitLCD(); InitADC(); /* Create the other task in exactly the same way. */ xTaskCreate( ReadButton, "Button", 100, NULL, 1, NULL ); xTaskCreate( ReadADC, "ADC", 100, NULL, 1, NULL ); xTaskCreate( DisplaySignal, "Signal", 100, NULL, 2, NULL ); xTaskCreate( DisplayMenu, "Menu", 100, NULL, 3, NULL ); xTaskCreate( DisplayInfo, "Info", 100, NULL, 3, NULL ); /* Start the scheduler. */ vTaskStartScheduler(); for( ;; ); }