What is wrong & where - 16F877A+U2 USB programmer


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2009
    Location
    London
    Posts
    251

    Default What is wrong & where - 16F877A+U2 USB programmer

    Hi, I am unable to make any of my PIC work when I program it with my U2 usb programmer.
    I compile it with MPLAB>>PBP.
    Programs as simple as HIGH portb.7 : pause 2000 : low portB.7 are not working as well though the programmer shows that it got programmed fine.

    Many times I have to disconnect/reconnect the wire of the USB programmer because of the error messeges such as "Device Not Blank........" or "Device does not match......" even though the correct device is selected. Is my programmer at fault?
    Can someone please help me to know where the problem is? Thanks

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    With so little information, there's no way to know.

    Have you verified the items on the ICSP page?

    In-Circuit Serial Programming (ICSP)
    http://melabs.com/support/icsp.htm

    Have you set your configs?

    Specifying configuration bit settings in PICBASIC PRO™ programs.
    http://www.melabs.com/support/config_defaults.htm

    Have you disabled the Analog inputs?

    All Digital
    http://www.picbasic.co.uk/forum/showthread.php?t=11100
    <br>
    DT

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    644


    Did you find this post helpful? Yes | No

    Default

    Megahertz,

    I have a U2 USB programmer and it works great. Can you post your code? Can you post the programmer PIC settings? Are you doing ICSP?

    I ussually get the "Device does not match......" message when the PIC is not receiving any power.

    Robert

  4. #4
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default My Code and Problem with U2 USB

    Here is my code:
    Code:
    Include "modedefs.bas"
    INCLUDE "DT_INTS-14.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ' Include if using PBP interrupts
    DEFINE     NO_CLRWDT    1
    DEFINE          OSC     4       ' OSCCON defaults to 4MHz on reset
    
    @ __CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_ALL & _BODEN_ON & _CPD_ON
    
    PAUSE 100
    LED VAR PORTB.6
    F1 var Bit
    F2 var Bit
    F3 var Bit
    S1 var bit
    S2 var bit
    S3 var bit
    i var byte
     
    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 7
    DEFINE DEBUG_BAUD 2400
    DEFINE DEBUG_MODE 1
     
    DEFINE DEBUGIN_REG PORTA
    DEFINE DEBUGIN_BIT 0
    DEFINE DEBUGIN_MODE 1
     
    PAUSE 50
    ADCON1=7
    CMCON=7
    OPTION_REG=%10000111
    TRISA=%000001    
    PORTA=0
    TRISE=%000      
    PORTE=0
    TRISB=%00000000  
    PORTB=0
    TRISC=%00001111  
    PORTC=0
    TRISD=%00000011  
    PORTD=0
    CCP1CON=0
    @ ERRORLEVEL -306
     
    F1=0 : F2=0 : F3=0 : S1=0 : S2=0 : S3=0
      
    main:
    high LED: LED=1 : PAUSE 2000
     
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ToggleLEDF,   PBP,  yes
            INT_Handler   TMR0_INT,  _ToggleLEDS,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    T1CON = $31                ; Prescaler = 8, TMR1ON
    @ INT_ENABLE  TMR1_INT     ; enable Timer 1 interrupts
    @ INT_ENABLE  TMR0_INT     ; enable Timer 1 interrupts'
     
    
    while 1
    Start:
     
    M1A:
    If PortC.0=0 then
     
    mmm:
        for i=1 to 30
        DEBUG "MT3",2,10
       Pause 10
       next i
     
    M1S:
       DEBUGIN 3000,mmm,[WAIT("MT3",2,"S")] 
       F1=1 : PAUSE 1500
     
       DEBUGIN [WAIT("MT3",2,"C")]
       F1=0 : S1=1 : PAUSE 1500
    endif
     
    M1D:
      If PortC.1=0  then
    mm:
       for i=1 to 30
        DEBUG "MT3",2,"D"
        Pause 10
       next i
       DEBUGIN 3000, mm,[WAIT("MT3",2,"D")]
      F1=0 : S1=0 : PortA.0=0  : PAUSE 1000
      endif
    wend 
    '---[TMR1 - interrupt handler]--------------------------------------------------
    
    ToggleLEDF:
         If F1=1 then Toggle PortD.2
         If F2=1 then Toggle PortD.3
         If F3=1 then Toggle PortC.4
    @ INT_RETURN
    
    '---[TMR2 - interrupt handler]--------------------------------------------------
    
    ToggleLEDS:
    TOGGLE LED
         If S1=1 then Toggle PortD.2
         If S2=1 then Toggle PortD.3
         If S3=1 then Toggle PortC.4'
     pause 100
    @ INT_RETURN
    I have to try many times by disconnecting/reconnecting the USB cable so that my board come to Green LED (Ready). 95% of times there is an error message. I am unable to do anything smoothly using this board, I do not know if I am doing somethign wrong or the board is faulty.

    I am now trying to upload this code and errors is "Target Device does not match the selected device", even though 16F877A is selected on Programmer window.
    Also with the ones I programmed before - My LED does not GLOW for 2 seconds when the code starts. PIC seems to keep resetting itself - The reason is that the LED starts flickering.

    I am not programming the PIC while it is in its circuit. I am using the 40PIN connector with the USB programmer.

    But First thing first, please help me solve the programming board problem, so I can firstly start programming smoothly. I have attached the programmer settings screenshot. Please let me if any more information is needed. Thanks a lot.
    Attached Images Attached Images  

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Megahertz View Post
    I am not programming the PIC while it is in its circuit. I am using the 40PIN connector with the USB programmer.
    Which one of the 40-pin adapters do you have?

    -

    If it's the one on the left, is it connected properly for a 40-pin device.

    DT

  6. #6
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Yes it is the one on the left. Thanks

  7. #7
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    644


    Did you find this post helpful? Yes | No

    Default

    Megahertz,

    Are you setting the chip in the right position like Darrel is showing you in the picture above? Pin 1 has to be in the right position. Also, try using different USB ports in your computer and even a different computer.

    Robert

  8. #8
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rsocor01 View Post
    Megahertz,

    Are you setting the chip in the right position like Darrel is showing you in the picture above? Pin 1 has to be in the right position. Also, try using different USB ports in your computer and even a different computer.

    Robert
    Apologies for the delayed reply. Yes I am setting the chip the right way. I also tried on different computer but red led flashes on the board. I have to reconnect the USB cable around 4-5- times before it turns green and then programs the chip. Then most of the times the same story again for the next chip I want to program.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts