Пример #1
0
// Master function for obtaining the information needed
//  	to define the reflow curve
//  	choice: 0 - default
//  	        1 - user-defined
void CurveInput::loadCurve( boolean choice )
{
	if ( !choice ) // Default
	{
		loadDefault(); // get the default times and temps
		initLCD(&col, &row);
		lcd.print("Loaded Default");
	}
	else
	{
		loadUserCurve(); // get the user's times and temps
		initLCD(&col, &row);
		lcd.print("Loaded User");
	}
}
Пример #2
0
void initBoard(void){

	//if LCD display is connected (default)
#ifndef	NO_LCD
	initLCD();
	clearLCD();
#endif

	//	Set buttons as inputs

	SW_C_IN;
	SW_N_IN;
	SW_E_IN;
	SW_S_IN;
	SW_W_IN;

	//	Enalbe pullups for the switches

	SW_C_HIGH;
	SW_N_HIGH;
	SW_E_HIGH;
	SW_S_HIGH;
	SW_W_HIGH;

	//	Set led pins as output

	LEDS_DIR = PORT_HIGH;	//LED pins as output
	LEDS = PORT_LOW;		//Turn LEDs off






}
Пример #3
0
void main(void)
{
        initLCD();

        
        while(1)
        {
LCD_goto(2,0);
LCD_num(hour);
LCD_goto(2,2);
        LCD_Write(':',1);delay_ms(100);
LCD_goto(2,3);
LCD_num(min);
LCD_goto(2,5);
        LCD_Write(':',1);delay_ms(100);
                LCD_goto(2,6);
        LCD_num(sec);
                sec++;
        
                delay_ms(500);
                if(sec==10){
                        sec=00;
                        min++;
                if (min==10)
        {min=0;
hour++;
}

}




        }
}
Пример #4
0
/*
 * The myTestLCD() function was originally created for preliminary testing *DEPRECATED*
 */
