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.
|
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: 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://www.geocities.com/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 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://www.geocities.com/leon_heller |
|
I need to use PortA.4 for a serout, but it
doesn't seem to be working. I wrote: CMCON = 7 Is there anything else I need to do? Serout makes the pin an output so I'm not concerned about direction. Sid |
|
|
|
Ordinarily the Tx pin is on PORTB.2 and Rx is on PORTB.1. Look back a few threads - we have been discussing the 16F628 all week. Code, known to work, is posted. --- In , Newzed@a... wrote: > I need to use PortA.4 for a serout, but it doesn't seem to be working. I > wrote: > CMCON = 7 > > Is there anything else I need to do? Serout makes the pin an output so I'm > not concerned about direction. > > Sid |
In a message dated 11/17/2004 6:18:33 PM
Eastern Standard Time, r...@pacbell.net writes:Ordinarily the Tx pin is on PORTB.2 and Rx is on PORTB.1. Look back I have to use PortA.4. It is the only pin available. Can't I use it for serout? Sid |
|
|
|
--- In , Newzed@a... wrote: > In a message dated 11/17/2004 6:18:33 PM Eastern Standard Time, > rstofer@p... writes: > > Ordinarily the Tx pin is on PORTB.2 and Rx is on PORTB.1. Look back > > a few threads - we have been discussing the 16F628 all week. Code, > > known to work, is posted. > > > > I have to use PortA.4. It is the only pin available. Can't I use it for > serout? > > Sid] I guess you can but it will be bit-banged, not from the on-chip USART. I don't know if it will matter but PORTA.4 is an open-drain output. You will need to pull it up with a resistor. If you plan to wiggle it then you will need to define it as an output. You didn't say what language you were using and I don't know if the one you are using provides bit-banged serial IO. I imagine some do but I don't have any experience doing this. |
|
Sid: I think you're thinking stamps . . . the 16f628 only does tx on RB1 (or whatvever), mr. stofer is correct. I think the stamp authors wrote some routines to bit-bang serial com out any port, because I know the stamp you can change the output pin. You will need to change your pins around so you free up the right pin, and change your code to match. Or stay with the stamp, it's a pretty good deal. Or try the picaxe, I just got one in from mr. anderson (en?), do a google search, he sells stuff on the cheap. The picaxe has a bootloader and special pc software to do the deal like the stamp but not through eprom, check it out. --- In , Newzed@a... wrote: > In a message dated 11/17/2004 6:18:33 PM Eastern Standard Time, > rstofer@p... writes: > > Ordinarily the Tx pin is on PORTB.2 and Rx is on PORTB.1. Look back > > a few threads - we have been discussing the 16F628 all week. Code, > > known to work, is posted. > > > > I have to use PortA.4. It is the only pin available. Can't I use it for > serout? > > Sid |