Serial EEPROM 24C16 on PIC18F2455

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Serial EEPROM 24C16 on PIC18F2455

Post by johnsondav »

Hi Everyone
I have had a look around the forum to see why there is no hardware option problem listed for this device. I am using a PIC18F2455 with a I2C EEPROM attached to the hardware port - SCL - B1; SDA - B0.
Serial EEPROM 24C16 Properties.jpg
Serial EEPROM 24C16 Properties.jpg (43.81 KiB) Viewed 4136 times
However, there is no macro available to init. the hardware port:
Serial EEPROM 24C16 Macro.jpg
Serial EEPROM 24C16 Macro.jpg (46.95 KiB) Viewed 4136 times
I have tried to include the I2C component and use its init. macro without success. The software option is working fine, just not the hardware port. No clock signal detected using handheld scope. Clock signal is present when using the software option.

Q. Is the INIT. macro missing for a reason that, at present, I am unable to deduce - or - am I missing something?

I have tried the exact same set up using FC7 - same problem.
Checked both wiki's FC7 & FC8 - no reference to hardware set up. However, does mention MIAC in FC7, so I am wondering if this port is already initialised within the MIAC hardware.

All suggestions greatly accepted.

Dave

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Serial EEPROM 24C16 on PIC18F2455

Post by LeighM »

Hi Dave,
Thanks for reporting this, it does look like a bug that has crept in. I'll take a look.
For info: The component does not have or need an intialise function and it embeds an I2C component, so you don't need to add one.
A MIAC project just causes the properties to auto setup.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Serial EEPROM 24C16 on PIC18F2455

Post by LeighM »

Hi Dave,
Yes, it's confirmed that the component connection properties are not updating correctly.
The bug has been raised, in the meantime ...
If you change the Device Address, does the Channel then offer you Channel 1 as an option?
Once you manage to get Port B.0 and B.1 in the SDA and SCL properties, the program should compile OK.

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: Serial EEPROM 24C16 on PIC18F2455

Post by johnsondav »

Hi Leigh

Thank you for your very quick reply. I can confirm, the Channel properties for the component are indeed listed from the drop down menu as shown:
Channel 1 Properties A.jpg
Channel 1 Properties A.jpg (52.42 KiB) Viewed 4108 times
However, the SCL & SDA properties are greyed out as shown:
Channel 1 Properties B.jpg
Channel 1 Properties B.jpg (43.71 KiB) Viewed 4108 times
I have selected the port connection as shown but this makes no difference to the operation - still inactive clock signal.

Dave

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: Serial EEPROM 24C16 on PIC18F2455

Post by johnsondav »

Hi Leigh

I have done some further testing and found the following using software option:

- clock signal (SCL) present - YES
- Output data (SDA) for address etc present - YES

Both of these are only true when using 'PULL-UP' resistor. So, according to Microchip 'Pull-Up' resistor are only necessary when using the hardware port. Therefore, could the hardware by working? just not by channel selection! :?

Dave

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: Serial EEPROM 24C16 on PIC18F2455

Post by johnsondav »

Hi Leigh

Sorry about this, but having looked at the Microchip data sheet and the example FC8 code provided, I am wondering how to set up the following to be able to read a devices ID memory chip for identification purposes:

To Read a memory block of 128 bits:
Each data transfer is initiated with a Start condition and terminated with a Stop condition. The number of the data bytes transferred between the Start and Stop conditions is determined by the master device and is theoretically unlimited. SO START - STOP commands!

Check which ID chip is present by address:
Acknowledge
Each receiving device, when addressed, is obliged to generate an acknowledge after the reception of each byte. The master device must generate an extra clock pulse which is associated with this Acknowledge bit. ACKNOWLEDGE detected macro

I understand the example is for 1 byte of data but without some extra information from the chip such as: Start/Stop & ACK signal I am unsure as to how to increment the internal addresses as the only address is the device address.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Serial EEPROM 24C16 on PIC18F2455

Post by LeighM »

Hi Dave,
The Device Address property is the hardware address of the device.
The internal data/buffer address is passed in the read and write macros.
The component takes care of the correct start, address, data, stop etc sequence.
I2C devices always require a pull up resistor on SDA and SCL.
Hope that helps,
Leigh

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: Serial EEPROM 24C16 on PIC18F2455

Post by johnsondav »

Hi Leigh

Thank you for clarifying that for me. Much appreciated.

Dave

Post Reply