void myTestLCD() {
    char test = 0b01100110;
    initLCD();
    
    /*
    LATCbits.LAT_RS = DATA;
    LATEbits.LAT_D7 = ((test>>4)&0b1000) >> 3;
    LATEbits.LAT_D6 = (test>>4)&0b0100;
    LATEbits.LAT_D5 = (test>>4)&0b0010;
    LATEbits.LAT_D4 = (test>>4)&0b0001;
    
    toggleE();
    
    LATCbits.LAT_RS = DATA;
    LATEbits.LAT_D7 = DISABLED;
    LATEbits.LAT_D6 = ENABLED;
    LATEbits.LAT_D5 = ENABLED;
    LATEbits.LAT_D4 = DISABLED;
    
    toggleE();
     * */
    writeFourBits(0b0110, DATA, 500, 1);
    writeFourBits(0b0110, DATA, 500, 1);
   // moveCursorLCD(0, 4);
   //printCharLCD('S');
}
Пример #5
0
int main(void) {
	initLCD(display_cmd_buffer, 32);
	sendLCDCmd(LCD_CMD_CLEAR);
	serviceLCD(); // Clear the LCD just to make sure we know where we are.
	_delay_ms(2); // This takes a long time
	sendLCDCmd(LCD_CMD_DSP_ON);

	// Configure the ADC
	initADC();
	sei();
	sendCommand(CMD_STOP);
	sendCommand(CMD_SDATAC);
	uint8_t registers[] = {0x10, 0x10, 0x10, 0x10, 0x90, 0x90, 0x90, 0x90};
	writeRegisters(0x05, registers, 8);

	// Configure data ready interrupt
	DDRB &= ~(1<<4);
	PCMSK0 = 1<<4;

	sendCommand(CMD_START);
	sendCommand(CMD_RDATAC);
	PCICR |= 1;
	char buf[6];
	while (1) {
		itoa(inputBuffer[0], buf, 10);
		LCD_MOVE_TO_CHAR(0,0);
		writeString(buf, 6);
		for (int i = 0; i < 10; i++) {
			serviceLCD();
			_delay_us(60);
		}
		_delay_ms(100);
	}
}
Пример #6
0
void Screen::showStdLatLon(double latdeg, double latmin, double londeg, double lonmin, double altitude, double distance)
{
  double targetDistance = 0.0;
  int feet = 0;
 
  initLCD(1); // initialize LCD for size 1

  
  display.print("Latitude : "); 
  displayCoordinate(latdeg, latmin);

  display.print("Longitude: ");
  displayCoordinate(londeg, lonmin);
  
  display.print("Altitude : "); display.print(altitude); display.print(" ft\r\n");
  
  targetDistance = distance;    
  
  display.print("Distance : ");
  if(targetDistance >= 1.00)
  {
    display.print(targetDistance); display.print(" mi\r\n");
  }
  else
  {
    feet = (int)(targetDistance * 5280);
    display.print(feet); display.print(" ft\r\n");
  }
  
  display.display();
}
Пример #7
0
void startupInit(void)
{
  /*
   * NOTE!
   * As different MCU is used (F1 and F4) then different clocks must be inited!
   *
   * For example:
   *  - stm32f1xx works on 72Mhz Sys clock and use "#define SYSCLK_FREQ_72MHz  72000000";
   *  - stm32f4xx work on 168MHz Sys clock and use a lot of manual settings in PLLs.
   *
   * Both initialization located in "system_stm32fyxx.c", where "y" mean model f1 or f4;
   */

  SystemInit(); // init clocks and another s...
  initSysTickTimer();

  init_GPIO_RCC();
//  initRand();
  initLCD();         /* initialize a ILI9341 chip */

  setRotation(1); // horizontal
  loadDefaultPalette();
  initRaycasterPointers();
  drawBootLogo();

  // Init SD and SPI_2 after all inited
  sd_spi_init(); // init SPI_2 or SPI_3 for SD card
}
Пример #8
0
main( void)
{
    initEX16();
    initLCD();
    putsLCD( "Insert card...\n");
    while ( !getCD());
    Delayms( 100);
    
    if ( !mount())
        putsLCD("Mount Failed");
    else
    {  
        clrLCD();
        putsLCD("Playing...");
        if ( !playWAV( "NELLY.WAV"))
        {
            clrLCD();
            putsLCD("File not found");
        }
    } 

    while( 1)
    {
    } // main loop

} //main 
Пример #9
0
int main() {
	initLCD();
	LCD_goto(1,0);
	lcd_puts("AVRLCD 4bit mode");
        uchar i;
		  DDRB = 1; // PB0 as output
    wdt_enable(WDTO_1S); // enable 1s watchdog timer

    usbInit();
        
    usbDeviceDisconnect(); // enforce re-enumeration
    for(i = 0; i<250; i++) { // wait 500 ms
        wdt_reset(); // keep the watchdog happy
        _delay_ms(2);
    }
    usbDeviceConnect();
        
    sei(); // Enable interrupts after re-enumeration
        
    while(1) {
        wdt_reset(); // keep the watchdog happy
        usbPoll();
    }
        
    return 0;
}
Пример #10
0
int main(void) {
    initLCD();
	char chr1[] = {0x15, 0xa, 0x15, 0xa, 0x15, 0xa, 0x15, 0xa};
	char chr2[] = {0x1f, 0x11, 0xa, 0x4, 0x4, 0x4, 0x4, 0x4};
	char chr3[] = {0x0, 0x3, 0x0, 0x7, 0x0, 0xf, 0x0, 0x1f};
	char chr4[] = {0x4, 0xa, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0};
	char chr5[] = {0x0, 0xe, 0x11, 0x1b, 0x11, 0x15, 0xe, 0x0};
	char chr6[] = {0x0, 0x0, 0x0, 0x4, 0x4, 0x1f, 0xe, 0x4};
	char chr7[] = {0x0, 0x3, 0x4, 0xe, 0x1f, 0x17, 0x1b, 0xe};
	char chr8[] = {0x1f, 0x15, 0xe, 0x4, 0x1f, 0x4, 0xa, 0x11};
						
	uploadCustomCharacterAt(0, chr1);
	uploadCustomCharacterAt(1, chr2);
	uploadCustomCharacterAt(2, chr3);
	uploadCustomCharacterAt(3, chr4);
	uploadCustomCharacterAt(4, chr5);
	uploadCustomCharacterAt(5, chr6);
	uploadCustomCharacterAt(6, chr7);
	uploadCustomCharacterAt(7, chr8);
	
	clearLCD();
	printLCDXY("Custom Characters",0,0);
	gotoLCD(1,1);
	characterLCD(0);
	characterLCD(1);
	characterLCD(2);
	characterLCD(3);
	characterLCD(4);
	characterLCD(5);
	characterLCD(6);
	characterLCD(7);
}
Пример #11
0
void InitApp(void)
{
    initLCD();
    ADCON1bits.VCFG1=0;
    ADCON1bits.VCFG0=0;
    ADCON1bits.PCFG = 0xE;

    ADCON0bits.CHS = 0;

    ADCON2bits.ACQT = 0;
    ADCON2bits.ADCS = 0x7;
    ADCON2bits.ADFM=1;

    ADCON0bits.ADON=1;
    
    INTCONbits.GIE=0;
    
    T0CONbits.T08BIT=0;
    T0CONbits.T0CS=0;
    T0CONbits.PSA=1;
    T0CONbits.T0PS=0;
    T0CONbits.TMR0ON=1;
    INTCONbits.T0IF=0;
    INTCONbits.T0IE=1;
    
    INTCONbits.GIE=1;
}
Пример #12
0
void init()
{
    WDTCTL = WDTPW + WDTHOLD; // disable WDT
    BCSCTL1 = CALBC1_1MHZ; // 1MHz clock
    DCOCTL = CALDCO_1MHZ;

    P1OUT = 0;
    P2OUT = 0;
    P1DIR = 0;
    P2DIR = 0;

    WDTCTL = WDT_ADLY_1000;                   // WDT 1s interval timer
    IE1 = WDTIE;                             // Enable WDT interrupt

    P1DIR |= LCD5110_SCE_PIN + LCD5110_DC_PIN + BACKLIGHT;
    P1OUT |= LCD5110_SCE_PIN + LCD5110_DC_PIN;

    SPI_init();
    __delay_cycles(50000);
    initLCD();
    clearLCD();

    defaultRX = 0;
    NRF_init(86);
    NRF_down();

    initKeyboard();
    // end init
};
Пример #13
0
/**
 * setup
 * Initialises all appropriate global-level variables and sets up all modules
 * appropriately. Also retrieves previous state from EEPROM.
 */
