Arduino 4035 4-bits shift register

Hi, I recently got some CD 4035 shift registers, i'm trying to get them working with my Arduino but i'm having no success. Here is my code for shifting a 1010 pattern but i don't get anything: i have wired some led to the output for debugging, they are going all low / all high after the TRUE_COMPLEMENT_PIN change state but other than that, no pattern !! Can someone help me ? thx

// GPIO Pin definitions
#define CLK_PIN 5       // Clock pin connected to CLK of CD4035B
#define J_PIN 9         // Serial J input connected to J of CD4035B
#define K_PIN 10        // Serial K input connected to K of CD4035B
#define PARALLEL_SERIAL_PIN 6  // Parallel/Serial Control
#define TRUE_COMPLEMENT_PIN 7  // True/Complement Control
#define RESET_PIN 8      // Reset pin for CD4035B (if used)

// Function to pulse the clock signal
void pulseClock() {
  digitalWrite(CLK_PIN, HIGH);  // Clock high
  delay(200);                   // Delay to give enough time for data to settle
  digitalWrite(CLK_PIN, LOW);   // Clock low
  delay(200);                   // Delay before next clock cycle
}

void setup() {
  // Set pins as outputs
  pinMode(CLK_PIN, OUTPUT);
  pinMode(J_PIN, OUTPUT);
  pinMode(K_PIN, OUTPUT);
  pinMode(PARALLEL_SERIAL_PIN, OUTPUT);
  pinMode(TRUE_COMPLEMENT_PIN, OUTPUT);
  pinMode(RESET_PIN, OUTPUT); // Setup reset pin

  // Initialize to low state
  digitalWrite(CLK_PIN, LOW);
  digitalWrite(J_PIN, LOW);
  digitalWrite(K_PIN, LOW);
  digitalWrite(PARALLEL_SERIAL_PIN, LOW);  // Serial mode
  digitalWrite(TRUE_COMPLEMENT_PIN, HIGH); // True output mode
  digitalWrite(RESET_PIN, HIGH);           // Ensure the reset is not active

  Serial.begin(9600);
  Serial.println("CD4035B Shift Register Test");
}

// Function to shift data into the register
void shiftSerialData(bool j, bool k) {
  // Write the serial data to J and K
  digitalWrite(J_PIN, j);  // Set J pin
  digitalWrite(K_PIN, k);  // Set K pin

  // Print data being shifted
  Serial.print("Shifting - J: ");
  Serial.print(j);
  Serial.print(" K: ");
  Serial.println(k);

  // Pulse the clock to shift the data into the first stage
  pulseClock();
}

void loop() {
  // Set to serial mode
  digitalWrite(PARALLEL_SERIAL_PIN, LOW);

  // Example: Shift a known pattern (1010) into the register
  shiftSerialData(HIGH, LOW);  // First stage: Set to 1 (J=1, K=0)
  delay(250);                 // Delay for observation
  shiftSerialData(LOW, HIGH);  // Second stage: Set to 0 (J=0, K=1)
  delay(250);
  shiftSerialData(HIGH, LOW);  // Third stage: Set to 1 (J=1, K=0)
  delay(250);
  shiftSerialData(LOW, HIGH);  // Fourth stage: Set to 0 (J=0, K=1)
  delay(1000);

  // Toggle true/complement mode
  digitalWrite(TRUE_COMPLEMENT_PIN, !digitalRead(TRUE_COMPLEMENT_PIN)); // Switch between true and complement mode
  Serial.println("Toggling True/Complement");
  delay(500);  // Wait 5 seconds to observe the result
}

Not the best choice. These are not very comparable with a 5V system.

Exactly what Arduino do you have?

Can you also supply a schematic of your circuit?

1 Like

Please, can you explain more, I didn't quite understand your observation.

This IC, (4053), is for levels from 3 to 15 V.
DC Supply Voltage (VDD) 3V to 15V
Ref: HTTP 301 This page has been moved

CD4053 timing chart.

image

I did not look at the datasheets. You need to look at the VOH and VOL of the processor (e.g. of the 328P) and VIH and VIL of the other side (CD4053).

Compare VOH with the minimum required VIH of the receiving end (CD 4053); the VOH needs to be higher than the minimum VIH. Similar for VOL, it needs to be lower than VIL.

1 Like

The CD series will work over a large voltage range, but that is not the only criteria. In order to mix the CD and 5V logic you have to look at the fan out figures along with rise and fall time.

1 Like

Hi, thx for your response, I have an arduino uno. These CD 4035 shift registers are the only ones I have for now, but is the datasheet it was specified a wide voltage range (CD 4035 datasheet). I don't have a schematic of the circuit but everything is connected as described in the comments when declaring the pin's variables. + I have wired some leds through 220omh resistor ( to each output pin and gnd)

So can I make it work with 5v ?

Sadly this is a comment we here all too often here.
How on earth can you make anything without a schematic? I wouldn't even attempt to do this and I have been building stuff since 1965.

Without a schematic you are. Cutting off your chance of help, because schematics are the universal language of electronics and word salad just doesn't cut it.

Please learn how to draw one, don't use software pen and paper is fine.

2 Likes

So basically you want us to read them for you. That is the first thing I look at unless I am familiar with the part. After reading the data sheet I know what the part will do, not what I think and yes many times there are differences but the data sheet always wins. There is no reason the part should not work unless it was damaged. @ruilviana gave you the timing diagram is this what you are doing?

@gilshultz, please pay attention who you are replying to.

The OP was not the one who asked the question or stated the above.

I had no need to read the datasheet; I only gave a basic answer to @ruilviana's question.

1 Like

As a lazy guy, I created this Wokwi simulation to discover RST stays HIGH ! It should be set LOW early in the process.

Ok i will try that

So yes i read the datasheet multiple times before posting here, as for the timing, I think I'm doing it right, you can look in the code, but perhaps it's because timing is changing based on operating voltage

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.