Jump to content

DOUT not working, help please


GCoda

Recommended Posts

hi, i don`t know ASM so i decided use C

i get mios_base_v1_0b, get some exemples and compile this:

main.c PIC18f452-i/p

i am using inly core and dout, nothing else, maybe LCD neededor somthing else ?

 
#include <cmios.h>
#include <pic18fregs.h>

#include <cmios.h>
#include <pic18fregs.h>

#include "main.h"

app_flags_t app_flags;

unsigned char last_ain_pin;
unsigned char last_din_pin;
unsigned char last_dout_pin;

void Init(void) __wparam
{
  // set shift register update frequency
  MIOS_SRIO_UpdateFrqSet(1); // ms

  // Up to 4 DOUTX4 modules (=16 shift registers = 128 digital outputs) can be connected
  // set the maximum number here - it doesn't really hurt!
  MIOS_SRIO_NumberSet(4);
}

void Tick(void) __wparam
{
}

void Timer(void) __wparam
{
}

void DISPLAY_Init(void) __wparam
{
}
void DISPLAY_Tick(void) __wparam
{
}

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

  if( evnt0 == 0x80 || evnt0 == 0x90 ) {

    if( evnt0 == 0x80 || evnt2 == 0x00 ) {

      // Note Off
      MIOS_DOUT_PinSet(evnt1, 0);

    } else {

      // Note On
      MIOS_DOUT_PinSet(evnt1, 1);

    }
  }
}

void MPROC_NotifyFoundEvent(unsigned entry, unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam
{
}

void MPROC_NotifyTimeout(void) __wparam
{
}

void MPROC_NotifyReceivedByte(unsigned char byte) __wparam
{
}

void SR_Service_Prepare(void) __wparam
{
}

void SR_Service_Finish(void) __wparam
{
}


void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparam
{
}
void ENC_NotifyChange(unsigned char encoder, char incrementer) __wparam
{
}

void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam
{
}

and nothing working, only one led are lights 7th (doutx4)

where im wrong?

help please, sorry for bad english

Link to comment
Share on other sites

The LCD is not needed.

Does the test app (http://www.ucapps.de/mios/ain64_din128_dout128_v2b.zip) work, so you know your DOUT is working correctly?

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

  if( evnt0 == 0x80 || evnt0 == 0x90 ) {

    if( evnt0 == 0x80 || evnt2 == 0x00 ) {

      // Note Off
      MIOS_DOUT_PinSet(evnt1, 0);

    } else {

      // Note On
      MIOS_DOUT_PinSet(evnt1, 1);

    }
  }
[/code] That part looks kinda fishy. Try to always use () Try:
[code]
void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam
{

  if( (evnt0 == 0x80) || (evnt0 == 0x90) ) {
  // note on or note off

    if( (evnt0 == 0x80) || (evnt2 == 0x00) ) {
      // note off or volume == 0
      MIOS_DOUT_PinSet(evnt1, 0);
    } else {
      // Note On
      MIOS_DOUT_PinSet(evnt1, 1);
    }
  }

The code itself looks correct except for that tiny thing, so I'd assume the problem is in hardware or you don't send the right note events ;)

Link to comment
Share on other sites

Read the readme.txt or check the main.c for inforamtion on what the apps do and how to control it.

"Middle" MIDI Input pin does not need to be grounded and more precisely shouldn't be grounded. Using only 2 pins is correct.

Again: Do you _KNOW_ (and if so how?) that your core is fully working? Did you upload MIOS or an application? If so, how and were there any problems? Give us some information - that makes it a lot easier to help you...

Link to comment
Share on other sites

compiled, and uploaded with icprog

tryed 

int i,j;

  for(i=127, j=0 ; i!=j ; i--, j++) {

  MIOS_DOUT_PinSet(i, 1); //may be this not working

  MIOS_DOUT_PinSet1(j); //or this not working

  }

and this not working too... think thap i wrong in hardware... iam not very pro in this stuff.... biut buy a ready pcb in my coutry is a problem....

checking and checking hardware....

Link to comment
Share on other sites

Do you mean you compiled and then uploaded your own program with ICPROG and NOT MIOS Studio?

Do you actually have MIOS on the PIC? MIOS must be uploaded seperately. Once MIOS is on the PIC then you can use MIOS Studio and MIDI to upload your program, this will ensure that MIOS doesn't get overwritten by your program and is much easier.

You can tell if MIOS (or Bootloader) is operational by connecting a MIDI port to your PC and seeing if you receive a Sysex 'upload request' from the CORE.

Cheers

phil

Link to comment
Share on other sites

.... o_O

i downloaded mios_base_v1_0b goto apps\templates modify one and compile...

that is no mios inside 6kb hex file ?

i should upload compiled mios_v1_9f_src (mios_p18f452.hex) or somesing like that?

and after it upload that i compiled from mios_base_v1_0b?

can i do this with icprog without mios studio?

edit:

i need to upload mios_p18f452.hex than i need to use mios studio and try to upload my app...this is best and right way...?

i have no pc with midiIO at home... i ll buy one... and before this i ll try whit icprog

Link to comment
Share on other sites

Ahhhh That explains why it isn't working, you don't have MIOS on the PIC.

Yes you are quite right, you need to have MIOS (mios_p18f452.hex) on the PIC before you can load your app. I have never used icprog but you should be able to use it to load MIOS. I would then recommend using MIOS Studio to then load your app. You may be able to use icprog to load your app as well but you need to make sure it doesn't overwrite MIOS.

Cheers

Phil

Link to comment
Share on other sites

for sure...

i need upload just mios than in mios studio do other things

bootloader don't needed ??

or i need upload bootloader and than in studio upload mios and than in studio upload app

or is doesn't matter,as i read in "MIOS Bootstrap Loader for Newbies"

The communication protocol of both loaders is identical, accordingly the same tools can be used

thanks  for answering my stupid question...

...its all too difficult for me, i am badly understand English and electronic stuff...

Link to comment
Share on other sites

Gday GCoda,

or i need upload bootloader and than in studio upload mios and than in studio upload app

That's right, you should install the bootloader by using your burner. Once that is done, you can install MIOS using MIDI, and then you can install your application using MIDI.

Grab this zip file

Bootloader is in /mios_update_v1_9f/pic18f452/burner/

Burn that with your MBHP-Burner or JDM module.

After that, you can use MIOS Studio to upload the hex files, and you should not need to use the burner any more.

Can I ask what is your native language? Maybe we can find another midiboxer who can help in your native tongue... hopefully that would be easier for you.. The wiki can be confusing even if you prefer english ;)

Link to comment
Share on other sites

Can I ask what is your native language? Maybe we can find another midiboxer who can help in your native tongue... hopefully that would be easier for you.. The wiki can be confusing even if you prefer english

russian, but thanks, i now understand process and this time i do everything right i hope, only waiting for "midi to usb" for mios studio, i am using midi output from midi keyboard, and its not useful for mios studio i think...

Link to comment
Share on other sites

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...