Power control for ultrasonic generator

Hi, new user here :slight_smile:

I am currently working with a West-Bond K-1400 ultrasonic generator. As you can see it has an 8-bit computer interface which can be used to control the amplitude of the generated electric signal. According to the manual:

Binary 8-Bit TTL input from the bonder controls the output power level. Front panel settings are
ignored and no channel selection signal is needed when these inputs are used. The ultrasonic generator
is active whenever any bit is nonzero. Therefore, the bonder controls bond time directly, by the timing of
the numeric changes at these pins.

So I connected the arduino with the 8 data pins and wrote the following piece of code:

int busStart = 22;
//writes the binary equivalent of the number to the 8-bit bus
void setPowerValue(unsigned char value){
  unsigned char mask = 1;
  for (int i = 0; i < 8; i++) {
    int bitValue = (value & (mask << i)) != 0;
      digitalWrite(busStart + 2 * i, LOW);
      digitalWrite(busStart + 2 * i, HIGH);

Note: it reads in the maual that the data pins are internally grounded with pull-down resistos, but apparently my model had inverted input and pull-up resistors instead

So this code worked fine when doing small transitions, but when going from 0 straight to 255, it didn’t work at all.
After many hours of experimentation, I finally got it to work by adding a 2ms delay between each digitalWrite, writing only one bit at a time. This, however, meant that sending a signal takes 16ms, which is far too much for my intended purposes.

Any ideas of how to proceed with this, or what could be the cause of my problem?

The ultrasonic generator is active whenever any bit is nonzero.

It looks like the generator's controller is sampling the bits periodically. You probably need to change all the bits "at once".

Look at: http://www.arduino.cc/en/Reference/PortManipulation

Another possibility is to use some other chip in between, to get the same effect. Like an HC373 or a shift register like HC595.

Some chip info on the ArduinoInfo WIKI here - http://arduinoinfo.info http://arduino-info.wikispaces.com/Popular-ICs

Hi, thanks for the hints :) Unfortunately pin 9 on the old arduino mega board I'm using is broken, so I cannot use the B port. Edit: sry I mixed up the pin layout. Pin 15 is broken, Port B only has 6 pins and Port D has pins that shouldn't be set to output, so I guess my best bet is using the pins 22 and higher? I found this image, does that mean that port A consists of pins 22 to 29?

Got the code working using port manipulation and it’s quite a bit shorter than the previous implementation, but the problem still persists.
Whenever I raise the power value too fast, it doesn’t work (the device simply doesn’t produce a signal at all)

void setPowerValue(unsigned char value){
  PORTA = ~value;
  previousValue = value;

I’m afraid this problem isn’t really Arduino-related, but if anyone has any ideas, please let me know.