PIC12F675 microcontroller as Flip Flop
Code to make a 12F675 operate as a D-type or JK-type flip flop
Since I implemented a D type flip flop using the PIC Logic Elements I thought I might go the other way and implement an entire D type flip flop in a single PIC. This uses the edge triggered and port change status interrupts and was an opportunity to have a play with interrupts on the PIC.
As written this code will cause a PIC to function as a negative edge triggered D type flip flop with active low Set and Reset inputs.
‘D’ type flip flop
Following the D type flip flop I’ve hacked it round to make a JK flip flop. This implementation has one extra ‘feature’ that a normal discrete logic device doesn’t have. After a reset, port GPIO5 (pin 2) is read and the logic level used to select either a positive or negative clock edge.
GPIO5 = 1, negative edge (GPIO5 uses weak pull-up, so no external resistor is needed)
GPIO5 = 0, positive edge
For more detail: PIC12F675 microcontroller as Flip Flop
For All Your PCB Need, One-stop PCB Solution Services Appear:
EasyEDA: free PCB design tool, 200,000+ engineers are using
PCBs: 10pcs 2-layer 10x10cm only $8.21, on-time global shipping
Components: save 50% on cost, save on freight if shipped with ordered PCBs
Current Project / Post can also be found using:
- fli flop con pic
- flip flop circuit pic
- microcontroller as filp flop
- pic12f675 edge