Go Down

Topic: Using Arduino to control 74HC595 not CD40110BE in cascade using SPI. (Read 2071 times) previous topic - next topic

CrossRoads

I had a sketch that used SCK at 8 MHz (used SPI clock divisor of 2, vs default of 4), and uploaded data to 45 shift registers at a 20 KHz rate (an update every 50uS).

16.66mS = 16,660uS.  Easily achievable I would think.
I used direct port manipulation for the SSpin low & highs; digitalWrite is way slower.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

marathonMAN1

#31
Sep 14, 2019, 03:33 am Last Edit: Sep 14, 2019, 03:45 am by marathonMAN1
CrossRoads;

That sounds great, one thing i am forgetting though is i miss calculated badly. i was suppose to have a round trip if the channels and i only accounted for a one way trip. i know, i know how ignorant of me making that bad of a mistake.

the channels are 46 in total total so up and back will be 92 plus two added for the ends on longer so i have to divide 16.666 ms per revolution by 94 up and back total.

so now i have 16.666 ms per rotation of the channels up and back to mimic a rotating brush at 3600 rpm. so that leaves me with each channel on for .177 mS  or 177 uS each.

i would love to see the sketch CrossRoads or at least part if their is any way possible. i need to study port manipulation badly, been reading all day long on the subject. i didn't realize that replacing a rotating brush would involve so much work but the end result will be fantastic.

Thank you so very much.

dougp

I ask out of ignorance - what is the pattern of output bits going to look like?  It's repeating I assume, but it'll go through some sequence?
Everything we call real is made of things that cannot be regarded as real.  If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet. - Niels Bohr

No private consultations undertaken!

marathonMAN1

Channels are overlapped with two always on at a time in Make Before Break.

Are you Doug Pine by the way.

pic is just for reference concerning the overlap only not the channels available.


PaulRB

#34
Sep 14, 2019, 08:28 am Last Edit: Sep 14, 2019, 08:55 am by PaulRB
In that case, in each 177us period, you would need to update 6x 74hc595 only once, to achieve make-before-break. So that's 48 bits in 177us. That's around 1 bit every 3us, a clock rate of ~333KHz.

With 8MHz clock you can send out data to the 6x '595 in as little as 6us. Of course, there will be overheads: preparing the data, latching the outputs.

Code-wise, I would suggest to use an unsigned long long, for simplicity and performance. These are 64 bits, so enough to hold your 46 bit pattern, which you can initialise to 0b11. You can easily shift the bits in either direction with << and >>. You also have to handle the "wrap-around" between bit 0 and bit 45. When sending out the data with SPI.trsnsfer(), you can cast the unsigned long long into a byte reference, to avoid the need for more shifting and masking to extract individual bytes. You can use micros() to perform the timing.

TomGeorge

#35
Sep 14, 2019, 10:50 am Last Edit: Sep 14, 2019, 11:12 am by TomGeorge
Hi,
Are the taps part of the two inductors, or a separate tapped inductor?

I'm not sure what will happen with DC, but I was involved long ago with a project involving switching auto-transformer (AC) tap with similar make-before-break.
The problem was circulating currents between the two connected taps, current being induced into them by the current in the rest of the winding.
The transformer was 10A, but the circulating currents we up to 10 times that amount.

With DC you will have switching transients, so I'm not sure what sort of circulating current you will get.
This current will flow through your tap switching components.


Quote
Channels are overlapped with two always on at a time in Make Before Break
No, you should have two ON at switch over, not ALL the time.

Like this.

Tap 1 ON.
then
Tap 2 ON
then
Tap 1 OFF
then
Tap 3 ON
then
Tap 2 OFF
then
Tap 4 ON
then
Tap 3 OFF.

I hope that makes sense.

Tom.... :)
PS. It will be interesting to see how the inductors interact with changing current and the CORE coupling them together to give a MUTUAL INDUCTANCE.
You are effectively making a transformer with pri winding magnetically and electrically connected to sec winding. :o
How are your inductors connected, START to START or START to FINISH terminals?
Everything runs on smoke, let the smoke out, it stops running....

dougp

Everything we call real is made of things that cannot be regarded as real.  If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet. - Niels Bohr

No private consultations undertaken!

marathonMAN1