void setup()
{
    char welcomeStr1[] = "Welcome to ";
    char welcomeStr2[] = "   FennecScales!";

    int timer = 0;
    setupPower();

    retrieveState();
    initialiseRS232();
    initialiseADC();
    setupTMR1();
    setupSPI();
    //initialiseEEPROM();
    //initiateTTS();
    initLCD();
    initialiseNumPad();
    //initialisePushBtn();

    clearLCD();
    stringToLCD(welcomeStr1, LCD_LINE_1);
    stringToLCD(welcomeStr2, LCD_LINE_2);

                /* Configure interrupts */
    INTCONbits.GIE = 1; // Enable global interrupts and priority
    INTCONbits.PEIE = 1;
    RCONbits.IPEN = 1;

    for (timer = 0; timer <= 0x3FF; ++timer)
    {
        writeLEDbar(timer, 0x3FF);
        
    }

}
Пример #14
0
void main(void) {
	/* your definitions here */
	char data = 0xaa;
	char data2 = 0x55;
	char y;
	// init buttons and seven-segment displays
	initIO();
	// init LCD
	initLCD();
	lcd_onOff(1, 0);
	
	/* your code here */
	




	for (;;) {
		for (y = 0; y < 8; y++) {
			printOnLCD(y, 0, 63, data);
		}
		wait(1000000l);
		for (y = 0; y < 8; y++) {
			printOnLCD(y, 0, 63, data2);
		}
		wait(1000000l);
	}
}
Пример #15
0
int
main (void) {
  char msg[30];
  unsigned char c; int i=0;
  int counter[3];
ioinit();
  //initTimer();
  initTimer2();
  initPWM();
  initLCD();
  //initPWM();
  USART_Transmit_String("Restarting..\r\n");
        wait(10);
    //LCD_gotoXY(1,0);
    //LCD_Write("Out-PWM-BC1");
     while (1) {
      unsigned int en, en1;
      asm("nop");
      cli();
       en = topup_timer2;
       en1 = timestamp[0];
      sei();
      sprintf(msg, "%04x,%04x", en, en1);
      USART_Transmit_String(msg);
      LCD_gotoXY(0,0);
      LCD_Write(msg);
    }
    return 0;
}
Пример #16
0
// Allows user to change and select the time point
//  	index: index of the current time point
int CurveInput::getTimePoint( int index )
{
	initLCD(&col, &row);
	lcd.print("Enter Time ");
	lcd.print(index);
	lcd.print(" (s)");
	lcd.setCursor(0, 1);
	byte buttonID = NONE;
	int thisTime = times[index]; // scoping current time
	lcd.print(thisTime);
	col = 0; row = 1;
	lcd.setCursor(col, row);
	delay(SELECT_DURATION);
	int lowerLimit, upperLimit;
	getTimeLimits(index, &lowerLimit, &upperLimit);
	while ( buttonID != SELECT ) // any button other than SELECT
	{
		buttonID = btn.waitForButton();
		thisTime = btn.actionIncDec(buttonID, TIME_TEMP_DURATION,
		                            col, row, thisTime, 3,
		                            lowerLimit, upperLimit);
		                            // user adjusts time
	}
	return thisTime;
}
Пример #17
0
/******************************************************************************
 * Function:        void InitializeSystem(void)
 *
 * PreCondition:    None
 *
 * Input:           None
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        This routine takes care of all of the system
 *                  initialization that is required.
 *
 * Note:
 *
 *****************************************************************************/
