(you are viewing a thread; or go back to
list of threads)
registre à décalage (shift register) (by Jean-Pierre (France))
Bonjour,
Je m'excuse, je parle très mal anglais.
Peut on programmer un pic pour remplacer un registre à décalage comme un 4094 ou un 4021 ?
Merci
4094 programme (by MGP)
Bonjour Jean Pierre
Voici un programme pour contrôler un 4094.
Ce n'est pas tres rapide mais ca marche.
(no subject) (by MGP)
Désolé, j'ai téléchargé le fichier de test.
Voici le bon programme.
4094 (by Jean-Pierre (France))
Bonjour,
Merci beaucoup, je vais essayer.
A bientot.
(no subject) (by Sam)
Hi MGP, your example program is very useful. My question is how to control more than one 4094 ?
(no subject) (by MGP)
Hi Sam
Try to understand the program and create your own program, then you learn something.
Make an extra counter so that the strobe is set after X 4094's.
Change rung 17...
Good luck
(no subject) (by Sam)
As a beginner I don’t know how to start / where to start, I was trying last 15 days with no success. Thank you MGP for your kind advice.
(no subject) (by MGP)
I changed this programme for 2 * 4094 but I have not tested it, only simulated.
So feedback would be appreciated.
(no subject) (by Sam)
Thank you Sir, It's working.
(no subject) (by Joaquim)
Hi!
i am a newbie but i am studing to learn.
In this example:
http://cq.cx/ladder-forum.pl?action=attachment&id=3831 ,
what represents the value 170 in byte1 and byte2?
Can someone show some examples for this?
i have a circuit boar that uses 2 74hc4094 to lit leds only.
the first 4094 has 8 leds( all the outputs used), the second one has 2 leds ( only 2 outputs used)
i need to set to high, for example QP0 on the first 4094, what code ( byte1?) do i have to send?
i need to set to high, for example QP2 on the second 4094, what code ( byte2?) do i have to send?
i hope that someone can help me.
regards
joaquim
(no subject) (by Joaquim)
Hi MGP!
thanks for your fast reply.
the conversion i already figured it out, But still have a doubt...
With byte1 = 170 = 1010101010 what outputs of 4094 am i powering?
i looked at 74hc4094 datasheet and saw this: QP0 to QP7 4, 5, 6, 7, 14, 13, 12, 11 .....
is there a trueth table or something like it?
regards
joaquim
(no subject) (by MGP)
You have a board with 2x4094 why not try it?
A 4094 is a serial in to parallel out shift register.
What you shift serial in you get parallel out.
Outputs
QP7....QP0
10101010 (170)
10000000 (128)
00000001 (1)
00000010 (2)
Problem inTesting with avr (by Ahmad sakr)
To MGP
I tested the two programs (single and multi) with avr and 74hc595 shift register
And when I simulated the hex file generated from ldmicro v440 in protus the results as
Atmega 8 and Atmega 2560 works good
Atmega 328 and Atmega 16 nothing happened
Also I tried with Atmega 8 and compiled sketch to arduino, it works good
The wiring in all Atmega 8,16,328 and 2560 as
Y clock to pin 18
Y data to pin 17
Y strobe to pin 14
Another question please is possible to use the same program to make
Shifting in using 74hc164 shift register?
Thanks
(no subject) (by Ahmad sakr)
Sorry I compile sketch for arduino for Atmega 328 not for Atmega 8, as arduino uno and it gives good results when simulate the hex file generated from arduino ide v185.
(no subject) (by MGP)
Why not using the new instructions as SHL, SHR, ROL, setbit etc.. far more easy.
This is an old thread (2016) and Ihor made Ldmicro mature for this king of stuff.
(no subject) (by MGP)
King of stuff = sort of stuff
(no subject) (by Ahmad sakr)
To Ihor Nehrutsa
It may be a bug.
I followed MGP help and make a program using bitwise instructions in v442
In the attachment. But it gives the same as MGP's old program when simulate in
Proteus gives
For Atmega 2560 and Atmega 8 works good with hex file generated from ldmicro
For Atmega 328 and Atmega 16 not work with hex generated from ldmicro, it gives error watchdog timer expired in protus.
Another bug also, for the program which contains test bit instruction (test set bit) it can not do compile sketch for arduino as it gives error.
Best regards
Same results for shift in 74hc165 (by Ahmad sakr)
The same results for shift in, I write a program for 74hc165 and simulate in proteus Atmega 8 and 2560 works good
But Atmega 328 and 16 not work
Best regards
(no subject) (by MGP)
The clock input of a 74hc165 has an 'OSR' input, so you must give a clockpuls after you set the data output.
(no subject) (by Ahmad sakr)
To MGP
The shift in using 74hc165 program is in the attachment. I tested it in proteus, it works only with pull down resistor and does not work with pull up resistor.
I tested it only with avr as bellow
Works only with Atmega 8 and 2560
Not work with Atmega 328 and Atmega 16
Waiting your comments (pull up, down)
Thanks for you
(no subject) (by MGP)
I can't help you, I use only pic's and I never use Protheus.
(no subject) (by Ahmad sakr)
Thanks MGP
But what about simulation in ldmicro with pic instead of avr.
(no subject) (by MGP)
In (Ldmicro)simulation it works, but I think you should switch place rung 4 and 5 , first latch the inputs and then clock them out.
This is because LDmicro runs from top to bottom, so the latch is high before (µS) de clockpuls is high.
I dont have a 74HC165 and no time... have a paint job on the house ;-)
(no subject) (by Ihor Nehrutsa)
to Ahmad sakr
I think that
Atmega328 and Atmega16
has a bug in Proteus library.
I think
Proteus uses MCU frequency instead of the internal watchdog frequency.
(no subject) (by Ahmad sakr)
To Ihor Nehrutsa
The problem is still for shift in and shift out with Atmega 328 that, the hex file generated from ldmicro for both shift in and out not working.
For shift out after you fix test bit instructions (if set bit & if clr bit) with arduino , it works good with hex file generated from arduino ide by compiling sketch for arduino.
A new issue that there is a bug in insert set bit and insert clear bit instructions with arduino.
Thanks for your great work
Best regards
Post a reply to this comment:
|