Recommendations - Model Train Controller


Results 1 to 40 of 102

Threaded View

  1. #29
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default Seems I'm the only one posting :)

    Ok I think I now understand the settings for ANSEL. Reading the datasheet again
    ANSEL — ANALOG SELECT REGISTER (ADRESS: 91h) (PIC16F676 ONLY)

    ANS7 ANS6 ANS5 ANS4 ANS3 ANS2 ANS1 ANS0
    bit 7 bit 0
    bit 7-0: ANS<7:0>: Analog Select between analog or digital function on pins AN<7:0>, respectively.
    1 = Analog input. Pin is assigned as analog input.(1)
    0 = Digital I/O. Pin is assigned to port or special function.
    So if I wanted all analogue I set ANSEL to 11111111 - all digital 00000000

    Ergo to set AN0, AN1, AN2 and AN4 Ansel should = 00010111, which is exactly what Darrel suggested. However when compiled with this setting the 4th output still runs at full speed with no control.

    Could it be that the issue is with the declaration of the array - as it has [3] and I would assume that there are 4 channels so maybe this should be [4] ??

    Quote Originally Posted by malc-c View Post

    Could it be that the issue is with the declaration of the array - as it has [3] and I would assume that there are 4 channels so maybe this should be [4] ??
    Looked like that was teh cause - I now have 4 working channels... just need to resolve the issue of the PIC locking on at full throttle and I'm done !
    Last edited by malc-c; - 16th February 2007 at 20:47.

Similar Threads

  1. Microstepper controller
    By aratti in forum Schematics
    Replies: 14
    Last Post: - 3rd January 2015, 16:52
  2. problem with the GSM controller
    By Dariolo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2009, 20:33
  3. Replies: 2
    Last Post: - 14th July 2008, 22:11
  4. Model Train controller - revisited
    By malc-c in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 8th May 2007, 09:40
  5. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44

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