It just sort of clicked.

By shaunm

Train circuit development & testing

Not particularly exciting for you! but I have made some progress with my new circuit today... spent the best part of the afternoon/evening finding bugs (of the programming variety) fixing bugs and creating more bugs in the process... generally chasing bugs about.

But I am happy with my progress, even if it is slow going... it's getting there and I hope it will be all the better (and more reliable) for it!

<Geeky info>

The new circuit is going to produce the signals for the servos that move the choke and throttle. It will also produce the PWM signal that controls the amount of power going to the field winding of the alternator.

The above was previously achieved using two separate circuits and PIC Micro-controllers... the servo one wasn't the best programming in the world (it was hastily cobbled together from various examples I found online)... so I have been doing it all from scratch, including all the maths that goes with it (we're talking calculating the timings of various instructions and timers in order to generate pulses every 20ms or so that are 0.9-2.1ms long - based on the input from a potentiometer.)

It's working... but not as well as I'd like, so I am going to program it in assembly rather than C (much better control over the timing) and change the frequency of the crystal from 4mhz to something like 20mhz. The reason for the crystal change is to reduce the amount of time each instruction cycle takes, which will give me more room for error in the number of instructions used. It will use more power, but when I'm generating my own power on board... an extra few mA isn't going to make any difference! Anyway. I'm saving power by reducing the number of controllers I'm using.

</Geeky info>

Comments
Sign in or get an account to comment.