Shift Register

Moderator: Benj

Post Reply
donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Shift Register

Post by donald »

Hello everybody,
Can someone help me to create a flowchart for 16F628, after a schematic logic integrated circuits?
The 8 switches shall select 1 or 0 logic and represents a code (10100110). This code is to be created
in the program with the ability to be changed. Microcontroller uses an input and two outputs:
Output clock, output and input data.
Attachments
layout.gif
layout.gif (13.4 KiB) Viewed 9566 times

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: Shift Register

Post by donald »

No one can help me? :?

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Shift Register

Post by JonnyW »

Hi Donald.

I can help you build a byte given separate inputs but I am not sure exactly what it is you are asking for. What is the goal of your flowchart - to read in the switch values and output the result to something?

If you clarify step by step what your program is required to do then I'm sure someone will be able to help with the different aspects of it.

Cheers,

Jonny

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: Shift Register

Post by donald »

Hi Jonny,
Well inlet circuit "input data" is connected to track 3 CD4014, and "clock out" is used to clock, track 10 CD4014.
His entrances parallel CD4014 are connected to the + or - and must be identical to the 8 switches created in the
program for microcontroller.If the code is the same as the 8 switches,CD4066 will be opened. Logical switches
the CD4066 and the other 8 selection switches must be creeate on in the program. Microcontroller generates the
signal clock and receives the signal data of the CD4014 and on a port on the microcontroller to an led lights up if
the code of the CD4014 is identical to the rest of microcontroller. If I don't have been understood, please ask me,
I'll endeavor to explain.

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: Shift Register

Post by donald »

Hi,
I want 16F628 to work in the programmed logic, exactly what I do all the circuits integrated into wired logic (See diagram).
Notice that at the exit of IC2d (4066) I have logic 1 (all 8 switches 4066 are open), the inputs gates IC3 and IC4 are placed 8
logical indicator and shows the code 10100110, from left to right. This code is to be moved from 4014 in 4015 to each signal
clock on the "descendant", I'm sorry for the mistake, the movement of the data takes place on the
ascendant of the clock.
Last edited by donald on Sat Jun 16, 2012 6:34 am, edited 3 times in total.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Shift Register

Post by Benj »

Hello Donald,

This should be fairly simple to do.

You would just need to use basic I/O in single pin mode control the clock and the reading of the signals.

If you do this inside a loop shifting the bits along in a byte then the program should be fairly small.

Why not have a go at the Flowcode code and then post up your program if you get stuck and we can maybe help to point out where your going wrong.

This way next time you need to create a program you should have a better idea about how to get started and implement it.

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: Shift Register

Post by donald »

Hi Benj,
Well this is what I am trying to create a flowchart, but I'm not comes out of it.

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: Shift Register

Post by donald »

Hi,
I have tried many variations, but doesn't work, I do not have a idea how to do it.
I believe that it is simple to created the program, it is possible to use a complicated
algorithm of functioning.
http://www.youtube.com/watch?v=nVqvtDxZ ... e=youtu.be

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Shift Register

Post by JonnyW »

Hi Donald. As Ben says, if you post your program so far then I'm sure someone can take a look. Sometimes it just helps those answering posts to have something to work with, even if it doesn't work. There may just be errors in the software logic and fixing those may cause your program to work.

Jonny

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: Shift Register

Post by Spanish_dude »

Hi,

From what I saw in your video, the output (at IC2d) goes on only if the value of the shift registers (IC12a & IC6a) are the same as the input value of the 4014 IC set with the switches.
I don't really see the purpose of this circuit. If you just want to enable an output when a certain value is set with switches, you can do that with AND and NOT gates.
Or maybe you want to compare a value with another and then enable an output ?

It's a bit confusing.

Cheers,

Nicolas

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: Shift Register

Post by donald »

Hi,
From what I saw in your video, the output (at IC2d) goes on only if the value of the shift registers (IC12a & IC6a)
are the same as the input value of the 4014 IC set with the switches.
Is correct.
I don't really see the purpose of this circuit. If you just want to enable an output when a certain value is set with
switches, you can do that with AND and NOT gates.
Sure it can be done with logic gates, but more elegant it is as I designed layout seen in video.
Or maybe you want to compare a value with another and then enable an output ?
It's a bit confusing.
Practically is a key digital, it can use more key by 4014 to a single the lock of the door.

For JonnyW, I have to go back to flowchart, but these days I've had lot of work, thank you.

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: Shift Register

Post by Spanish_dude »

Could this be what you're trying to do : http://www.matrixmultimedia.com/mmforum ... 26&t=10565 ?

Nicolas

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: Shift Register

Post by donald »

Hi Nicolas,
"LCD Four Digit Door Lock" created by Martin "medelec35" is an exceptional achievement, it surpasses itself.
I imagined and realized this digital logic key (with 4014) in the digital logic wired with logical integrated circuits
and now I'm thinking that may be programmed logic with microcontroller.

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: Shift Register

Post by donald »

Hello everybody,
What do you think?
Will work with the 4014?
All the best!
Attachments
Shift Register 1.fcf
(18.69 KiB) Downloaded 209 times

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: Shift Register

Post by donald »

Hi everybody,
I don't know if we have approached correctly this flowchart, I can't do a simulation if it works.

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Shift Register

Post by JonnyW »

Hi Donald. I have had a quick look at your flowchart.

I notice a couple of bits.

You have a loop in Enter_Level that does:

Code: Select all

loop
  wire = oo_read_device(read)
until read == 255
The only value being updated here is 'wire' so unless 'read' is 255 on entry to the loop this will loop for ever.

There is a similar issue in Enter_Level:

Code: Select all

Loop
  wire=oo_read_device(read)
Until Level = 255
Again, this will either do the operation once (if Level is 255) or for ever.

Also in Enter_Level you have the code:

Code: Select all

read = read - 48
If  (read = 250) || (digcount > 7) ?
For 'read == 250' then its initial value must have been 0x2A (ascii '*') is this right?

For the calculation:

Code: Select all

Result = degcalc[0]*10000000+degcalc[1]*1000000+degcalc[2]*100000+degcalc[3]*10000+degcalc[4]*1000+degcalc[5]*100+degcalc[6]*10+degcalc[7]
Remember 'Result' is an integer - a 16 bit value with a max limit of 32767. Any value multiplied by 10000000 will overflow this. You might want to change this to a 'long' type (max value 2 billion or so).

You also have the line at the start of Main:

Code: Select all

Level = 10110010
This could be a decimal or binary. As its 8 digits I'm assuming binary - you need to tell the compiler this - change the value to 0b10110010 to interpret the number as binary. Hex values start with 0x, binary with 0b, octal with 0 and decimal any number from 1 to 9.

My advice is to go through your icons and change the description of them to comment your code. It is easier to follow this way and a good habit to get into. It may help identify your intent and therefore help identify bugs.

Cheers,

Jonny

Post Reply