| Author |
Message |
qmriso
Joined: 30 Nov 2006 Posts: 81 Helped: 1
|
07 Dec 2006 7:39 Having trouble with PORTB and A (need help) |
|
|
|
|
I am currently working on simple UART project, but when i recive a byte on portB ( i'm using PIC 18f2320) pin RB5 never gives an output
even if i send 0xFF.
So I thought to test the port by using this code
void main(void)
{
TRISB=0;
LATB=0;
while (1)
{
LATB=0xFF;
}
}
But no luck.(MPLAB said that this would work fine)
So i tried to use PORTA with this code:
void main(void)
{
ADCON1bits.PCFG3=1; //sets portA bit0-3 to digital I/O
TRISA=0;
LATA=0;
while (1)
{
LATA=0xFF;
}
}
Again MPLAB said that this would work fine, but on the chip i had nothing on pins RA7 and RA4 (i have configered the oscillator so that RA 6 and 7 are I/O)
Can anyone Help me?
|
|
| Back to top |
|
 |
traxonja
Joined: 06 Apr 2004 Posts: 109 Helped: 1
|
07 Dec 2006 14:05 Re: Having trouble with PORTB and A (need help) |
|
|
|
|
Check the datasheet for that MCU that you are using. Usually PORTA.4 cannot be used as output, so check the PDF.
www.elektronika.ba
|
|
| Back to top |
|
 |
Google AdSense

|
07 Dec 2006 14:05 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
En_Serg
Joined: 22 Dec 2004 Posts: 11
|
10 Dec 2006 4:59 Re: Having trouble with PORTB and A (need help) |
|
|
|
|
CONFIG1H: CONFIGURATION REGISTER 1 HIGH (BYTE ADDRESS 300001h)
OSC<3:0>: Oscillator Selection bits
bit 3-0 FOSC
0101 = EC oscillator, port function on RA6
You need set theese bits in CONFIG1H for correct work with RA6
|
|
| Back to top |
|
 |