Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - registre à décalage (shift register)

(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
Mon Jan 30 2012, 06:30:07
4094 programme (by MGP)
Bonjour Jean Pierre

Voici un programme pour contrôler un 4094.
Ce n'est pas tres rapide mais ca marche.
Tue Jan 31 2012, 12:57:16, download attachment 4094_test.ld
(no subject) (by MGP)
Désolé, j'ai téléchargé le fichier de test.
Voici le bon programme.
Tue Jan 31 2012, 13:11:10, download attachment 4094_shift.ld
4094 (by Jean-Pierre (France))
Bonjour,

Merci beaucoup, je vais essayer.

A bientot.
Wed Feb 1 2012, 05:03:51
(no subject) (by Sam)
Hi MGP, your example program is very useful. My question is how to control more than one 4094 ?
Sat Mar 22 2014, 11:09:58
(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
Sat Mar 22 2014, 15:08:44
(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.
Sun Mar 23 2014, 12:15:16
(no subject) (by MGP)
I changed this programme for 2 * 4094 but I have not tested it, only simulated.
So feedback would be appreciated.
Sun Mar 23 2014, 15:07:50, download attachment 4094_multiple.ld
(no subject) (by Sam)
Thank you Sir, It's working.
Mon Mar 24 2014, 00:29:51
(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
Sun Feb 7 2016, 16:59:36
(no subject) (by MGP)
Use a binary to decimal converter like this:
https://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html

byte1 = 170 = 1010101010
byte2 = 170 = 1010101010

Replace byte1 and byte2 with the calculeted values (decimal).
Mon Feb 8 2016, 04:08:50
(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
Mon Feb 8 2016, 15:49:02, download attachment 74HC_HCT4094.pdf
(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)
Tue Feb 9 2016, 05:12:46
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
Mon Jun 25 2018, 15:00:37
(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.
Mon Jun 25 2018, 15:07:41
(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.
Tue Jun 26 2018, 02:15:08
(no subject) (by MGP)
King of stuff = sort of stuff
Tue Jun 26 2018, 02:55:42
(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
Mon Jul 2 2018, 15:15:51, download attachment shift.rar
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
Tue Jul 3 2018, 21:10:29
(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.
Wed Jul 4 2018, 03:08:14
(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
Thu Jul 5 2018, 03:45:30, download attachment shift in-1.rar
(no subject) (by MGP)
I can't help you, I use only pic's and I never use Protheus.
Thu Jul 5 2018, 07:39:49
(no subject) (by Ahmad sakr)
Thanks MGP
But what about simulation in ldmicro with pic instead of avr.
Thu Jul 5 2018, 07:50:14
(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 ;-)
Thu Jul 5 2018, 10:09:53
(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.
Tue Jul 10 2018, 10:50:17
(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
Tue Jul 10 2018, 13:19:26
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):