Пример #1
0
void main()
{

	PowerOnSetProc();
	
	LCD_Cmd(DISPLAY_CURSE_BLINK_ON);
	machine_state = STATE_MONITOR_MODE;

	while(1){

		if( secWatchDog > 60 ){
			secWatchDog = 0;
			delay_ms(100); 
			sci_rx_msg_start = sci_rx_msg_end = 0;
			LCD_Initialization();				
			machine_state = STATE_MONITOR_MODE;
			delay_ms(100); 
		}
		

		if	   ( machine_state == STATE_SET_MODE ) SelectMenuPage1();			// 모드 선택
		else if( machine_state == STATE_SET_MODE2 ) SelectMenuPage2();			// 모드 선택
		else if( machine_state == STATE_EDIT_MODE) EditCodeDataProc();			// 사용자 에디터 모드
		else if( machine_state == STATE_TRIP_MODE) TripCodeDataProc();			// Trip 모드 (저장 데이터)
		else if( machine_state == STATE_RESET_MODE) ResetCodeDataProc();		// Reset 모드
		else if( machine_state == STATE_TIME_MODE) TimeDataSetProc();			// 시간 셋팅 모드
		// else if( machine_state == STATE_ERROR_MODE)	ErrorCodeDataProc();		// TRIP ERROR 모드
		else if( machine_state == RECORD_CLEAR_MODE) RecordClearProc();			// Trip 이력 모두 삭제
		else if( machine_state == SYSTEM_INIT_MODE) SystemInitProc();			// EEPROM DATA 초기화
		else if( machine_state == CHECKSUM_MODE) CheckSumErrorProc();			// Checksum 복구모드
		else if( machine_state == STATE_POSITION_MODE) PositionTestProc();		// TEST
		else {   machine_state = STATE_MONITOR_MODE; monitor_converter();}
	}
}
Пример #2
0
void initializeBoard(){

	RCC_Init();
	board_map();//Configura todas as portas IO e perifericos
	usart_init();

	 LCD_Initialization();          // Initialize the LCD.
	 LCD_Clear();         //Clear the LCD.
	 LCD_GoTo(0,0);       //Go to Line 0, position 0 of LCD.
	 LCD_SendText ("SL7000 Bluetooth");
	 LCD_GoTo(1,0);       //Go to Line 1, position 2 (on the right) of LCD.
	 LCD_SendText ("IEC  Auto Detect");
}
Пример #3
0
int main(int argc, char *argv[])
{
  //BOOTLOADER_reset();

  int r;
  __enable_irq();
  //NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000); // make sure that
  // interrupts work
  clock_init(); // hey, you can overclock later here. maybe.



  JSON_init();
  USART_Config();
  TIM_init();

  LCD_Configuration();
  LCD_Initialization();
  LCD_Clear(LCD_Black);

  USART_PutString(HOST_USART,"***** INIT DONE *****\n");

  while(1) {

    r = JSON_render();

    // todo: better error reporting
    if(r == 3) {
      // no free bufs
      continue;
    } else if(r != 0) {
      JSON_init(); // reset buffers in case of errors
      char abuf[32];
      itoa(abuf, r, 10);
      USART_PutString(HOST_USART, abuf);
      USART_PutChar(HOST_USART, 'N');
      USART_PutChar(HOST_USART, '\n');
    }
    //USART1_PutChar('A');
    __asm__("WFI"); // sleep for a bit.
  }
  return 0;
}
Пример #4
0
void PowerOnSetProc()
{		 	
	port_b_pullups(TRUE);	output_b(0xff); output_c(0xff);		
	
	set_tris_A(0b00000011);	set_tris_B(0b01111111);

	set_tris_D(0b00000000);	set_tris_E(0b00000000);
	
	set_tris_C(0b10010000);
	
	setup_adc_ports(NO_ANALOGS);
	setup_adc(ADC_OFF);

	setup_comparator(NC_NC_NC_NC);
	setup_vref(FALSE);
	setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);

	setup_timer_2(T2_DIV_BY_4,250,2);		 // 8,000,000 / (4 * 8 * (249 +1)) = 1,000 = 1/1000 sec
	set_timer2(0);
	enable_interrupts(INT_TIMER2);
	
	// LCD 초기화 하기 전에 대기 없으면 이상한 현상이 생김  
	delay_ms(100); 

	LCD_Initialization();				

	setup_psp(PSP_DISABLED);	
	delay_ms(250);
	SerialPortSetup();	

	LCD_Clear();
	enable_interrupts(INT_RDA);	
	enable_interrupts(GLOBAL);	

             //"01234567890123456789"
	strcpy(st, "DIGITAL OPERAT      "); PrintLCD(0,0,st);
	strcpy(st, "[EwDo-21] v2.60     "); PrintLCD(1,0,st);
	strcpy(st, "EunWho Power Electic"); PrintLCD(2,0,st);
	strcpy(st, "TEL 82-51-262-7532  "); PrintLCD(3,0,st);
	delay_ms(3250);
	delay_ms(3250);
}