Recommendations - Model Train Controller


Closed Thread
Results 1 to 40 of 102

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Steve

    Did you notice a 1K resistor had magically appeared in series with the trans. base ??? ...
    Alain, the 1K base resistor was added way back after you suggested in post #46 that I removed the R4/D1 combo and and a series 1 k in the base connection

    The nearest shematic I have is as detailed in post #57 - apart from the fact that I'm using a 16F676 rather than the 12F675 - the output stage is the same, I've not changed anything since, and wouldn't edit posts to suit...
    Last edited by malc-c; - 16th February 2007 at 14:19.

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


    Did you find this post helpful? Yes | No

    Default

    Malcolm,

    I've got it running here on a 16F676. But...

    You have a POT input on AN3, which is also the OSC2 for the crystal.

    If I comment out the ADCIN 3, DUTYVAR4 then it seems to run fine.
    But with that statement in there it goes wacko.
    <br>
    Added: ANSEL needs to be changed too, but I'll wait to see where you move the AN3 to.
    DT

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Whoops !

    Thanks for spotting my deliberate mistake !!!!

    Thanks for the PM, I've created another copy of the code and downloaded the DT_int 18 file, the following compiles OK but I have to use a different programmer for pics with 18 pins or more and I've never had much luck with 18F2550's and this programmer as Steve will vouch !!

    I'll try some changes for the 16F676 and see how I get on.. Thanks to everyone again for your assistance...

  4. #4
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Malcolm,

    ANSEL needs to be changed too, but I'll wait to see where you move the AN3 to.
    I actually marked it on the datasheet pinout to use AN4 (pin 10) on the 16F676 - I should pay more attention to what I plan !!

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


    Did you find this post helpful? Yes | No

    Default

    AN4, ok.

    Make ANSEL = %00010111
    <br>
    DT

  6. #6
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    AN4, ok.

    Make ANSEL = %00010111
    Darrel, can you confirm that I have understood the variables for SPWM_PIN right, and that I'm using the correct channels for a/d, as I only had 2 out of 4 outputs working right, and now made changes I get that high frequency noise from the armature (where as before it was a low growl, even with a 20 Mhz xtal)

    I want to use the following pins on the 16F676 for inputs from 10K pots, and their corresponding PWM outputs

    Pot 1 - Pin 13 - AN0 - controlling output on pin 8 - RC2
    pot 2 - Pin 12 - AN1 - controlling output on pin 5 - RC5
    pot 3 - Pin 11 - AN2 - controlling output on pin 6 - RC4
    pot 4 - Pin 10 - AN4 - controlling output on pin 7 - RC3

    so I've set up SPWM_PIN as
    Code:
    SPWM_LIST  macro                    ; Define Pin's to use for SPWM
        SPWM_PIN  PORTC, 2, _DutyVar1   ; and the associated DutyCycle variables
        SPWM_PIN  PORTC, 5, _DutyVar2   ; Notice the underscore before variables
        SPWM_PIN  PORTC, 4, _DutyVar3
        SPWM_PIN  PORTC, 3, _DutyVar4
    And have the main program as
    Code:
    Main:                               
     ADCIN 0, DUTYVAR1
     ADCIN 1, DUTYVAR2
     ADCIN 2, DUTYVAR3
     ADCIN 4, DUTYVAR4
     GOTO Main
    I'm assuming the value of ANSEL is incorrect as its ommitting that high frequency noise. Given the above info, which I hope is clear, what would be the correct value for ANSEL, or have I made another boo boo in assignig the pins ?

    By the way, prior to the change I had it running really well on CH1 - you thought that on a 12F @ 4mhz the loco was slow.... wait to you see the video for it running on a 16F @ 20 mhz !! - its just amazing !!

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default Slow PWM in action

    Darrel,

    Here is that video - http://www.micro-heli.co.uk/controller2.avi

    I've left the audio element in so you guys can hear the growling the loco makes, the downside is that this has made the file 24MB

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    No secret, Malc ...

    PWM freq too low.
    ( may be also a poor quality motor too ... but you can't choose which will be used.)

    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 " !!!
    *****************************************

  9. #9
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by malc-c View Post
    Alain, the 1K base resistor was added way back after you suggested in post #46 that I removed the R4/D1 combo and and a series 1 k in the base connection

    The nearest shematic I have is as detailed in post #57 - apart from the fact that I'm using a 16F676 rather than the 12F675 - the output stage is the same, I've not changed anything since, and wouldn't edit posts to suit...
    We're in sync Malc ... just R3 NOT to be shorted !!! ... but placed in series with the NPN COLLECTOR ...

    MEA Culpa ...

    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 " !!!
    *****************************************

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