User manual
320
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
begin
ADPCFG := 0xFFFF; // Disable analog inputs
TRISB := 0; // PORTB as output
LATB := 0xFFFF;
eeAddr := 0x7FFC00; // Start address of EEPROM
eeData := 0; // Data to be written
while (eeData <= 0x00FF) do
begin
Eeprom_Write(eeAddr, eeData); // Write data into EEPROM
Inc(eeData);
while (WR_bit) do // Wait for write to nish,
;
LATB := Eeprom_Read(eeAddr); // then, read the just-written data.
eeAddr := eeAddr + 2; // Next address of EEPROM memory location
Delay_ms(100);
end;
Delay_ms(1000); // Wait 1 second.
eeData := 0xAAAA;
for i := 0 to 15 do // Initializing array of 16 integers with data
begin
dArr[i] := eeData;
eeData := not eeData;
end;
Eeprom_Write_Block(0x7FFC20, dArr); // Write entire row of EEPROM data
while(WR_bit) do // Wait for write to nish
;
eeAddr := 0x7FFC20; // Address of EEPROM where reading should start
for i := 0 to 15 do // Read the data back
begin
LATB := Eeprom_Read(eeAddr); // and show it on PORTB
eeAddr := eeAddr + 2; // Next address of EEPROM memory location
Delay_ms(500);
end
end.