Forums

16F628

Started by Unknown May 29, 2004
I want to use PortA.2 on the 628 for a serin.  Do I write:

TRISA = %00000000

Do I have to set CMCON?

Thanks

Sid



Since no one responded, I'll post it gain.  Maybe this time .............. I want to use PortA.2 on the 628 for a serin.  Do I write:

TRISA = %00000000

Do I have to set CMCON?

Sid





Set the bits in TRISA to 1's if you want them to be inputs.  Therefore, to set PortA.2, you would use TRISA=%00000100.
 
Best,
Scotty
 
 
----- Original Message -----
From:
To: p...@yahoogroups.com
Sent: 5/30/2004 16:27:52
Subject: [piclist] 16F628

Since no one responded, I'll post it gain.  Maybe this time ..............I want to use PortA.2 on the 628 for a serin.  Do I write:

TRISA = %00000000

Do I have to set CMCON?

Sid




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


----- Original Message -----
From:
To:
Sent: Monday, May 31, 2004 12:27 AM
Subject: [piclist] 16F628 Since no one responded, I'll post it gain. Maybe this time .............. I want to use PortA.2 on the 628 for a serin. Do I write:

TRISA = %00000000

Do I have to set CMCON?

Read page 82 of the PIC16F62x data. It's some time since I've done it, but
it worked OK.

Leon
--
Leon Heller, G1HSM
http://webspace.webring.com/people/jl/leon_heller/





If, by 'serin' you mean a serial input to the USART then that would
be on PORT B. If you want to 'bit-bang' a serial input then you can
use any input bit.

Setting TRISA to 0x00 would set all bits as output - probably not
what you want.

Yes, you do need to deal with CMCON when using PORT A. There are
examples in the PIC62x datasheet, specifically example 5-1.

You might look at figure 9-1 for information about PORTA and CMCON.
Specifically the low order 3 bits need to be '1' if you plan to use
the port for digital IO

Chapter 12 deals with the USART. --- In , Newzed@a... wrote:
> Since no one responded, I'll post it gain. Maybe this
time ..............
>
>
> I want to use PortA.2 on the 628 for a serin. Do I write:
>
> TRISA = %00000000
>
> Do I have to set CMCON?
>
> Sid




In a message dated 5/31/2004 1:03:16 AM Eastern Daylight Time, r...@pacbell.net writes:


Yes, you do need to deal with CMCON when using PORT A.  There are
examples in the PIC62x datasheet, specifically example 5-1.

You might look at figure 9-1 for information about PORTA and CMCON. 
Specifically the low order 3 bits need to be '1' if you plan to use
the port for digital IO


Thanks, rstofer.

Fig. 9-1 was what I was looking for.  Must have passed over it first time thru the data sheet.  Example 5-1 is in assembly so that is Greek to me but I did note the 0x07.  I did a program for the 628 a long time ago and CMCON = 7 sounded very familiar.

Thanks again.

Sid


Yes, I believe you do have to set CMCON to
0x07, if you want to use the comparator pins as
digital inputs.

I ran into this on the 12F629, and it was very
irritating.

--- In , "Leon Heller" <leon_heller@h...>
wrote:
> ----- Original Message -----
> From: Newzed@a...
> To:
> Sent: Monday, May 31, 2004 12:27 AM
> Subject: [piclist] 16F628 > Since no one responded, I'll post it gain. Maybe this
time ..............
>
>
> I want to use PortA.2 on the 628 for a serin. Do I write:
>
> TRISA = %00000000
>
> Do I have to set CMCON?
>
> Read page 82 of the PIC16F62x data. It's some time since I've done
it, but
> it worked OK.
>
> Leon
> --
> Leon Heller, G1HSM
> http://webspace.webring.com/people/jl/leon_heller/