질문게시판 > MTP 주소 지정 방법

TODAY7,575 TOTAL7,737,694
사이트 이용안내
Login▼/회원가입
최신글보기 질문게시판 기술자료 동영상강좌

아두이노 센서 ATMEGA128 PWM LED 초음파 AVR 블루투스 LCD UART 모터 적외선


BASIC4MCU | 질문게시판 | MTP 주소 지정 방법

페이지 정보

작성자 adoui 작성일2023-12-19 17:42 조회1,065회 댓글1건

본문

	

안녕하세요.

MCU 초보입니다.

MCU 데이터시트에 보니 MTP 주소를 0x1234 ~ 0x4000까지 쓸 수 있다고 나와있습니다.

제가 하고싶은 구현은 이 주소에 모터 RPM값을 저장하여 그 저장한 값을 같은 프로젝트 안에 있는 코드에서 사용하고 싶습니다.

아래는 데이터 시트에 나와있는 예시코드입니다.

1. The starting address in the programming procedure assigns at 0x4000. 2. Using __u8WritePara to program the desired data into user-MTP. 3. The library performs the programming procedure. After the programming is complete, the programming times will increase automatically. 4. The programming address will not change when programming is less than 1000 times. Once the programming reaches 1000 times, the programming address will increase a word-space automatically. 5. If the programmed data matches the existing data in the user-MTP, the library will not execute the programming procedure. This mechanism reduces unnecessary programming and only programs when data are different. 6. In this example, the array assigns 4-space, and the programming can up to 4000 times. // assign 4-space to programming data const U32 _u32Data[4] __attribute__((section(".ARM.__at_0x00004000"))) __attribute__((used)) = {0}; // assign a structure for programming procedure volatile User_Parameter_Type _stPara; // return value from programming procedure U8 u8WriteStatus; // 16-bit variable for read U16 u16ReadData; int main(void) { // define MTP address _stPara.u32StartAddress = (U32)&_u32Data; // byte length changes to word length _stPara.u32WordLength = (sizeof(_u32Data)) >> 2; // checksum = StartAddress + EndAddress _stPara.u32CheckSum = _stPara.u32StartAddress + (_stPara.u32StartAddress + sizeof(_u32Data)); __ParkingMCU(); // stop interrupt request u8WriteStatus = __u8WritePara(_stPara, 0x1234); // write 0x1234 to user-MTP __RecoverMCU(); // recover interrupt request u16ReadData = __u16ReadPara(_stPara); // read data from user-MTP while(1); }





모터 RPM 지령은 u16user_speedcmd = 1000; 이런식으로 작성합니다.

도와주십시오 ㅜㅜ
  • BASIC4MCU 작성글 SNS에 공유하기
  • 페이스북으로 보내기
  • 트위터로 보내기
  • 구글플러스로 보내기

댓글 1

조회수 1,065

master님의 댓글

master 작성일

중간에 변경 할 필요가 없는 데이터는 코드메모리에 선언하면 됩니다.
주로 폰트 같은 것을 선언 할 때 많이 사용하는 방법인데요
mcu마다 사용방법이 다를 수 있으니 예제를 잘 찾아보세요

질문게시판HOME > 질문게시판 목록

MCU, AVR, 아두이노 등 전자공학에 관련된 질문을 무료회원가입 후 작성해주시면 전문가가 답변해드립니다.
ATMEGA128PWMLED초음파
아두이노AVR블루투스LCD
UART모터적외선ATMEGA
전체 스위치 센서
질문게시판 목록
제목 작성자 작성일 조회
공지 MCU, AVR, 아두이노 등 전자공학에 관련된 질문은 질문게시판에서만 작성 가능합니다. 스태프 19-01-15 24369
공지 사이트 이용 안내댓글[31] master 17-10-29 39054
질문 DLM-64DCAA 고장나서 수리하고 싶습니다댓글[2] 이미지첨부파일 공부하고싶은콩 25-03-11 48
질문 로봇 얼굴 제작에 대하여 질문드립니다.댓글[4] 카모킹스 25-03-03 272
질문 모터와 모터드라이브 질문있습니다댓글[1] ponyo 25-02-19 140
질문 공통음극형 FND를 9V로 동작하게 하고 싶어요.댓글[7] 멘토 25-01-21 1573
질문 oled 모듈 연결 질문입니다!댓글[1] 펌린이 24-12-17 299
질문 Atmega 128 타이머 질문있습니다댓글[1] ednda 24-12-11 319
답변 답변글 답변 : Atmega 128 타이머 질문있습니다 master 24-12-11 234
질문 ATmega128 2개로 hc-05,hc-06블루트수 통신 동콩이 24-12-04 294
답변 답변글 답변 : ATmega128 2개로 hc-05,hc-06블루트수 통신댓글[4] master 24-12-04 2272
질문 lm75a 온도센서 관련 질문입니다.댓글[6] 이미지첨부파일 hanmw0707 24-12-01 5186
질문 리얼타임클락 질문이요 ㅠㅠ댓글[1] 이미지 팬케이크 24-11-22 394
질문 가속도센서 2개를 강아지 2마리에 각각 달아서 스마트폰으로 움직임을 보고 싶은데요댓글[1] gainomax 24-11-21 564
질문 라즈베리파이 4B 사용 중 막히는 부분 질문합니다댓글[1] 한마바키 24-11-12 6687
질문 스위치로 PI 모터 제어 바밤 24-11-11 288
답변 답변글 답변 : 스위치로 PI 모터 제어 master 24-11-12 283
질문 아트메가128 마이크로프로세서댓글[3] 옹심이 24-11-05 1104
질문 초음파 센서로 장애물 인식댓글[1] 나난ㄴ 24-10-31 445
질문 이런 투명 LCD는 뭐라고 부르나요?댓글[2] 이미지 펌린이 24-10-29 656
질문 모터제어 중 RPM 계산 질문입니다.댓글[3] suuuuuuuh 24-10-24 955
질문 아트메가 128과 블루투스 모듈(HC-06) 연결 질문댓글[1] 메가아트 24-10-24 449
질문 ATmega128 질문 DFplayer mini댓글[1] Miin 24-10-18 7038
질문 스탭모터 3개 회로도 질문.. 삉삉이 24-10-11 428
답변 답변글 답변 : 스탭모터 3개 회로도 질문.. 이미지 master 24-10-12 442
질문 수분수위센서와 멀티플렉서댓글[3] 김고래쓰 24-10-10 1197
질문 ATmegq128 PI 제어기 추가댓글[1] 바밤 24-10-08 459
답변 답변글 답변 : ATmegq128 PI 제어기 추가댓글[1] master 24-10-08 616
질문 아두이노 ide 네오픽셀 각 셀 각자 코드 현수 24-09-29 298
질문 아두이노 IDE 프로마이크로 네오픽셀 현수 24-09-29 340
게시물 검색

2022년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2021년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2020년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2019년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2018년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
Privacy Policy
MCU BASIC ⓒ 2020
모바일버전으로보기