ANSEL command


Closed Thread
Results 1 to 5 of 5

Thread: ANSEL command

  1. #1
    Join Date
    Jan 2006
    Location
    Slovenia EU
    Posts
    32

    Default ANSEL command

    Hello,

    I was made one simple test program with ADC. I have problem with MCS compiled. I don't understand what is wrong with ANSEL = 1 command? Into status line write syntax error!! When disable this ANSEL command compiled finished ok. I was trying compile with PBP2.50b and MPASM and result is equal.
    Who is problem here?

    @ Device PIC12F675,WDT_ON,PWRT_ON,PROTECT_OFF,MCLR_OFF,BOD_ OFF
    ANSEL = 1
    ADCON0 = 3
    CMCON = 7
    DEFINE OSCALL_2K 1
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50

    w0 VAR WORD
    w1 VAR WORD
    w2 VAR WORD
    w3 VAR WORD
    w4 VAR WORD
    w5 VAR WORD
    w6 VAR WORD
    w7 VAR WORD
    out VAR GPIO.2

    meritev: ADCIN 0, w0


    w1= 1023-w0/2

    high out
    pause w1
    low out
    pause w1

    goto meritev
    Attached Images Attached Images  
    Last edited by Samoele; - 9th January 2009 at 13:25.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    [ Humour ON ]
    Who is problem here?
    You really sure to want the answer ???

    [ Humour OFF ]

    Now,

    Code:
    DEFINE OSCALL_2K 1
    MUCH Better :

    Code:
    DEFINE OSCCAL_1K 1

    Code:
    ANSEL = 1 
    ADCON0 = 3
    Much better

    Code:
    ANSEL    = %01110001 ; RC - GPIO.0 ana.
    ADCON0 = %10000000 ; for 10 bits ... right justif !!! - wait for ADCIN to start.

    AND For the end ...

    You did not define the I/Os ...

    Code:
    TRISIO = %11001001 ; if you want GPIO.0 to work as an ADC input. ( see manual ! )

    At this level ...
    You MIGHT open

    1) THE Manual
    2) The Pic relevant Datasheet ...

    Alain
    Last edited by Acetronics2; - 9th January 2009 at 14:31.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Jan 2006
    Location
    Slovenia EU
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    thanks Alain

    I was repair our routine and result is no unchanged. Here must be another problem

    show attachment
    Attached Images Attached Images  

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    I do not think this:

    Code:
    @ Device PIC12F675,WDT_ON,PWRT_ON,PROTECT_OFF,MCLR_OFF,BOD_ OFF
    exist with PBP, PM, MPASM, nor MCS ...

    last effort ... go on !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Jan 2006
    Location
    Slovenia EU
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Hello!

    I was repaired this problem.
    I was copy compiled file on location where have MCS and run it :

Similar Threads

  1. My code for TV remote and MIBAM for RGB control
    By idtat in forum Code Examples
    Replies: 4
    Last Post: - 12th January 2013, 20:52
  2. Easy HID Command -Response application
    By ptig185 in forum USB
    Replies: 25
    Last Post: - 22nd September 2010, 19:56
  3. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  4. Can I do this???
    By noobie in forum mel PIC BASIC
    Replies: 2
    Last Post: - 10th June 2006, 18:57
  5. Interupts and Command string
    By Tissy in forum Serial
    Replies: 13
    Last Post: - 17th March 2006, 23:59

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