electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Having trouble with PORTB and A (need help)


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Having trouble with PORTB and A (need help)
Author Message
qmriso



Joined: 30 Nov 2006
Posts: 81
Helped: 1


Post07 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


Post07 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
Google Adsense




Post07 Dec 2006 14:05   

Ads




Back to top
En_Serg



Joined: 22 Dec 2004
Posts: 11


Post10 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
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Having trouble with PORTB and A (need help)
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Beginning C user having trouble using #define with functions (2)
Having trouble doing this differential equation ... (2)
having trouble for 435 Mhz Yagi antenna Input impedance (5)
Problems with PORTB and Timwe1 interrupt (2)
3GPP LTE code - having trouble about the simulation code (3)
Trouble with AT8515 coding...please help (1)
Connecting Rx and Tx with ckts having different supplies? (3)
Trouble with PIC16F877 and LM35DZ ( Stabilizing Temp) (4)
LATB and PORTB register in PIC18XXX ? (2)
I need to control portb of pic using philips remote (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS