Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] PIC18 RC5 RC4 memory interface?

Status
Not open for further replies.

Alloy

Advanced Member level 4
Joined
Apr 3, 2016
Messages
116
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Activity points
1,003
Hey guys
I have a PIC18 device with available RC5 and RC4 pins.
Can I interface easily some kind of memory chip from there?
It must be RC5 and RC4 pins, and of course VCC and GND, other pins are already in use.
Thanks in advance.
 

I have 23LCV512 at hand... but it seems it's SPI-only...

24AA128 is I2C, is it ok?
 

**broken link removed**

WP – Write Protect : When this pin is kept LOW (grounded) normal read and write operations are possible but when it is HIGH (Vcc) write operations will be inhibited. The internal PULL DOWN resistor of this pin keep the device unprotected when it is left floating.
Vcc and Vss : Vcc is the positive DC supply pin. The device is able to work with in 1.8 to 5.5V range. Vss is the ground pin (0v).
SDA – Serial Data : This is bidirectional pin used to transfer data and address to and from the device.
SCL – Serial Clock : This pin is used to synchronize data transfer through SDA.

so SDA to RC4
SCL to RC5
WP disconnected,
GND and VCC connected obviously.
and that's all I need? Other pins disconnected as wel?

And are you sure that I can do it with RC4 and RC5? Will it be a hardware or software I2C?

- - - Updated - - -

It seems that I will use that:
https://download.mikroe.com/documents/compilers/mikroc/pic/help/i2c_library.htm
Code:
void main(){
  ANSEL  = 0;                // Configure AN pins as digital I/O
  ANSELH = 0;
  PORTB = 0;
  TRISB = 0;                 // Configure PORTB as output

  I2C1_Init(100000);         // initialize I2C communication
  I2C1_Start();              // issue I2C start signal
  I2C1_Wr(0xA2);             // send byte via I2C  (device address + W)
  I2C1_Wr(2);                // send byte (address of EEPROM location)
  I2C1_Wr(0xAA);             // send data (data to be written)
  I2C1_Stop();               // issue I2C stop signal

  Delay_100ms();

  I2C1_Start();              // issue I2C start signal
  I2C1_Wr(0xA2);             // send byte via I2C  (device address + W)
  I2C1_Wr(2);                // send byte (data address)
  I2C1_Repeated_Start();     // issue I2C signal repeated start
  I2C1_Wr(0xA3);             // send byte (device address + R)
  PORTB = I2C1_Rd(0u);       // Read the data (NO acknowledge)
  I2C1_Stop();               // issue I2C stop signal
}

but is it for RC4 and RC5?
 
Last edited by a moderator:

You don't say which PIC18 device so we cannot answer the possibility of hardware connection but in general those devices tend to have the hardware peripherals connected to specific pins (the exception being those with PPS and even then the can be limitation). You may need to be looking for a software (bit-banged) I2C or SPI interface.
They work BUT they do take up the CPU time and the can also take a bit of the flash code space.
Susan
 

PIC18F4620 ...

It seems I need the other pins.
I can change my PCB, and now I assigned circuit on proto board, but how do I detect the memory ID for I2C?
 

Have a look at the datasheet.
Some devices, such as the one you mentioned above (24AA128) have address pins that you can set high or low to determine the address they will respond to. Some other I2C devices have a fixed address and/or an address than can be programmed into them by starting with the default address and then changing it via the interface.
Susan
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top