#37
Sep 14, 2019, 05:56 pm Last Edit: Sep 14, 2019, 06:20 pm by marathonMAN1
PaulRB;
 
 Simply outstanding advice  :) and exactly what i need and i really do appreciate the explanation. the coding will be much more involved then shiftOut which is to bad as that is simple and i am not that experienced in coding. i also PaulRB was wondering will a Tensy 3.6 fit the bill for the timing as i have one on a Tall Dog break out board.????

TomGeorge;

no the Inductor is not two separate Inductors, it is one closed core inductor with the ends on either side connected to electromagnets. the moving taps are the action of a rotating positive brush converted to electronic switching. with the taps being positive it will cause two north face opposing fields at the brush or taps overlap that essentially separate the single Inductor to two separate inductors with current increase of one side and decrease current on the other in complete unison. it is essentially using inductive reactance to control current flow in two different feeds to the electromagnets 180 degrees out from each other which shift the opposing fields to one side then the other while maintaining field line pressure.

there is NO mutual inductance between them because of the opposing fields at the on taps that separate one inductor in to two halves.  their is also no secondary as i am controlling the current flow to two sets of electromagnets in repulsion. 
the pic below is the single layer Inductor that will control current flow of two feeds. it has less winding's then the real version as this is just for visuals to get the point across. the timing graph i posted is how the timing is going to be irregardless of word meaning and interpretations. two channels overlapping throughout the entire sweep except on the ends where they are on for three times longer then the ones in the middle. i posted a pic of the set up but i guess you pass that by.

again Thank you PaulRB, CrossRoads for your help many times over.



 

TomGeorge

Hi,
I did see the other diagram.
Is the mechanical version of  this in existence and does it work?

So your taps will be where the circumference of the circle is, or along a line through the axis of the inductor?

I sense an "overunity" machine design.

Tom... :)

Everything runs on smoke, let the smoke out, it stops running....

marathonMAN1

Yes it is an extension of the mechanical, yes, through the axis and yes, it works most beautifully. it is the most efficient way to control current on the planet. as for the rest, well, it is just an active inductor that controls two current feeds 180 degrees out.

all i am here is to get advice on the controller and software to control it converting it from mechanical to electronic control nothing more for which PaulRB and CrossRoads have helped immensely.
MM

marathonMAN1

#40
Sep 14, 2019, 11:38 pm Last Edit: Sep 16, 2019, 01:13 am by marathonMAN1
PaulRB;
  Is this what you are talking about unsigned long long and unsigned long long int and are they the same thing.?

TomGeorge

#41
Sep 15, 2019, 03:27 am Last Edit: Sep 15, 2019, 03:29 am by TomGeorge
all i am here is to get advice on the controller and software to control it converting it from mechanical to electronic control nothing more for which PaulRB and CrossRoads have helped immensely.
MM
Okay, but the mechanical brushes may be under going quite high currents and this will reflect in your solid state version.
I would suggest you use a high side driver for your IGBT or MOSFET switch.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

marathonMAN1

It actually is only an amp or two at most not what you are thinking and as for the IGBT or MosFet i have changed to a Logic NPN switching a higher power PNP.  because of the fact that with a driver for the IGBT or ModFet  the boot strap capacitor can not keep the transistor on for the amount of time i need for the overlap especially for the ends which are on three times longer. there is no way for it to recharge and will shut off.

PaulRB

#43
Sep 15, 2019, 11:30 am Last Edit: Sep 15, 2019, 11:31 am by PaulRB
PaulRB;
  Is this what you are talking about unsigned long long and unsigned long long int and are they the same thing
Yes and no.

Yes, unsigned long long is shorthand for unsigned long long int.

But the code you posted is not Arduino C, it's some C for desktop PC. There is no std::cout in Arduino C. In that code "<<" is a string concatenation operator and is also not part of Arduino C. The "<<" and ">>" operators I'm talking about are bit-wise shift left and shift right operators which act on integers and are available in Arduino C.

Before you post any more code, please read the forum guide in the sticky post so you know how to do it correctly.

marathonMAN1

Thanks i'll do that.

is there any code using long long, shift operators and other coding i can study as i have no experience in that depth of coding.
another thing is how will i get the channel overlap i need as per the pic i posed  where one channel is on while the previous channel goes low and the next channel goes high at the same time. this allows me to basically have two on at switching at all times.  if i can't do this i will have to pay someone to do it unfortunately even though i like to do things myself.

Thanks again.

Go Up