공학속으로/마이컴

PIC18F4520 EEPROM

더월드 2020. 3. 4.

메모리 사이즈 설명

FLASH 8k-bytes 프로그램 저장을 위해 사용
RAM 368-bytes 프로그램 실행중 사용되는 메모리
EEPROM 256-bytes 비휘발성 데이타 저장

 

#include <pic16f877a.h>
#include "uart.h"
#include "eeprom.h"

int main() 
{
    unsigned char eeprom_address = 0, write_char, read_char;
    
    UART_Init(9600);
    
    for(write_char='1';write_char<='9';write_char++)
    {
    	// Print "write_char" on UART
        UART_Printf("\n\rEeprom Write: %c    ",write_char); 
        // Write the data at eeprom
        EEPROM_WriteByte(eeprom_address, write_char);       

		// Read the data from eeprom(0x00)
        read_char = EEPROM_ReadByte(eeprom_address);        
        // Print "read_char" on UART
        UART_Printf("Eeprom Read: %c",read_char);           
    }
    
    while (1);
    return 0;
}

'공학속으로 > 마이컴' 카테고리의 다른 글

코드비젼 AVR (Codevision AVR) 자료형  (0) 2021.10.03
포트 제어 (LED 켜기/끄기) 방법  (0) 2020.03.12
PIC18F4520 Timer.  (0) 2020.03.04
8051 모든 인터럽트  (0) 2020.03.04
외부 인터럽트  (0) 2020.03.04

댓글

💲 추천 글