Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

CD4017 Counter with 10 Decoded Outputs

4 posters

Go to page : 1, 2  Next

Go down  Message [Page 1 of 2]

1CD4017 Counter with 10 Decoded Outputs Empty CD4017 Counter with 10 Decoded Outputs Tue Nov 29, 2022 12:53 pm

KerimF

KerimF

Many CD4000’s logic ICs were modeled already, and this needed a great effort.

Unfortunately, the one, I chose for my new product (for being available in quantity), is CD4017.

I actually need its first 4 outputs only. And perhaps there exists on the actual list an IC which could replace it but likely with some modifications in the controlling signals.

Defran

Defran

Well, if you need 4 outputs use 4 outputs, where is the problem?
To have differents bodies for 4,5,6... outputs is impossible and unnecesary. However, you can create your own subcircuits, here we do it several of them. You have many tutorials on this website and on Youtube. Courage, it is very very easy. If you need some kind of extra help comment it in this same post.

KerimF

KerimF

Defran wrote:Well, if you need 4 outputs use 4 outputs, where is the problem?
To have differents bodies for 4,5,6... outputs is impossible and unnecesary. However, you can create your own subcircuits, here we do it several of them. You have many tutorials on this website and on Youtube. Courage, it is very very easy. If you need some kind of extra help comment it in this same post.

I agree with you.
It will become easy when I will have time to be familiar with most of the available functions which could be used in the script.

For instance, when I said I need just the first 4 outputs, I meant that in case CD4017 could be replaced by another available logic IC, the latter could have just 4 outputs (not necessarily 8 or 10).

About creating subcircuits, I recall when I used thinking that writing MCU code in assembly language is much easier than doing it in C because I do it (writing in assembly only) since more than 40 years ago (Z80, C51, then AVR).

By the way, creating subcircuits in LTspice, for example, is totally different from doing it in SimulIDE. Naturally, SimulIDE has its own language (its own objects and functions, to name a few) which is based on a certain compiler (likely Qt) which in turn has also its own language.

So, to me in the least, I have to learn a new programming language which is far from the assembly one.
For example, our friend 'Arcachofo' gave me the following hint:
Code:
   inputPin.setPinMode( 1 ); // Input
   outputPin.setPinMode( 3 );  // Output

I couldn't let my 'brain' not to ask the meaning of ( 2 )  Laughing
I told him it could be a floating pin or bi-directional one. So, I asked him to be patient  Rolling Eyes

Cheers,

arcachofo

arcachofo

@KerimF
There are 2 ways to create components:

- Subcircuits: https://www.simulide.com/p/new-subcircuits.html
No programming at all, just create a circuit an "embed" it in a package.
Something equivalent to an IC.
74, CD and other ICs are created this way.

- Scripted: this is a new way introduced recently.
This is the one discussed for the VCO.

Naturally, SimulIDE has its own language (its own objects and functions, to name a few) which is based on a certain compiler (likely Qt) which in turn has also its own language.
You don't need to learn Qt or any of the internals of simulide.

Script language for scipted component is based on C++, but to start to do things you don't need to learn the language.
just by copy/pasting and changing a few thing you can do many things.

Most things are obvious to understand, anyone can understand this:
inputPin.setPinMode( 1 ); // Input
outputPin.setPinMode( 3 ); // Output

And anyone who at least read would notice the first line in that script and probably infer what is (2):
// PinModes: undef_mode=0, input, openCo, output, source
In any case right now you don't need to know what is (2).

To do the steps in that post (VCO) takes aproximately 2 minutes: just copy/paste 3 files, rename then and copy/paste the text provided into the files.
So in 2 minutes you could have a basic component to play with.
Then I would add a few more lines of code and you could have the VCO working with an extra 2 minutes of copy/pasting.

And this, plus the explanations provided is more than enough to create many more components.
Of course it requires some effort, I did my part... now it is your choice to try or not.

KerimF

KerimF

arcachofo wrote:@KerimF
There are 2 ways to create components:

