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


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    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

  2. #2
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    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

  3. #3
    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  

  4. #4
    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

  5. #5
    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

  6. #6
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    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

  7. #7
    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 : 0

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