ICDWarn0020: Invalid target device id (expected=0x4F, read=0x0)


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    21


    Did you find this post helpful? Yes | No

    Default New code, interrupt

    'Aim: to use adc bits as inputs, apply sinusoidal input and
    'upgrade the blink project a little further. The next step is going to
    'be using interrupt.


    'OpenADC(ADC_FOSC_32&ADC_RRIGHT_JUST&ADC_12_TAD,AD C_CH0&ADC_INT_OFF,0)
    ' I do not really know how to activate ADC, and use it. The above one
    'is actually a c code.


    Define ADC_BITS 8 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS

    ADC_intstatus var PortB.0

    On Interrupt Goto ADC_interrupt

    INTCON=%10010000 ' Enable RBO interrupt

    Outvalue var PORTD.0
    adc_result var word ' Create adc_'result to store result

    Outvalue= 0 'Set PORTD.0 output
    TRISA = %11111111 'Set PORTA to all input, so I can use ADC
    ' bits as input
    ADCON1 = %10000010' Set PORTA analog and right justify result

    DISABLE
    ADC_interrupt:

    Pause 500 ' Wait .5 second while (Busy adc()) ' while it is busy keep it in a loop

    ADCIN 0, adc_result ' Read channel 0 to adcresult

    if adc_result> 125 then Outvalue =! Outvalue ' I thought if it is 8 bits, then 2^8=256


    RESUME
    ENABLE

    End



    Thanks for the comments, Skimask. I was busy studying as u suggested. It is the reason for the late reply. This is the new code, with 'interrupt' in it.

    My pic is dead, I've ordered a new one. I cannot try it right now.

    I'm working with PIC18F4550. Want to use A/D pins as inputs, and make PORTD.0 to blink led.

  2. #2
    Join Date
    May 2007
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    actually I tried to debug it with the simulation.

    CORE-E0002: Stack under flow error occurred from instruction at 0x0000c4

    Can someone help me on the code?

  3. #3
    Join Date
    May 2007
    Posts
    21


    Did you find this post helpful? Yes | No

    Default for starters !!!

    if u want to test your (interrupt)code without connecting an external device, you should not forget to create your own interrupt. At least, it was enough to solve my problem. the easiest way ;
    -initiate PORTB <7:4>=0
    -when u want to create interrupt set PORTB<7:4>=1

    Did I start answering my own questions or what?


    best regards

  4. #4
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile Yahoo Questons asked - Questions Answered....

    Quote Originally Posted by kutsi View Post
    Did I start answering my own questions or what?
    best regards
    Wow kutsi,
    It doesn’t get any better than asking a question, learning, and answering your own question.
    Great! Just don’t get into a flame war argument with yourself. That’s the worst.
    -Adam-
    Ohm it's not just a good idea... it's the LAW !

Similar Threads

  1. ICDWarn0020: Invalid target device id
    By pravec065 in forum General
    Replies: 3
    Last Post: - 4th August 2008, 14:43
  2. Target device does not match
    By krohtech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd February 2008, 05:20
  3. PIC18F4620 not Target Device
    By kiwipiper in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th October 2007, 20:42
  4. Target device <> Selected Device????
    By deepgfishing in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th June 2007, 22:18
  5. @ Device Parameters
    By Randy_Suwanee in forum General
    Replies: 2
    Last Post: - 11th August 2004, 15:40

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