void InitializeSystem(void)
{
    initDelayms();                  // Delayms() must be initialized first
    initAllIndicators();            // Init all Explorer 16 LEDs
    initAllSwitches(SWITCH_DEBOUNCE_MS);  // Init all Explorer 16 switches

    /* Enable ADC to the Potentiometer channel and configure it as 10 bit
     interrupt driven mode */
      ADC_ChannelEnable ( ADC_CHANNEL_POTENTIOMETER ) ;
      ADC_SetConfiguration ( ADC_CONFIGURATION_EXP16_DEMO ) ;


    initLCD();                      // Init LCD

    //Initialize Debug Console UART interface
    initConsole(PB_CLOCK_FREQ);
    clrscrConsole();
    homeConsole();
    putsConsole("wifly_pass_thru_demo_exp16_p24...\r\n");
    sprintf(OutString,"version: %s\r\n", Version);
    putsConsole(OutString);
    sprintf(OutString,"build date: %s\r\n", CompileDate);
    putsConsole(OutString);
    sprintf(OutString,"build time: %s\r\n\r\n", CompileTime);
    putsConsole(OutString);
    sprintf(OutString,"use a terminal emulator to communicate directly with the module...\r\n\r\n");
    putsConsole(OutString);
    sprintf(OutString,"(optional) press S4 on Explorer16 to reset WiFly to factory defaults...\r\n\r\n");
    putsConsole(OutString);
    initWiFly(PB_CLOCK_FREQ);
}
Пример #18
0
void main() {

	unsigned int	x, y, button_press;

	// === Initialize system ================================================
	IFG1=0; /* clear interrupt flag1 */
	WDTCTL=WDTPW+WDTHOLD; /* stop WD */
	button_press = FALSE;

	initMSP();
	initLCD();
	
	x=4;		y=4;
	drawBox(x, y);

	while(1) {
		if (UP_BUTTON == 0){
			y = y - 10;
			drawBox(x, y);
		}
		//the bulk of your code goes here


			}

}
Пример #19
0
/******************************************************************************
 * Function:        void InitializeSystem(void)
 *
 * PreCondition:    None
 *
 * Input:           None
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        This routine takes care of all of the system
 *                  initialization that is required.
 *
 * Note:
 *
 *****************************************************************************/
void InitializeSystem(void)
{

    initDelayms();                  // Delayms() must be initialized first
    initAllIndicators();            // Init all Explorer 16 LEDs
    initAllSwitches(SWITCH_DEBOUNCE_MS);  // Init all Explorer 16 switches
    initLCD();                      // Init LCD

    //Initialize Debug Console UART interface
    initConsole(PB_CLOCK_FREQ);
    clrscrConsole();
    homeConsole();
    putsConsole("wifly_pass_thru_demo_exp16_p24...\r\n");
    sprintf(OutString,"version: %s\r\n", Version);
    putsConsole(OutString);
    sprintf(OutString,"build date: %s\r\n", CompileDate);
    putsConsole(OutString);
    sprintf(OutString,"build time: %s\r\n\r\n", CompileTime);
    putsConsole(OutString);
    sprintf(OutString,"use a terminal emulator to communicate directly with the module...\r\n\r\n");
    putsConsole(OutString);
    sprintf(OutString,"(optional) press S4 on Explorer16 to reset WiFly to factory defaults...\r\n\r\n");
    putsConsole(OutString);
    initWiFly(PB_CLOCK_FREQ);
}
Пример #20
0
int main( void )
{
	initLCD();
	
	keyboardInit( );
	
	
	LCD_goto(1,0);
	lcd_puts("START KEYBOARD!");
	LCD_goto(2,0);
	lcd_puts("ONE");	
	
	sei();

	while( 1 )
	{
		
				
					LCD_goto(2,8);
					LCD_num(count);		
		
			
		
	}
	return 0;
}
Пример #21
0
// Allows user to change and select the temperature point
//  	index: index of the current temperature point
int CurveInput::getTempPoint( int index )
{
	initLCD(&col, &row);
	lcd.print("Enter Temp ");
	lcd.print(index);
	lcd.print(" (C)");
	lcd.setCursor(0, 1);
	byte buttonID = NONE;
	int lowerLimit, upperLimit;
	temps[index] = getTempLimits(index, &lowerLimit, &upperLimit);
	int thisTemp = temps[index]; // scoping
	lcd.print(thisTemp);
	col = 0; row = 1;
	lcd.setCursor(col, row);
	delay(SELECT_DURATION);
	while ( buttonID != SELECT ) // any button other than SELECT
	{
		buttonID = btn.waitForButton();
		thisTemp = btn.actionIncDec(buttonID, TIME_TEMP_DURATION,
		                            col, row, thisTemp, 3,
									lowerLimit, upperLimit);
		                            // user adjusts temperature
	}
	return thisTemp;
}
Пример #22
0
// Allows user to change and select the time point
//  	index: index of the current time point
int CurveInput::getTimePoint( int index )
{
	initLCD(&col, &row);
	lcd.print("Duration ");
	lcd.print(index);
	lcd.print(" (s)");
	lcd.setCursor(0, 1);
	byte buttonID = NONE;
	int lowerLimit = 1;
	int upperLimit = 150;
	//times[index] = getTimeLimits(index, &lowerLimit, &upperLimit);
	int duration;
	if ( index == 1 ) duration = 125;
	else if ( index == 2 ) duration = 90;
	else if ( index == 3 ) duration = 90;
	else duration = 30;
	lcd.print(duration);
	col = 0; row = 1;
	lcd.setCursor(col, row);
	delay(SELECT_DURATION);
	while ( buttonID != SELECT ) // any button other than SELECT
	{
		buttonID = btn.waitForButton();
		duration = btn.actionIncDec(buttonID, TIME_TEMP_DURATION,
		                            col, row, duration, 3,
		                            lowerLimit, upperLimit);
		                            // user adjusts time
	}
	return times[index-1] + duration;
}
Пример #23
0
int main(void) {
    
    SYSTEMConfigPerformance(40000000);
    initKeypad();
    enableEnterruptKeypad();
    initTimer2();
    initLCD();
    enableInterrupts();
    moveCursorLCD(0,0);
    state = Wait;

    while (1) {
        switch (state) {
            case Wait:
                break;

            case Scan:
                key = scanKeypad();
                state = MoveCursor;
                break;
                
            case MoveCursor:
                if(count == 0) moveCursorLCD(0,0);
                else if (count == 9) moveCursorLCD(1,0);
                state = Print;
                break;
                
            case debounce1:
                delayUs(500);
                state = Scan;
                break;
                
            case debounce2:
                delayUs(500);
                state = MoveCursor;
                break;

            case Print:
                delayUs(100);
                if(key == 0) printCharLCD('0');
                else if(key == 1) printCharLCD('1');
                else if(key == 2) printCharLCD('2');
                else if(key == 3) printCharLCD('3');
                else if(key == 4) printCharLCD('4');
                else if(key == 5) printCharLCD('5');
                else if(key == 6) printCharLCD('6');
                else if(key == 7) printCharLCD('7');
                else if(key == 8) printCharLCD('8');
                else if(key == 9) printCharLCD('9');
                else if(key == 10) printCharLCD('*');
                else if(key == 11) printCharLCD('#');
                state = Wait;
                break;

        }
    }

    return 0;
}
Пример #24
0
int main(void)
{
	initRP6M256(); 
	initLCD(); 
			   
	writeString_P_WIFI("\n\nRP6 CONTROL M256 I2C Master Example Program!\n"); 

	// IMPORTANT:
	I2CTWI_initMaster(100); // Initialize the TWI Module for Master operation
							// with 100kHz SCL Frequency
							
	// Register the event handlers:
	I2CTWI_setTransmissionErrorHandler(I2C_transmissionError);

	setLEDs(0b1111); // Turn all LEDs on!

	showScreenLCD("################", "################");
	mSleep(500);
	showScreenLCD("I2C-Master", "Example Program 1");
	mSleep(1000);
	// ---------------------------------------
	setLEDs(0b0000); // All LEDs off!
	
	uint8_t counter = 1;
	
	
	// The command and register used here - in the next example we define them all. 
	#define CMD_SET_ACS_POWER	9 
	#define ACS_PWR_MED  2
	
	// Set ACS to medium power (you can see the ACS value changes in the raw registers):
	I2CTWI_transmit3Bytes(I2C_RP6_BASE_ADR, 0, CMD_SET_ACS_POWER, ACS_PWR_MED);


	while(true) 
	{
		// Increment a counter and send value to LEDs of the
		// Slave Controller:
		setLEDs(0b0001);
		showScreenLCD("INCREMENT", "COUNTER");
		setCursorPosLCD(1, 11);
		writeIntegerLengthLCD(counter, DEC, 3);
		I2CTWI_transmit3Bytes(I2C_RP6_BASE_ADR, 0, 3, counter);

		counter++;
	
		// Read and display ALL registers of the slave controller:
		setLEDs(0b0010);

		readAllRegisters();
	
		// Read the light sensors:
		setLEDs(0b0100); 
		readLightSensors();
		
		mSleep(250);
	}
	return 0;
}
Пример #25
0
// Prints curve choices on the LCD screen
void CurveInput::printCurveChoices()
{
	initLCD(&col, &row);
	lcd.print("A: Default Curve");
	lcd.setCursor(0, 1);
	lcd.print("B: User Curve");
	lcd.setCursor(0, 0);
}
Пример #26
0
// Prints welcome screen on LCD
//  	duration: time spent on welcome screen
void CurveInput::printWelcome( int duration )
{
	initLCD(&col, &row);
	lcd.print("Welcome to");
	lcd.setCursor(0, 1);
	lcd.print("Reflow Control!");
	delay(duration);
}
Пример #27
0
// Tells user that we are assuming room temperature start
void CurveInput::printAssumption()
{
	initLCD(&col, &row);
	lcd.print("Assuming");
	lcd.setCursor(0, 1);
	lcd.print("temp[0] = 25 C");
	delay(ASSUME_DURATION);
}
Пример #28
0
void systemSetup(GlobalState *data) {

    rs232Setup2(); // configure USART2
    rs232Setup1(); // configure USART1
    i2CSetup();
    RFIDSetup();

#if FRONT_NOT_BACK
    initSPI1();
    initLCD();
    keypadSetup(); // configure keypad
    setupPWM();
#else
    LEDSetup();
#endif
    data->myRequestStatus = 0;
    data->displayPage = 0;
    data->keyFlag = FALSE;
    data->displayedKey = FALSE;
    data->keyPress = -1;
    data->cursorPos = 0;
    // Select Game Menu
    data->mode = -1;
    data->game = -1;
    // Find better way to do this
    data->mainMenuSpots[0] = 40;
    data->mainMenuSpots[1] = 80;
    data->mainMenuSpots[2] = 120;
    data->getInventory = FALSE;
    data->xbeeFlag = FALSE;
    data->goBack = FALSE;
    // Game Related Globals
    data->keyStatus = -1;
    memset(data->selectMove, 0, sizeof (int) * 4 * 3);
    data->selectMove[0][1] = 10;
    data->cardSelect[0] = 1;
    data->cardSelect[1] = 0;
    data->cardSelect[2] = 0;
    data->cardSelect[3] = 0;
    data->firstTime = TRUE;
    data->updateLEDFlag = TRUE;
    data->lastCards = 0;
    data->readCard = 0;
    data->dataBlockNum = 0;
    data->dataSlotNum = 0;
    memset(data->dataBlock, 0, sizeof (char) * CARDBLOCKSIZE);
    data->runGetUpdatedCards = FALSE;
    data->gotI2C = 0;
    data->sendI2C = 0;
    data->displayPage = 0;
    data->newDisplay = 0;
    data->newGame = 1;
    data->newKeyboard = 1;
    data->doneKeyboard = 0;
    OpenTimer0(TIMER_INT_OFF & T0_SOURCE_INT & T0_PS_1_32);

    return;
}
Пример #29
0
int main(void)
{  
    initLCD();
    initKeypad();
    enableInterrupts();
    
    int counter = 1;
    char output = 'a';
    
    while(1)
    {
        switch(state)
        {
            case Read_Keypad:
               
               if(ROW1 == PRESSED || ROW2 == PRESSED || ROW3 == PRESSED || ROW4 == PRESSED)
               {
                   output = scanKeypad();
               }
               
               if(ROW1 == RELEASED || ROW2 == RELEASED || ROW3 == RELEASED ||  ROW4 == RELEASED)   
               {
                   state = Print_LCD;  
               }
               break;
                
            case Print_LCD:
                 
                if( counter < 8)
                {
                    printCharLCD(output);
                    counter++;          
                }
                else if (counter == 8)
                {
                    printCharLCD(output);
                    counter++; 
                    moveCursorLCD(1, 2);
                }
                else if (counter > 8 && counter < 16)
                {
                    printCharLCD(output);
                    counter++;        
                }
                else if(counter == 16)
                {
                    printCharLCD(output);
                    counter = 0; 
                    moveCursorLCD(1, 1);      
                }
                
                state = Read_Keypad;
            
            break;         
         }
    } 
    return 0;
}
Пример #30
0
int main (void){
	usartInit();
	initLCD();
	while (1){
	LCDGotoXY(0,0);
	LCDstring(LCDBuffer, 1);
	}
	return 0;
}