DS1302 Real time clock questions, PIC18F2620 SPI mode and mcu memory usage

Status
Not open for further replies.

ssylee

New Member
I have the following questions:

1. For DS1302 real time clock, there is an option to connect a backup
power source to Vcc1. However, I'm not too sure what source that I
should be using, but I'm thinking something along the lines of a watch
battery. Any suggestions would be very helpful.

2. For the PIC18F2620 MSSP module, if I want to control devices in SPI
mode, is it by default that I can only control one device by SPI with
that microcontroller? I know that I can only communicate to one device
at a time b/c I only have one module, but would it be appropriate if I
have a few unused I/O pins to be used as addressing outputs to a
decoder to have the decoder's output be used as Chip Enable for
setting which device I want to communicate to? Also, would I cause any
damage to a SD card or real time clock chip if I have data streaming
into or out of the slave devices when the chip enable for that
particular slave device isn't set to high?

3. In the event where I can't easily communicate to multiple devices
through SPI on a single microcontroller system, how hard would it be
to write data on the unused memory of the microcontroller?

Thanks for your time in terms of looking into the questions.
 
1 3V watch battery
2 SPI is easy but the CE line is not always optional, it's often the SPI device will not do any writes till the CE line is disabled. Also SD cards usually need writes in 512 byte blocks.
3 The 18F2620 can modify its own code / tables, use the table commands.
 
ssylee said:
Also, would I cause any
damage to a SD card or real time clock chip if I have data streaming
into or out of the slave devices when the chip enable for that
particular slave device isn't set to high?

Of course not, that's what Chip Enable is FOR! The device should tristate its SDO (verify this in your spec sheet) and not pay any attention to its SDI.

You can address multiple SPI devices like you say, by connecting Chip Enable lines to general-purpose PIC output pins. You of course need to be sure you're doing this BETWEEN packets and only works with devices which can be CE slaves. Some devices want to control the CE pin as an output and that's not gonna fly, there's nothing keeping 2 devices from enabling their outputs at the same time and conflict.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…