Jump to content

Recommended Posts

Posted

Hello everybody

I experience some odd going on's with a midi switcher idea i want to build directly in an old tube guitar amplifier.

The Design: I use a core + a improvised relay board based on the relay_example.pdf with the 74HC595 and the ULN2803. there are 8 relays and only one 74HC595 with one ULN2803 attached connected via a 5 pin cable to the core-pcb.

The good thins: Everything seems to work fine from the start. the lcd flashes up. MIOS could be programmed and i was able to compile c applications and upload them into the pic to be greeted with nice characters in the display.

The Problem: Beside i've got not very much knowledge about c the relays wont work the way they should. Using the code posted below i'm only able to get 2 relay-states.

State 1: 11111111

all 8 relays get powered

State 2: 10101010

every second relay gets powered

The very strange thing about this all is that it only depends on pin 0x07!!!

0x07 = 1 --> above State 1

0x07 = 0 --> above State 2

All other pins do nothing.

As example in this code with

evnt1=0x00 --> the relays are going in State 1

evnt1=0x01 --> the relays are going in State 2

-----------

void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam

{

  //**On MIDI Recieve**//

  //only work if Program Change is received on channel 1

  if( evnt0 == 0xc0) {

  //only work if Program Change 1,2 received

      if(evnt1 == 0x00) {

            //reset all pins

            MIOS_DOUT_PinSet(0x00, 0);

            MIOS_DOUT_PinSet(0x01, 0);

            MIOS_DOUT_PinSet(0x02, 0);

            MIOS_DOUT_PinSet(0x03, 0);

            MIOS_DOUT_PinSet(0x04, 0);

            MIOS_DOUT_PinSet(0x05, 0);

            MIOS_DOUT_PinSet(0x06, 0);

            MIOS_DOUT_PinSet(0x07, 1);

            //activate the recieved program change's pin to control the relay

            MIOS_DOUT_PinSet(evnt1, 1);

      }

      else if (evnt1 == 0x01)

      {

            MIOS_DOUT_PinSet(0x00, 1);

            MIOS_DOUT_PinSet(0x01, 1);

            MIOS_DOUT_PinSet(0x02, 1);

            MIOS_DOUT_PinSet(0x03, 1);

            MIOS_DOUT_PinSet(0x04, 1);

            MIOS_DOUT_PinSet(0x05, 1);

            MIOS_DOUT_PinSet(0x06, 1);

            MIOS_DOUT_PinSet(0x07, 0);

      }

  }

}

-----------

Is it still a hardware problem i cannot find? i've checked my wirings several times. Or am I doing something wrong in the c code? it looks like there is only a little piece missing...

thanks for any help or advice.

gunnar

Posted

I found the solution to the problem on my own.

Exchanging two wires (SCLK with RCLK) on the relay extension made the whole thing work. --> simply my fault ;-|

Sorry for disturbing and thanks a lot to the inventor + friends for this wonderful project!

greetz

gunnar :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...