+ Reply to Thread
Results 1 to 10 of 10

Thread: pic18f2580 portb<5:7>

  1. #1
    einton Newbie
    Join Date
    Jan 2009
    Location
    pakistan
    Posts
    45

    Default pic18f2580 portb<5:7>

    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.


  2. #2
    gaspode42 Good gaspode42 Good gaspode42 Good gaspode42 Good
    Join Date
    Feb 2009
    Location
    UK
    Posts
    201

    Default

    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 by gaspode42; 10th August 2009 at 07:37 AM.
    "A lie gets halfway around the world before the truth has a chance to get its pants on" - Sir Winston Churchill (1874 - 1965)

  3. #3
    einton Newbie
    Join Date
    Jan 2009
    Location
    pakistan
    Posts
    45

    Default

    No i have lvp turned off.

  4. #4
    BronzeG3 Newbie
    Join Date
    Jan 2007
    Posts
    22

    Default

    Do you have background debugger disabled?

  5. #5
    einton Newbie
    Join Date
    Jan 2009
    Location
    pakistan
    Posts
    45

    Default

    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 by einton; 16th August 2009 at 07:38 AM.

  6. #6
    gaspode42 Good gaspode42 Good gaspode42 Good gaspode42 Good
    Join Date
    Feb 2009
    Location
    UK
    Posts
    201

    Default 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
    "A lie gets halfway around the world before the truth has a chance to get its pants on" - Sir Winston Churchill (1874 - 1965)

  7. #7
    einton Newbie
    Join Date
    Jan 2009
    Location
    pakistan
    Posts
    45

    Default

    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.
    Attached Files

  8. #8
    gaspode42 Good gaspode42 Good gaspode42 Good gaspode42 Good
    Join Date
    Feb 2009
    Location
    UK
    Posts
    201

    Default Project file

    einton

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

    Rupert
    "A lie gets halfway around the world before the truth has a chance to get its pants on" - Sir Winston Churchill (1874 - 1965)

  9. #9
    einton Newbie
    Join Date
    Jan 2009
    Location
    pakistan
    Posts
    45

    Default

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

  10. #10
    be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent
    Join Date
    Aug 2008
    Location
    morristown,tn
    Posts
    1,998

    Default

    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
    }
    }
    
    Burt

+ Reply to Thread

Similar Threads

  1. CAN protocol using mikroc pro by pic18f2580
    By einton in forum Micro Controllers
    Replies: 3
    Latest: 29th July 2009, 02:46 PM
  2. Still remain no output from portB
    By babboy12345 in forum Micro Controllers
    Replies: 17
    Latest: 20th February 2009, 03:23 AM
  3. portb pull-ups
    By flawed in forum Micro Controllers
    Replies: 5
    Latest: 1st April 2008, 06:05 AM
  4. Portb
    By YAN-1 in forum Micro Controllers
    Replies: 6
    Latest: 5th June 2007, 11:04 AM
  5. 16F877a portb.0.1.2.3
    By TKS in forum Micro Controllers
    Replies: 11
    Latest: 10th April 2006, 08:08 PM

Tags for this Thread