Mikroelektronika MIKROE-442 Datenbogen

Seite von 726
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
319
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 mikroBasic 
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 
while TRUE
        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
      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 if
  wend
end.