#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Detailed Description
Header file for flash.c 
Definition in file flash.h.
Function Documentation
      
        
          | void flash_page_erase | ( | uint8_t | pn ) |  | 
      
 
Function to erase a page in the Flash memory 
- Parameters:
- 
  
  
Definition at line 25 of file flash.c.
 
 
      
        
          | void flash_bytes_write | ( | uint16_t | a, | 
        
          |  |  | uint8_t xdata * | p, | 
        
          |  |  | uint16_t | n | 
        
          |  | ) |  |  | 
      
 
Function to write n bytes to the Flash memory 
- Parameters:
- 
  
    | a | 16 bit address in Flash |  | *p | pointer to bytes to write |  | n | number of bytes to write |  
 
Definition at line 44 of file flash.c.
{
    uint8_t xdata *data pb;
    CKCON = 0x01;
    
    FCR = 0xAA;
    FCR = 0x55;
    WEN = 1;
    
    
    pb = (uint8_t xdata *)a;
    while(n--)
    {
        *pb++ = *p++;
        
        
        while(RDYN == 1)
            ;
    }
    WEN = 0;
    CKCON = 0x02;
}
 
 
      
        
          | void flash_byte_write | ( | uint16_t | a, | 
        
          |  |  | uint8_t | b | 
        
          |  | ) |  |  | 
      
 
Function to write a byte to the Flash memory 
- Parameters:
- 
  
    | a | 16 bit address in Flash |  | b | byte to write |  
 
Definition at line 68 of file flash.c.
{
    uint8_t xdata *data pb;
    
    CKCON = 0x01;
    
    FCR = 0xAA;
    FCR = 0x55;
    WEN = 1;
    
    
    
    
    pb = (uint8_t xdata *)a;
    *pb = b;
    
    
    while(RDYN == 1)
        ;
    WEN = 0;
    CKCON = 0x02;
}
 
 
      
        
          | void flash_bytes_read | ( | uint16_t | a, | 
        
          |  |  | uint8_t xdata * | p, | 
        
          |  |  | uint16_t | n | 
        
          |  | ) |  |  | 
      
 
Function to read n bytes from the Flash memory 
- Parameters:
- 
  
    | a | 16 bit address in Flash |  | *p | pointer to bytes to write |  | n | number of bytes to read |  
 
Definition at line 91 of file flash.c.
{
    uint8_t xdata *pb = (uint8_t xdata *)a;
    while(n--)
    {
        *p = *pb;
        pb++;
        p++;
    }
}