성엽이
KKIMSSI
성엽이
전체 방문자
오늘
어제
  • 분류 전체보기 (454)
    • :) (2)
    • C프로그래밍이론 (9)
    • C++프로그래밍 (64)
      • STL (1)
    • C# (2)
    • Visual studio 10.0 (9)
    • AT91SAM7S256 (21)
    • 논리회로 (14)
    • AVR2560 (11)
    • TCPIP (16)
    • NetWork (4)
      • Ubuntu Linux (2)
    • Assembly (21)
    • UNIX 프로그래밍 (6)
    • RFID 분석 (1)
    • Win32 API (7)
    • Cortex-M3 (4)
    • Unity (91)
    • Flutter (9)
    • OwnProject (11)
      • It's mine (5)
      • 마인드스톰 실습 (1)
      • 보고서 자료 (2)
      • RPi B+ (2)
    • ETC (25)
      • 상식 (3)
    • MFC (40)
    • PostgeSQL (18)
    • 영상제어 (6)
      • VFW_영상처리 (1)
    • Python (0)
    • Java (30)
      • SpringBoot (2)
      • Javascript (1)
      • JSP (13)
      • Spring (8)
    • Oracle (4)
      • SQL (3)
    • HTML (6)
      • Thymeleaf (1)
      • CSS (1)
      • Bootstrap (3)
    • IDE (1)
      • VS Code (1)
    • Android (2)
    • Privacy Policy (0)
    • MYSQL (2)
      • MariaDB (2)
    • AWS (5)
    • 개인공부 (0)

블로그 메뉴

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록
  • 관리자
  • 글쓰기

공지사항

인기 글

태그

  • ARM Reverse Engineering
  • 문자열 나누기
  • WINAPI
  • Boot Code 분석
  • MFC

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
성엽이

KKIMSSI

AVR2560

2013.06.10_USART로 모든 기능 활용_

2013. 6. 11. 17:56

▶ main.c


 #include "Lcd.h"

#include "Ultra.h"
#include "USART.h"
#include "Timer.h"
#include "EEPROM.h"
#include "ADC.h"

void __vector_25(void)
{
  static unsigned char ucData;

  ucData = UDR0;

  while((0 == (UCSR0A)) & (RXC0));
  
  USART_String("1. Ultra Sonic\r\n");
  USART_String("2. Write the Data to EEPROM\n\r");
  USART_String("3. Read the Data from EEPROM\n\r");
  USART_String("4. Sensor_Light_Temp\n\r");
  USART_String("5. initialize\n\r");  

  switch(ucData)
  {
    case '1' : 
      LCD_cmd_write(LCD_CLEAR);  // 화면지우기
      USART_String(ULTRA_RUN());
      LCD_cmd_write(0x80);
      LCD_string(ULTRA_RUN());
      break;
    case '2' :
      EEPROM_write(0xFFF, Recv_char());
      break;
    case '3' :
      USART_String("\r\n");
      Send_char(EEPROM_read(0xFFF));  
      USART_String("\r\n");
      break;
    case '4' :
      LCD_cmd_write(LCD_CLEAR);  // 화면지우기      
      LCD_number(1, Sensor_Light());
      LCD_number(2, Sensor_Temp());  
      break;
    case '5' :
      LCD_cmd_write(LCD_CLEAR);  // 화면지우기      
      SettingFont();
  
      LCD_cmd_write(0x80);    // DD RAM Address (첫라인 첫위치)
      LCD_data_write(0x00);    // '성'

      LCD_cmd_write(0x81);    //
      LCD_data_write(0x01);    // '엽'

      LCD_cmd_write(0x82);  
      LCD_data_write(0x02);    // '이' 
  
      LCD_cmd_write(0x83);  
      LCD_data_write(0x03);    // '하트'

      LCD_cmd_write(0x84);
      LCD_data_write(0x04);    // '하트' 
    default :
      USART_String("Error");
      break;
  }
}

int main(void)
{
  LCD_Init();
  Timer0_Init();
  ULTRA_INIT();
  
  USART_Init_INT(__vector_25);

  volatile unsigned int iCnt;  // 2byte int  
  volatile unsigned int iCnt1;
  volatile unsigned int i;
  volatile unsigned int j;

  DDRA = 0xFF;
  
  SettingFont();

  LCD_cmd_write(0x80);    // DD RAM Address (첫라인 첫위치)
  LCD_data_write(0x00);    // '성'

  LCD_cmd_write(0x81);    //
  LCD_data_write(0x01);    // '엽'

  LCD_cmd_write(0x82);  
  LCD_data_write(0x02);    // '이' 
  
  LCD_cmd_write(0x83);  
  LCD_data_write(0x03);    // '하트'

  LCD_cmd_write(0x84);
  LCD_data_write(0x04);    // '하트' 

  while(1)
  {  
    LCD_cmd_write(0x08);
    MS_DELAY(500);
    LCD_cmd_write(0x0C);
    //LEC 토글.
    MS_DELAY(1000);
    PORTA = 0x00;
    MS_DELAY(1000);
    PORTA = 0xFF;


  }

  while(1);
  return 0;
}


---AVR 파일----

 AVR2560_.zip

----------------
TC 를 벡터 15사용해야함.


저작자표시

'AVR2560' 카테고리의 다른 글

2013.09.24_ 명령어 실행 소스  (0) 2013.09.24
2013.06.07_EEPROM 접근_by유진  (0) 2013.06.12
2013.06.10_초음파센서_활용  (0) 2013.06.11
2013.06.07_인터럽트에 대한 이론_  (0) 2013.06.07
2013.06.07_EEPROM에_직접_읽고/쓰기  (0) 2013.06.07
    'AVR2560' 카테고리의 다른 글
    • 2013.09.24_ 명령어 실행 소스
    • 2013.06.07_EEPROM 접근_by유진
    • 2013.06.10_초음파센서_활용
    • 2013.06.07_인터럽트에 대한 이론_
    성엽이
    성엽이

    티스토리툴바