View Full Version : need hex code to make 12c509 a flip flop, for rudder only
brucej
Nov 12, 2004, 07:48 PM
does anybody have a hex code to make a 12c509 pic into a flip flop, i am playing with a rudder only idea, i want to use a negative going square wave.
You can do what i want with a cmos 4027, but they are big, were a 12c509 would be ideal for the experiment, just need one input pin, and two output pins that flip flop.
thanks
brucej
TugBoat
Nov 12, 2004, 08:08 PM
Bruce:
I think you need to explain what the relationship is that you require between the input pin and the the 2 output pins.
A diagram of the equivalent circuit using a 4027 would probably be the best help.
Tim
Dan Baldwin
Nov 12, 2004, 08:18 PM
Actually I don't think a circuit equivalent diagram of a 4027 will do all that much good since it's a dual JK master slave flip flop. It has 5 inputs and 2 outputs. I think all BruceJ wants is for one of the outputs to be high, and one of the outputs to be low, and every time the input transitions from high to low, the outputs swap. Is that right, BruceJ?
Dan
brucej
Nov 12, 2004, 08:23 PM
yes dan thats all i need
tve
Nov 13, 2004, 12:58 AM
Hi Bruce,
One of these pics would be even smaller yet....
http://ww1.microchip.com/downloads/en/DeviceDoc/41239A.pdf
They are available at digikey in sot packages....
Sorry, don't have a hex file for you...yet
TugBoat
Nov 13, 2004, 02:58 AM
BruceJ:
I can offer you this:
- this is the code+hex file for the 'flipflop' function for a 12F629 or 12F675 PIC. These are Flash programmable PICs that are very similar to the 12C509.
- The input signal is on pin 2 the outputs are on pins 6 and 7
- Every time the input signal makes a high to low transition the outputs change state
- Pin 7 is the inverse of pin 6
Tim
brucej
Nov 14, 2004, 09:33 PM
thanks tugboat would that code assemble into a 12c509 ?
brucej
Dan Baldwin
Nov 15, 2004, 12:04 PM
The 12F675 code will not work for a 12C509 without modifications.
Dan
TugBoat
Nov 15, 2004, 04:16 PM
That's right - I should have mentioned that some mods would be required for the 12C509. While I could make the mods I would only be able to test via simulation - and I prefer to test a 'real' one before releasing code here.
Why not just get a few 12F675s? They are flash parts so you can reuse them again and again - if the program isn't quite right just alter and reprogram. You can get them for a reasonable price from www.microzed.com.au (A$3) - actually they are cheaper than the 12C509! If you can program a 12C509 then you should also be able to program the 12F675 - just remember that the calibration value at 0x3FF need to be preserved when PIC is programmed.
If you want me to make the code mods for a 12C509 let me know - as I said I can test it via simulation but I can't burn one and test.
Tim
brucej
Nov 15, 2004, 09:06 PM
tugboat, thank you, i realy appreciate your help with this project.
firstly, yes if you could do the code mods for the 12c509 i can burn and test it. I accept your code as provided by you as experimental.
second,I will have a look at microzed for future projects, as i can only get very limited types of pics , thats why i favor the 12c509, as i have a bunch on the bench here.
3rd, i was given a flip flop code for a 12c509, but as you can see below its not a hex file,, compiled hex files i can deal with, does it make any sence to you ?
tnx brucej
code:--------------------------------------------------------------------------------
InputPin VAR GPIO.0
Qout VAR GPIO.1
Q_out VAR GPIO.2
Qout=0
Q_out=1
start:
while InputPin=0
wend
Toggle Qout
Toggle Q_out
while InputPin
wend
goto start
--------------------------------------------------------------------------------
__________________
TugBoat
Nov 15, 2004, 11:57 PM
Bruce:
OK, I will see what I can do.
The code you have is for some sort of PIC Basic - you need the Basic compiler part to turn this into a .HEX file (actually I think it goes to an .ASM file and then on to a .HEX file) - you could just ask someone to do it for you (lots of people on the forum have the tools).
Its function is slightly different to what I wrote:
- It uses different IO pins than the ones I used. (I just chose the pins so that input and output were on different sides of the chip - no particular reason here).
- the outputs toggle on a low to high transition of the input signal (rather than high to low for my version - I think you speced toggle on high to low)
- the two output signals don't change state at exactly the same time, so there will be a period of a few usec when they are both the same (my version writes the 'toggled' values to both pins at the same time)
- I think that it is possible for the two output signals to end up the same. It depends on how the 'Toggle' command works, but if it reads the port and then outputs the opposite of what it sees then under certain output loads the value read from the output pin may not be the same as the last value that was actually written and then the code will 'stuff up'.
Anyway, I will produce a 509 version of the code I wrote.
Tim
By the way: what exactly do you use this for? I must admit I don't really understand what this has to do with a rudder. Is there any more to the circuit other than the PIC - in other words should the PIC have more stuff programmed into it?
Dave Wulff
Nov 21, 2004, 12:58 PM
Bruce,
Hope you will keep us updated with this project, you have me curious. :)
I am an old "rudder only" guy.
Thanks,
Dave
brucej
Nov 21, 2004, 09:34 PM
dave
its an old idea with modern parts , trading in the old valves
brucej
MAVA
Nov 23, 2004, 03:49 PM
Are we talking Pulse Rudder Only?
Like the old Adams Actuators?
I got many actuators I would like to use with a modern receiver..
Martin
vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.