|
Post by kennedylanduk on Nov 8, 2010 16:52:28 GMT
I'm still really pleased with getting my decoders working, and would now like to try to help improve the code.
I've got to start on something easy as I've never modified PIC ASM before.
Where would be a good place to start? I'd like to have the decoder working with 128 speed steps (just so as I don't have to modify the controller), and also fix the DC operation.
Any suggestions?
Tony.
|
|
|
Post by Paul Harman on Nov 8, 2010 20:45:29 GMT
Probably the easiest thing to do would be to grab the 126-step code from the function decoder. It should be quite straightforward to do.
What is required is to respond to the 126-step commands and convert them to 28-step commands and then link into the 28-step routine.
|
|
|
Post by kennedylanduk on Nov 8, 2010 21:03:14 GMT
Thanks Paul.
I'll give it a go tomorrow (hopefully).
|
|
JudiR
Keen DIYer
Posts: 11
|
Post by JudiR on Nov 10, 2010 20:54:39 GMT
If you are playing with the code, it would be nice if you could fix the function output. This was discussed in another thread here.
Judi
|
|
|
Post by Jon Benn on Mar 15, 2012 12:02:06 GMT
I've had a go at fixing the function output, looks like any change to the output on GP5 won't take effect whilst the motor is stationary as the MOTMASK is only applied during the 'on' section of the PWM cycle. The 'off' section only writes to pins GP2 & GP4. To get around this I've added a few lines to the 'Function_one' group, to read in the GPIO current state into TEMP, make the neccesary change to GP5 and rewrite to GPIO....seems to work ok.
Function_one: ; Function one group movf GPIO,W movwf TEMP ;TEMP now contains GPIO
bcf MOTMASK,flonoff bcf TEMP,flonoff ; set GP5 to '0'
btfss DATA2,0 ; I use bit '0' for my function instruction. goto exit_fn1 ;
bsf MOTMASK,flonoff ; save for speed macro bsf TEMP,flonoff ; if received 'on' function instruction, set bit 5 of TEMP to '1' exit_fn1: movf TEMP,W ;write TEMP back into GPIO with updated GP5 value movwf GPIO goto exit_bank1
You'll probably notice I stripped out the reference to CV29 which I don' t use in my system anyway.....if the code is to be kept NMRA standard I guess it's best to retain that bit. Hope this helps anyone wanting a function output on the motor decoder.
|
|
|
Post by berry120 on Dec 4, 2013 16:14:43 GMT
Hi all,
I've tried to swap the function_one code with the code above but still not getting any joy on the function output - has anyone else had any success with this? I assume I just need to replace the entire function one group in the asm file with this one before compiling?
On a related note, don't suppose anyone ever did get around to getting the code working with 128 speed steps? :-)
M
|
|