- Subcircuits: https://www.simulide.com/p/new-subcircuits.html
No programming at all, just create a circuit an "embed" it in a package.
Something equivalent to an IC.
74, CD and other ICs are created this way.

I had the impression that all components in SimulIDE have to be scripted, sorry  Embarassed

- Scripted: this is a new way introduced recently.

Then I would add a few more lines of code and you could have the VCO working with an extra 2 minutes of copy/pasting.

I didn't imagine that you will kindly do also this second step  Rolling Eyes

Now, I have no excuses not to do the first step.


Off topic:
By curiosity, I tested, a few days ago by using SimulIDE_1.0.1-R1386_Win32, a somehow complex code (written in assembly for ATmega8). The simulation worked well as expected.
Then, I tested the same code (with its circuit) by using SimulIDE-R1408_Win32 (and its accompanied files as usual). I got some unexpected responses and traces. I simply assumed that a version of a trunk branch likely needs another environment... right?

arcachofo

arcachofo

Learning to use a tool like a circuit simulator takes some time.
And this simulator is under active development, so it changes continuously making it more confusing.


By curiosity, I tested, a few days ago by using SimulIDE_1.0.1-R1386_Win32, a somehow complex code (written in assembly for ATmega8). The simulation worked well as expected.
Then, I tested the same code (with its circuit) by using SimulIDE-R1408_Win32 (and its accompanied files as usual). I got some unexpected responses and traces. I simply assumed that a version of a trunk branch likely needs another environment... right?
In theory it should work the same.
Maybe you should open a discussion explaining what is exactly the problem.

In any case you should use the files as you download it, you should not just change the executable or something like that.

KerimF

KerimF

arcachofo wrote:
In theory it should work the same.
Maybe you should open a discussion explaining what is exactly the problem.

In this case, I will have a closer look of what seems strange in future tests, with the hope it can be repeated.

In any case you should use the files as you download it, you should not just change the executable or something like that.

I usually use, as you said, all the files that are downloaded with the executable. They are in two folders, data and examples.
Naturally, I also create a folder (or more) to include what may be related to my tests.

arcachofo

arcachofo

I usually use, as you said, all the files that are downloaded with the executable. They are in two folders, data and examples.
Naturally, I also create a folder (or more) to include what may be related to my tests.
Nice.
In some cases some users just replace the executable with a newer version and this can cause problems (but not always) and after long discussions we found this was the problem.
So just in case I mentioned it.

KerimF

KerimF

arcachofo wrote:In theory it should work the same.
Maybe you should open a discussion explaining what is exactly the problem.

I noticed that the bug is an old one.

In my old tests, the ADC Prescaler was 1/64. Since, in the free running mode, reading a sample takes 13 ADC clocks, the period is 13*64=832 MCU cycles.

In my new test (not uploaded), the ADC Prescaler is 1/32. So, in this case, reading a sample takes 416 cycles instead of 832.

I noticed that SimulIDE-R1408_Win32 shows 416 cycles for the 1st reading, but it becomes 464 cycles for all subsequent readings.
SimulIDE_1.0.1-R1386_Win32 shows 416 cycles always.

ATmega8, ADC Prescaler Select Bits
000 1/2
001 1/2
010 1/4
011 1/8
100 1/16
101 1/32
110 1/64
111 1/128

10CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Wed Nov 30, 2022 4:57 pm

KerimF

KerimF

Back to CD4017, I built it as a subcircuit on LTspice first.

So, I was able to use the following 4 basic logic elements:

[1] NOT gate
[2] 2-input AND gate
[3] 2-input NOR gate
[4] D-type flip-flop

I will attach the screenshot (png) of this subcircuit when I will know how the attachment of an image could be done.

Added:
Since the size is < 49K , I attached it as a zip file
Attachments
CD4017 Counter with 10 Decoded Outputs AttachmentCD4017_01-asc2.zip
You don't have permission to download attachments.
(32 Kb) Downloaded 4 times

11CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Wed Nov 30, 2022 6:42 pm

arcachofo

arcachofo

Back to CD4017, I built it as a subcircuit on LTspice first.
You need to:
- Create that circuit in simulide (use tunnels).
- Create a package.
- Add the new component to an existing list or create your own list.

Have a look here:
https://www.simulide.com/p/new-subcircuits.html

EDIT:
I will have a look at ADC timings.

12CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Wed Nov 30, 2022 7:32 pm

KerimF

KerimF

arcachofo wrote:
Back to CD4017, I built it as a subcircuit on LTspice first.
- Create that circuit in simulide (use tunnels).

Have a look here:
https://www.simulide.com/p/new-subcircuits.html

In LTspice, the 4 logic elements were modeled to be used as 'an abstract single component', not in an existing IC. Is this the case here too?
I didn't have the impression it is, after reading 'new-subcircuits.html'.
It seems to me that I have to find out how to build these 4 logic elements first before connecting them to form a subcircuit.

13CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Wed Nov 30, 2022 9:03 pm

arcachofo

arcachofo

It seems to me that I have to find out how to build these 4 logic elements first before connecting them to form a subcircuit.
You don't need to build them, just take gates and flip-flops or whatever from the component list.

14CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Wed Nov 30, 2022 9:43 pm

KerimF

KerimF

arcachofo wrote:
It seems to me that I have to find out how to build these 4 logic elements first before connecting them to form a subcircuit.
You don't need to build them, just take gates and flip-flops or whatever from the component list.

I don't know why I can't see the obvious till I hear you it exists Embarassed
Thank you for being patient, besides your wonderful work in updating SimulIDE and continuous care.

15CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 1:40 am

KerimF

KerimF

I attached the subcircuit of CD4017, CD4017.zip, because I couldn’t go further.

After opening a package, adding its 16 pins with their label/Id and saving it, I found out that all defined pins were not saved! This explains why I couldn’t edit a pin (as explained). This applies on both versions below:

SimulIDE_1.0.1-R1386_Win32 and SimulIDE-R1408_Win32

But I may have missed something, as usual Smile

A side note:
At exit (closing the program), pressing ‘Cancel’ acts exactly as pressing ‘Discard’. Usually, pressing ‘Cancel’ or ‘X at the up-right corner’ means returning to program (opposite of exit).
Attachments
CD4017 Counter with 10 Decoded Outputs AttachmentCD4017.zip
You don't have permission to download attachments.
(3 Kb) Downloaded 1 times

16CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 1:49 am

KerimF

KerimF

Here is also the picture of CD4017 subcircuit.
CD4017 Counter with 10 Decoded Outputs Cd401710

17CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 6:18 am

Alex68

Alex68

Счетчик с внутренним дешифратором 74НС4017. Обратной связью устанавливается нужный коэфф. деления :CD4017 Counter with 10 Decoded Outputs 2022-615

https://disk.yandex.ru/d/PsuJ4mNih3UDoQCD4017 Counter with 10 Decoded Outputs 2022-616CD4017 Counter with 10 Decoded Outputs 2022-617

18CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 8:05 am

Alex68

Alex68

CD4017 Counter with 10 Decoded Outputs 2022-618
CD4017 Counter with 10 Decoded Outputs 2022-619
CD4017 Counter with 10 Decoded Outputs 2022-620

19CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 9:19 am

Alex68

Alex68

KerimF wrote:Many CD4000’s logic ICs were modeled already, and this needed a great effort.

Unfortunately, the one, I chose for my new product (for being available in quantity), is CD4017.

I actually need its first 4 outputs only. And perhaps there exists on the actual list an IC which could replace it but likely with some modifications in the controlling signals.

Вот вам пример счетчика на 4 выхода. Одиночными четырьмя импульсами выходы переключаются. Пятый импульс сбрасывает на первый выход.CD4017 Counter with 10 Decoded Outputs 2022-621
CD4017 Counter with 10 Decoded Outputs 2022-622
CD4017 Counter with 10 Decoded Outputs 2022-623

20CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 10:08 am

KerimF

KerimF

Thank you, Alex, for let me know that there is an alias IC of CD4017 on the actual SimulIDE list of the 74HC00 family.

21CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 10:21 am

KerimF

KerimF

KerimF wrote:
A side note:
At exit (closing the program), pressing ‘Cancel’ acts exactly as pressing ‘Discard’. Usually, pressing ‘Cancel’ or ‘X at the up-right corner’ means returning to program (opposite of exit).

Today, I re-tried this by a simple test. This time 'Save', 'Discard' and 'Cancel' worked as expected!

22CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 6:46 pm

arcachofo

arcachofo

After opening a package, adding its 16 pins with their label/Id and saving it, I found out that all defined pins were not saved! This explains why I couldn’t edit a pin (as explained). This applies on both versions below:

SimulIDE_1.0.1-R1386_Win32 and SimulIDE-R1408_Win32
Yes there is a bug introduced in last changes in SimulIDE-R1408 (Solved at Rev 1420) but 1,0,1 should work ok.

At exit (closing the program), pressing ‘Cancel’ acts exactly as pressing ‘Discard’. Usually, pressing ‘Cancel’ or ‘X at the up-right corner’ means returning to program (opposite of exit).
Not sure if you already know, but just in case:
To save a package you must right-click on it and select "Save package".
Saving the circuit will not save the package.

If you create a package and close the circuit you will get 2 dialogs: one to save the package and another to save the circuit, depending on what is already saved or not.

23CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 7:45 pm

KerimF

KerimF

arcachofo wrote:
After opening a package, adding its 16 pins with their label/Id and saving it, I found out that all defined pins were not saved! This explains why I couldn’t edit a pin (as explained). This applies on both versions below:

SimulIDE_1.0.1-R1386_Win32 and SimulIDE-R1408_Win32
Yes there is a bug introduced in last changes in SimulIDE-R1408 (Solved at Rev 1420) but 1,0,1 should work ok.

At exit (closing the program), pressing ‘Cancel’ acts exactly as pressing ‘Discard’. Usually, pressing ‘Cancel’ or ‘X at the up-right corner’ means returning to program (opposite of exit).
Not sure if you already know, but just in case:
To save a package you must right-click on it and select "Save package".
Saving the circuit will not save the package.

If you create a package and close the circuit you will get 2 dialogs: one to save the package and another to save the circuit, depending on what is already saved or not.

Thank you.

24CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 10:00 pm

KerimF

KerimF

SORRY, I thought I posted below on the thread "Equivalent to CD4046 Phase Locked Loop"  Embarassed
========================================================

SimulIDE-R1408_Win32

I updated vco_core.as, as you suggested. When I added VCO, I got:

Initializing VCO-1
VCO-1 Initialized: 0 MHz

script line: 27 1 INFO Compiling void voltChanged()
script line: 31 12 WARNING Float value truncated in implicit conversion to integer
VCO init

Then, when I run it a crash happened (it can be repeated).

CD4017 Counter with 10 Decoded Outputs Vco_0210
Attachments
CD4017 Counter with 10 Decoded Outputs AttachmentVCO_02.zip
You don't have permission to download attachments.
(2 Kb) Downloaded 4 times

25CD4017 Counter with 10 Decoded Outputs Empty Re: CD4017 Counter with 10 Decoded Outputs Thu Dec 01, 2022 11:59 pm

arcachofo

arcachofo

Then, when I run it a crash happened (it can be repeated).
It is working for me.
Probably a Windows specific issue. I will have a look.
EDIT: it is a Windows32 specific issue, working ok in Windows64.

CD4017 Counter with 10 Decoded Outputs Vco10

Sponsored content



Back to top  Message [Page 1 of 2]

Go to page : 1, 2  Next

Permissions in this forum:
You cannot reply to topics in this forum