Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

Discussion Groups | Piclist | I2C hangs

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Problem involving configuring pins for analog/digital operation - Jason Hsu - May 25 22:09:48 2008

For the PIC16F72, I'm using pins 0 and 1 of Port A as analog inputs
while ALL of the other pins (rest of Port A, all of Port B, and all of
Port C) need to be digital outputs.

However, I cannot configure ADCON to do this. Of all the options
available by configuring ADCON, NONE have the analog/digital
combination I need.

Any suggestions? Would there be anything wrong with configuring pins
0 and 1 of Port A as analog inputs during the part of the program that
requires this and then configuring them as digital outputs during the
other parts of the program (the times that the input sampling function
isn't needed)? In my project (SWR/wattmeter display), the timing
isn't that critical, since I'm using a 3.58 MHz crystal, and the human
eye won't notice things that take place for a few microseconds out of
a 1 ms cycle.
------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )


Re: Problem involving configuring pins for analog/digital operation - "John J. McDonough, WB8RCR" - May 26 11:14:39 2008


----- Original Message -----
From: "Jason Hsu"
To:
Sent: Sunday, May 25, 2008 10:09 PM
Subject: [piclist] Problem involving configuring pins for analog/digital
operation
> Any suggestions? Would there be anything wrong with configuring pins
> 0 and 1 of Port A as analog inputs during the part of the program that
> requires this and then configuring them as digital outputs during the
> other parts of the program (the times that the input sampling function
> isn't needed)? In my project (SWR/wattmeter display), the timing
> isn't that critical, since I'm using a 3.58 MHz crystal, and the human
> eye won't notice things that take place for a few microseconds out of
> a 1 ms cycle.

Not at all. The thing to be careful of is configuring an analog pin as a
digital INPUT and leaving it floating or at an intermediate state. A
digital output is the safest move, as long as the pin isn't facing too low
an impedance, and it sounds as if you have this dealt with.

Some parts allow different combinations, and that is part of the selection
process. The 87x for example allows more choices, but I still don't see a
choice with 2 analog ins and all the rest digital. This gets to be more
severe as a part has more and more peripherals. On some of the PIC24 parts,
you can reassign peripherals to pins to help alleviate this kind of problem.
Some of these parts have an incredible number of peripherals jammed into a
small package, so you almost have to have that sort of flexibility.

--McD
------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

I2C hangs - KM6VV - May 26 12:17:45 2008


I'm having a problem with I2C on an 18F4620.

it occurs while waiting for SEN to go low acknowledging "Initiate
Start". It may occur either when sending command or getting for data.

I've put in a timeout, which prevents the the waits for SEN from hanging
up the entire program, but even re-initializing the I2C will not allow
it to run again until a power cycle.

Any ideas?

Alan KM6VV

------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Problem involving configuring pins for analog/digital operation - Les Jones - Jun 10 20:07:05 2008

--- In p...@yahoogroups.com, "Jason Hsu" wrote:
>
> For the PIC16F72, I'm using pins 0 and 1 of Port A as analog inputs
> while ALL of the other pins (rest of Port A, all of Port B, and all of
> Port C) need to be digital outputs.
>
> However, I cannot configure ADCON to do this. Of all the options
> available by configuring ADCON, NONE have the analog/digital
> combination I need.
>
> Any suggestions? Would there be anything wrong with configuring pins
> 0 and 1 of Port A as analog inputs during the part of the program that
> requires this and then configuring them as digital outputs during the
> other parts of the program (the times that the input sampling function
> isn't needed)? In my project (SWR/wattmeter display), the timing
> isn't that critical, since I'm using a 3.58 MHz crystal, and the human
> eye won't notice things that take place for a few microseconds out of
> a 1 ms cycle.
>

Hi Jason,
I have just had a look at the data sheet and I agree there
is no way to have RA0 & 1 as analog inputs and RA 2 - 5 as digital.
I can see no reason why you should not change these pins to digital
pin during your program. I would configure RA 0 & 1 as digital inputs
rather than outputs so as not to drive the analog signal source to 0
or 5V if they were configured as digital outputs. Without seeing the
circuit it is impossible to say if setting them to digital outputs
would cause any damage.
Les.
------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Problem involving configuring pins for analog/digital operation - Guy Martin - Jun 10 20:07:07 2008

If you set bits 0/2 and leave bit 1 clear of adcon1, RA0 & RA1 are analog but RA3 becomes Vref not digital.
If you then set bit 1 all pins are digital.

You can change pin configuration at any time by writing to adcon1

Cheers, Guy

----- Original Message -----
From: Jason Hsu
To: p...@yahoogroups.com
Sent: Monday, May 26, 2008 3:09 AM
Subject: [piclist] Problem involving configuring pins for analog/digital operation
For the PIC16F72, I'm using pins 0 and 1 of Port A as analog inputs
while ALL of the other pins (rest of Port A, all of Port B, and all of
Port C) need to be digital outputs.

However, I cannot configure ADCON to do this. Of all the options
available by configuring ADCON, NONE have the analog/digital
combination I need.

Any suggestions? Would there be anything wrong with configuring pins
0 and 1 of Port A as analog inputs during the part of the program that
requires this and then configuring them as digital outputs during the
other parts of the program (the times that the input sampling function
isn't needed)? In my project (SWR/wattmeter display), the timing
isn't that critical, since I'm using a 3.58 MHz crystal, and the human
eye won't notice things that take place for a few microseconds out of
a 1 ms cycle.



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Problem involving configuring pins for analog/digital operation - np np - Jun 10 20:07:19 2008

I actually use PIC digital inputs for comparators.
I found the threshold on a VCC of 5 volts to be about 2 volts.
I have the PIC monitor a power amplifier output for DC and it switches off a relay if the DC fault condition occurrs.
It doesnt seem to take much current in that mode.

----- Original Message ----
From: Jason Hsu
To: p...@yahoogroups.com
Sent: Monday, 26 May, 2008 3:54:23 PM
Subject: [piclist] Re: Problem involving configuring pins for analog/digital operation
Thanks. I'll just have the ports reconfigured at the key times. I'm
surprised that it's rarely done. I can't possibly be the first person
in the history of the world to find that the available analog/digital
port configurations are not suitable. I'm not concerned about
excessive current in any of the pins, because both of my designated
input pins have 10 kohms between them and their respective voltage
sources.

__________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: I2C hangs - xaos - Jun 10 20:07:35 2008

My experience with I2C is that without a hardware I2C bus
debugger, anything can go wrong.

Try the intonix logicport. That's what I use.

http://pctestintruments.com/

-x

KM6VV wrote:
> I'm having a problem with I2C on an 18F4620.
>
> it occurs while waiting for SEN to go low acknowledging "Initiate
> Start". It may occur either when sending command or getting for data.
>
> I've put in a timeout, which prevents the the waits for SEN from hanging
> up the entire program, but even re-initializing the I2C will not allow
> it to run again until a power cycle.
>
> Any ideas?
>
> Alan KM6VV
>
>
------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: I2C hangs - Randy Creasi - Jun 10 20:08:13 2008

I tried forever to get i2c to work with the hardware MSSP and found the
software libraries just work a hell of a lot better!
- Randall
On Mon, May 26, 2008 at 12:17 PM, KM6VV wrote:

>
> I'm having a problem with I2C on an 18F4620.
>
> it occurs while waiting for SEN to go low acknowledging "Initiate
> Start". It may occur either when sending command or getting for data.
>
> I've put in a timeout, which prevents the the waits for SEN from hanging
> up the entire program, but even re-initializing the I2C will not allow
> it to run again until a power cycle.
>
> Any ideas?
>
> Alan KM6VV

--
Templeman Automation, LLC
http://www.TemplemanAutomation.com
617-996-9054



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: I2C hangs - Alan Marconett - Jun 10 20:25:27 2008

Thanks, I'll check it out.

Alan KM6VV

-----Original Message-----
From: p...@yahoogroups.com [mailto:p...@yahoogroups.com] On Behalf Of
xaos
Sent: Tuesday, May 27, 2008 3:00 PM
To: p...@yahoogroups.com
Subject: Re: [piclist] I2C hangs

My experience with I2C is that without a hardware I2C bus
debugger, anything can go wrong.

Try the intonix logicport. That's what I use.

http://pctestintruments.com/

-x

KM6VV wrote:
> I'm having a problem with I2C on an 18F4620.
>
> it occurs while waiting for SEN to go low acknowledging "Initiate
> Start". It may occur either when sending command or getting for data.
>
> I've put in a timeout, which prevents the the waits for SEN from hanging
> up the entire program, but even re-initializing the I2C will not allow
> it to run again until a power cycle.
>
> Any ideas?
>
> Alan KM6VV
>
>
------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: I2C hangs - Alan Marconett - Jun 10 20:33:13 2008

Randall,

You could be right! I did however since posting the question (I'm just
receiving your post) look up the Errata on the 18F4620 chip, and found some
Baud and TRIS/LATCH fixes to try. So far, they haven't helped. Something
more about insuring an idle state before issuing new start/restart command,
I haven't figured that one out yet.

My code will run for several minutes reading the SRF08 sonar ranger just
fine, and then it no longer gets the end of SEN.

Alan KM6VV

_____

From: p...@yahoogroups.com [mailto:p...@yahoogroups.com] On Behalf Of
Randy Creasi
Sent: Wednesday, May 28, 2008 10:42 AM
To: p...@yahoogroups.com
Subject: Re: [piclist] I2C hangs

I tried forever to get i2c to work with the hardware MSSP and found the
software libraries just work a hell of a lot better!

- Randall

On Mon, May 26, 2008 at 12:17 PM, KM6VV wrote:
I'm having a problem with I2C on an 18F4620.

it occurs while waiting for SEN to go low acknowledging "Initiate
Start". It may occur either when sending command or getting for data.

I've put in a timeout, which prevents the the waits for SEN from hanging
up the entire program, but even re-initializing the I2C will not allow
it to run again until a power cycle.

Any ideas?

Alan KM6VV

--
Templeman Automation, LLC
http://www.TemplemanAutomation.com
617-996-9054


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )