User manual

mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
317
HW Connection
Example of interfacing ECAN transceiver with MCU and bus
EEPROM Library
EEPROM data memory is available with a number of dsPIC30 family and some PIC24 family MCU’s. The mikroPascal
PRO for dsPIC30/33 and PIC24 includes a library for comfortable work with MCU’s internal EEPROM.
Important: Only 24F04KA201 and 24F16KA102 of PIC24 family of MCUs have EEPROM memory.
Library Routines
- EEPROM_Erase
- EEPROM_Erase_Block
- EEPROM_Read
- EEPROM_Write
- EEPROM_Write_Block
Msg_Rcvd := ECAN1Read(Rx_ID, RxTx_Data, Rx_Data_Len, Can_Rcv_Flags);// receive message
if ((Rx_ID = ID_1st) and (Msg_Rcvd <> 0) <> 0) then // if message received check id
begin
PORTB := RxTx_Data[0]; // id correct, output data at PORTB
Inc(RxTx_Data[0]); // increment received data
ECAN1Write(ID_2nd, RxTx_Data, 1, Can_Send_Flags); // send incremented data back
end;
end;
end.