реклама на сайте
подробности

 
 
> Сохрание данных в PIC32
swagger
сообщение Mar 13 2014, 05:06
Сообщение #1


Участник
*

Группа: Участник
Сообщений: 65
Регистрация: 18-01-08
Из: Moscow
Пользователь №: 34 201



Добрый день!
Изучаю PIC32 на отладочной плате UNO32 компилятор С32. Вопрос по сохранению данных пользователя при сбросе питания. EEPROM нет как в PIC18. Получается сохраняем во flash память?
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
Ruslan1
сообщение Mar 14 2014, 19:38
Сообщение #2


Гуру
******

Группа: Свой
Сообщений: 2 360
Регистрация: 6-03-06
Из: Кишинев
Пользователь №: 15 025



Цитата(swagger @ Mar 13 2014, 07:06) *
Добрый день!
Изучаю PIC32 на отладочной плате UNO32 компилятор С32. Вопрос по сохранению данных пользователя при сбросе питания. EEPROM нет как в PIC18. Получается сохраняем во flash память?

ага, именно так.
Вот кусок из моего старенького, опирается на NVN "Microchip PIC32MX Peripheral Library"
CODE

/***********************************************************************
PROCEDURE: SerMem_reading

This procedure reads multiple addresses of the device and stores
data into RAM buffer

Input:
startAddr: Destination Address 000000H - 3FFFFFH
no_bytes Number of bytes to read
*pntres - the pointer of the read data

Returns:
Nothing

/************************************************************************/
void SerMem_reading(u32 startAddr, u8 *pntres, u16 no_bytes )
{
u8 *pnt = (u8*)startAddr;

while (no_bytes > 0)
{
*pntres = *pnt; /* receive byte and store at address 80H - FFH */
pntres++;
*pnt++;
no_bytes--;
}
return;
}


/***********************************************************************
PROCEDURE: SerMem_writing
This procedure writes multiple addresses of the device
Input:
startAddr: Destination Address aligned 4
nbytes Number of bytes (4,8,12,16....)
*pntres - the pointer in RAM of the data
Returns:
Nothing
Note:
The smallest block of data that can be programmed in a single operation is 1 instruction word (4 Bytes).

/************************************************************************/
void SerMem_writing(u32 startAddr, u8 *pntres, u16 nbytes)
{
u32 wrdata;
nbytes &=0xFFF4; // align is 4 bytes

while (nbytes > 0)
{
wrdata = *((u32*)pntres);
NVMWriteWord((void*) startAddr, wrdata);
pntres+=4;
nbytes-=4;
startAddr+=4;
}
}


void SerMem_erase4K(u32 startAddr)
{
NVMErasePage((void*)startAddr);
}
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 22nd July 2025 - 04:09
Рейтинг@Mail.ru


Страница сгенерированна за 0.01363 секунд с 7
ELECTRONIX ©2004-2016