Maker Pro
Maker Pro

PIC18F2620 pin assignment assistance

M

Martin Riddle

Jan 1, 1970
0
ssylee said:
I have posted a question in http://forum.microchip.com/tm.aspx?m=297272,
but I don't know if anyone would reply there during weekends. It would
be much appreciated if I hear some opinions on this board.

http://docs.google.com/Doc?id=dcjtjgx9_44z4n9kf shows the current status of my pin assignments right now with the
microcontroller using an internal oscillator for the system clock. I'm having the microcontroller communicating to a LCD
which uses 8 pins for its data byte and 2 pins for other control, a MMC/SD card using SPI and a RTC also using SPI. I have a
few questions regarding on how I can make my pin assignments more suitable:

1. Is it possible to assign only a single RB pin to be an a/d input without setting the rest (all the a/d input numbering
before the RB AN# input) as analog inputs so that I can use them for other purposes?
Yes

2. How easy or hard is it to communicate to multiple modules using SPI? Would it be easier using I2C?
You need seperate chip selects

3. Would using CCP module with communicating to RTC chip make my life easier to getting real clock time stamps?
I would say no. But I have implemented a RTC in software and updated it periodically from a hardware RTC.

4. For KB0-KB3 (interrupt-on-change) pins, does it mean that specific type of interrupt would be called when the input
voltage changes from 3 V to 3.5V? or does that work on digital logic only like normal external interrupts?
A 'State' change 0-5v


5. For high/low voltage detection, is its function only to flag when the supply voltage drops below/rises above a certain
threshold? How is it different from a brown-out detection module?
Brownout is tied to a hardware reset.

6. For fault input pin, I have read the datasheet but still confused on why I would want to use it. Can anyone post an
example of why the developer would want to use it?
Its probably tied to an interrupt, eg; Do something if the supply droops.


Cheers
 
S

ssylee

Jan 1, 1970
0
My replies are below

http://docs.google.com/Doc?id=dcjtjgx9_44z4n9kfshows the current status of my pin assignments right now with the
microcontroller using an internal oscillator for the system clock. I'm having the microcontroller communicating to a LCD
which uses 8 pins for its data byte and 2 pins for other control, a MMC/SD card using SPI and a RTC also using SPI. I have a
few questions regarding on how I can make my pin assignments more suitable:

1. Is it possible to assign only a single RB pin to be an a/d input without setting the rest (all the a/d input numbering
before the RB AN# input) as analog inputs so that I can use them for other purposes?
Yes

How would I do it? According to the documentation, if I use AN10, I
would have to also initialize AN0 - AN9 as analog inputs as well,
therefore wasting those I/O for something else.
2. How easy or hard is it to communicate to multiple modules using SPI? Would it be easier using I2C?
You need seperate chip selects

Do you mean using separate chip select signals on the slave select
pin?
 
R

Roger Hamlett

Jan 1, 1970
0
My replies are below



How would I do it? According to the documentation, if I use AN10, I
would have to also initialize AN0 - AN9 as analog inputs as well,
therefore wasting those I/O for something else.
Not quite. There are several 'parts' to the setup on the pins. The
setup in the analog section, says that the input pins selected, _will_
be routed to the analog input multiplexer. However a pin that is setup
as an analog input, can still be driven as a logic output. If you look
at the pin settings table, to use a pin as an analog input, requires
it to both be selected in the analog setup, and also have the TRIS set
to '1'. If the TRIS is set to '0', the pin can still be driven. If you
look at the bottom of page 105, in the data sheet, it gives a 'caveat'
for this, but the same caveat, implies you can actually use the pins
despite the analog setting. This increases the noise present in the
analog section of the chip, and you can get unacceptable leakages if
the external Vref signals are used,and are significantly below the
main supply rails. This is made plain if you look at the pin table in
the data sheet (10.1), and look for example, at the entry for AN0. On
the line for RA0/AN0, you see the comment against the entry for TRIS,
and I/O set to '1' - does not affect digital output.
Do you mean using separate chip select signals on the slave select
pin?
The fault input, is designed for use wth the PWM modules. It disables
the PWM outputs, when triggered, as you would require if a fault
condition existed in the drivers...

Best Wishes
 
Top