Delete RAM data and delay function

This commit is contained in:
Miducc
2023-06-23 09:43:06 +07:00
parent 27e209b42d
commit 5bdcd8ad93
2 changed files with 46 additions and 0 deletions

34
src/system_function.c Normal file
View File

@@ -0,0 +1,34 @@
#include "BA45F5250.h"
#include "stdint.h"
#include "build-in.h"
#include "system_function.h"
#include "macro_define.h"
void ram_erase(uint8_t ram_bank)
{
_mp1h = ram_bank;
_mp1l = RAM_ADDR_START;
_acc = RAM_ADDR_END - RAM_ADDR_START + 1;
while (_acc != 0)
{
_iar1 = 0;
++_mp1l;
_acc--;
}
}
void delay(uint16_t count)
{
uint8_t i;
for(i = 0; i < count; i++)
{
#if _HIRCC_8M
GCC_DELAY(9993);
#elif _HIRCC_4M
GCC_DELAY(4993);
#else
GCC_DELAY(2493);
#endif
}
}