Hello all, I'm a long-time lurker, but I can't seem to find an answer to this particular problem of mine in this treasure trove of a forum, so now I'm making my first post in hopes of getting set straight.
I've been trying to make a capacitive discharge spot welder for assembling battery packs. I wanted to challenge myself so I got working a capacitive touchwheel to vary the pulse time, and all the supporting code for a clean, fixed X-millisecond pulse.
I tested my code on my Uno, then uploaded the project over to a Teensy 4 that I've been given (to ensure pulse width accuracy with it's 600Mhz clock). All worked except the SevSegShift library, which I had hoped to use to display the selected pulse width, from 1-999 milliseconds (just because I have a 3-digit 7-segment display kicking around).
I began testing this code on both controllers in order to try and isolate problems:
/* SevSegShift Counter Example
Copyright 2017 Dean Reading,
Copyright 2020 Jens Breidenstein
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This example demonstrates a very simple use of the SevSeg library with a 4
digit display. It displays a counter that counts up, showing deci-seconds.
*/
#include "SevSegShift.h"
#define SHIFT_PIN_DS 13
#define SHIFT_PIN_STCP 12
#define SHIFT_PIN_SHCP 11
SevSegShift sevseg(SHIFT_PIN_DS, SHIFT_PIN_SHCP, SHIFT_PIN_STCP); //Instantiate a seven segment controller object
void setup() {
byte numDigits = 3;
byte digitPins[] = {8+2, 8+5, 8+6}; // of ShiftRegister(s) | 8+x (2nd Register)
byte segmentPins[] = {8+3, 8+7, 4, 6, 7, 8+4, 3,}; // of Shiftregister(s) | 8+x (2nd Register)
bool resistorsOnSegments = true; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_CATHODE; // See README.md for options
bool updateWithDelays = false; // Default 'false' is Recommended
bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
bool disableDecPoint = true; // Use 'true' if your decimal point doesn't exist or isn't connected
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
sevseg.setBrightness(90);
}
void loop() {
static unsigned long timer = millis();
static int deciSeconds = 0;
if (millis() - timer >= 100) {
timer += 100;
deciSeconds++; // 100 milliSeconds is equal to 1 deciSecond
if (deciSeconds == 1000) { // Reset to 0 after counting for 1000 seconds.
deciSeconds=0;
}
sevseg.setNumber(deciSeconds, 1);
}
sevseg.refreshDisplay(); // Must run repeatedly
}
/// END ///
My breadboarding for the Uno looks like this:
Now this works wonderfully with the Uno. When I set up the Teensy 4 with the same pin layout (with power going into the 5v pin, separated from USB) and identical code (with 25Mhz clock set in the IDE) I get signals out of all 3 pins as I would expect, but nothing meaningful out of the 74hc595 outputs.
Things I've tried:
Running the entire board and Teensy with 3.3v (power pins adjusted accordingly)
Running the entire board and Teensy with 5v (power going to Vin on Teensy)
Running the Teensy from 5v, and using the Teensy's 3.3v 250mah output pin to run the 74hc595's.
Updating Arduino IDE to 1.8.13, and reinstalling Teensyduino
I thank anyone who's reading this for their time! Please let me know if I've forgotten anything that's needed, of if I've committed a faux pas.