pic18f2580 portb<5:7>

Status
Not open for further replies.

einton

New Member
hi guys i m using pic18f2580 for my project , but here i m involved in annonying problem with portb as its pins<5:7> are not working any way, is there any hidden matter involved with this; my program is this
void main()
{
TRISB = 0X0; // Configure PORTB as output
for(; // Endless loop
{
LATB = 0; // Turn ON LED, portb also used in place of lat
Delay_ms(2000); // 2 second delay
LATB = 0XFF; // Turn OFF LED
Delay_ms(2000); // 2 second delay
}
}
other pins are working but last three are not, i have configure <0:4> as digital i/o on reset.my hardware is alright as i have checked.
 
Do you have LVP turned on in config fuses?

Note: On a Power-on Reset, RB4, RB1 and RB0
are configured as analog inputs by default
and read as ‘0’; RB7:RB5 and RB3:RB2
are configured as digital inputs.
 
Last edited:
hi guys please do some favour to me , i need to verify my config bits setting, im using mikroc pro for pic , my program is
void main()
{
TRISB = 0; // Configure PORTB as output
for(; // Endless loop
{
PORTB = 0XFF; // Turn ON LED
Delay_ms(2000); // 1 second delay
PORTB = 0; // Turn OFF LED
Delay_ms(2000); // 1 second delay
}
}
portb<0:4> are working but pins<5:7>
are not ,please look this matter and my config setting ,
02
06
1E
80
80
0F
C0
0F
E0
0F
40


i have stack ov off , lvp is also off, background debug also, and xtended instruction set also off,portb pins are also designed as digital on reset.PLEASE TELL EARLIER what is the posssible problem, BECAUSE I NEED TO VERIFY WHETHER THERE IS ANY PROBLEM WITH MY HARDWARE, i have used various programs u please verify whether there is problem with my config settings.all other programs are working very efficiently.
 
Last edited:
Config Fuses

Hello Einton

On the PIC18F2580 there are over 10 configuration registers with a total of more than 28 options - you have posted a list of 11 'random' numbers that mean nothing. If you could tell us to which registers that they belong it means that we could check your config. If I just apply them in order from the start then I get:

0x02 in FOSC = High Speed Crystal/Resonator
0x06 in FCMEN = INVALID OPTION.

I dont know your hardware but you could try:

Code:
    __CONFIG _CONFIG1H, _OSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOREN_OFF_2L & _BORV_3_2L
    __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_32768_2H
    __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
    __CONFIG _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _BBSIZ_1024_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
    __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
    __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
    __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
    __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
    __CONFIG _CONFIG7H, _EBTRB_OFF_7H

So please give us a clue, and help us to help you
 
Dear thanx 4 ur time.,i just want to test my portb pins for which i m using the program to blink the leds connected to portb pins, the program i have sent u earlier, the config settings i sent u were the sequence of config registers settings from config 1h to config7h.
but i have attached the config setting window of my mikroc pro compiler from edit project menu , which shows config settings and the actual words, the program was simple and described above.
 

Attachments

  • configyyy.zip
    53.5 KB · Views: 140
Project file

einton

Please zip and post your entire Mikro pro C project file. I will check it for you.

Rupert
 
ok dear i m sending u the file, i use 8 Mhz crystal
 

Attachments

  • led blink.zip
    61.1 KB · Views: 130
I don't know why i waste my time but one more time. You don't have portb set right
Note: On a Power-on Reset, RB4, RB1 and RB0
are configured as analog inputs by default
and read as ‘0’; RB7:RB5 and RB3:RB2
are configured as digital inputs.

I did see any
MOVLW 0Eh ; Set RB<4:0> as
MOVWF ADCON1 ; digital I/O pins
Code:
void main()
{
TRISB = 0x0; // Configure PORTB as output
ADCON1 = 0xE;
for(;;) // Endless loop
{
PORTB = 0XFF; // Turn ON LED
Delay_ms(2000); // 1 second delay
PORTB = 0x00; // Turn OFF LED
Delay_ms(2000); // 1 second delay
}
}
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…