Jump to content

Probleme beim Upload meiner anwendung in C


consi_hh
 Share

Recommended Posts

Hallo,  hab mir gedacht ich änder an meiner Programmierung der Midibox was.  Nun hab ich folgendes Problem:

Ich habe den Code in C geändert, habe ihn compiliert.  Jetzt wollte ich ihn auf meine MB uploaden.

Ich habe es über miosstudio / hex als auch über midi-ox / syx probiert. 

Es wird fleißig gesendet,  übertragung erfolgreich gemeldet, allerdings funktioniert die MB weiter ohne änderun wie vorher.

Hab ich was vergessen?  woran könnte es liegen?

Link to comment
Share on other sites

Hab die anwendung ain64_din128_dout128 drauf und sie etwas modifiziert.  Das Problem ist das ich sie garnichrt auf meine midibox aufgespielt bekomme, also auch wenn ich mir die "originale" anwendung runterlade und sie auf die MB überspielen will  sich nix tut, und die prorammierung der buttons und led´s genau so ist wie bei meiner veränderten version.

Link to comment
Share on other sites

Ok ich versuchs mal zu erklären. 

Ich hab meine Anwendung geändert ud neu kompiliert, auch ohne probleme, dann hab ich die .syx datei mit midi-ox hochgeladen, dies hat auch ohne fehlermeldung geklappt, allerdings hatte ich auf meiner MB keinerlei veränderungen zu vorher. Anschließend hab ich die .hex datei mit miosstudio hochgeladen, auch ohne Fehlermeldungen jedoch auch wieder ohne auswirkungen auf die MB.

Um zu seheh ob es überhaupt klappt hab ich die originale ain64_din128_dout128 anwendung hochgeladen, auch wieder ohne auswirkungen auf die MB.

Was mich nur wundert ist das beim upload, sei es über midi-ox oder miosstudio keine fehlermeldung kam.

Hier noch der code den ich hochladen wollte:

/////////////////////////////////////////////////////////////////////////////
// Include files
/////////////////////////////////////////////////////////////////////////////

#include "cmios.h"
#include "pic18f452.h"

#include "main.h"

/////////////////////////////////////////////////////////////////////////////
// Global variables
/////////////////////////////////////////////////////////////////////////////

// status of application (see bitfield declaration in main.h)
app_flags_t app_flags;

/////////////////////////////////////////////////////////////////////////////
// Local variables
/////////////////////////////////////////////////////////////////////////////

// last ain/din/dout
unsigned char last_ain_pin;
unsigned char last_din_pin;
unsigned char last_dout_pin;

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS after startup to initialize the 
// application
/////////////////////////////////////////////////////////////////////////////
void Init(void) __wparam
{
  // set shift register update frequency
  MIOS_SRIO_UpdateFrqSet(1); // ms

  // we need to set at least one IO shift register pair
  MIOS_SRIO_NumberSet(NUMBER_OF_SRIO);

  // debouncing value for DINs
  MIOS_SRIO_DebounceSet(DIN_DEBOUNCE_VALUE);

  MIOS_SRIO_TS_SensitivitySet(DIN_TS_SENSITIVITY);

  // initialize the AIN driver
  MIOS_AIN_NumberSet(AIN_NUMBER_INPUTS);
#if AIN_MUXED_MODE
  MIOS_AIN_Muxed();
#else
  MIOS_AIN_UnMuxed();
#endif
  MIOS_AIN_DeadbandSet(AIN_DEADBAND);
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS in the mainloop when nothing else is to do
/////////////////////////////////////////////////////////////////////////////
void Tick(void) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
// This function is periodically called by MIOS. The frequency has to be
// initialized with MIOS_Timer_Set
/////////////////////////////////////////////////////////////////////////////
void Timer(void) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when the display content should be 
// initialized. Thats the case during startup and after a temporary message
// has been printed on the screen
/////////////////////////////////////////////////////////////////////////////
void DISPLAY_Init(void) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
//  This function is called in the mainloop when no temporary message is shown
//  on screen. Print the realtime messages here
/////////////////////////////////////////////////////////////////////////////
void DISPLAY_Tick(void) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
//  This function is called by MIOS when a complete MIDI event has been received
/////////////////////////////////////////////////////////////////////////////
void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam
{
  
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when a MIDI event has been received
// which has been specified in the MIOS_MPROC_EVENT_TABLE
/////////////////////////////////////////////////////////////////////////////
void MPROC_NotifyFoundEvent(unsigned entry, unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when a MIDI event has not been completly
// received within 2 seconds
/////////////////////////////////////////////////////////////////////////////
void MPROC_NotifyTimeout(void) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when a MIDI byte has been received
/////////////////////////////////////////////////////////////////////////////
void MPROC_NotifyReceivedByte(unsigned char byte) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS before the shift register are loaded
/////////////////////////////////////////////////////////////////////////////
void SR_Service_Prepare(void) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS after the shift register have been loaded
/////////////////////////////////////////////////////////////////////////////
void SR_Service_Finish(void) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when an button has been toggled
// pin_value is 1 when button released, and 0 when button pressed
/////////////////////////////////////////////////////////////////////////////
void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparam
{


// Midi Events senden
MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0x90);	
MIOS_MIDI_TxBufferPut(pin);      
MIOS_MIDI_TxBufferPut(pin_value ? 0x00 : 0x7f); 	


if(pin < 4)             	// bei button 0-3 soll nurletzte gedrückte led leuchten
{
MIOS_DOUT_PinSet0(0x00);
MIOS_DOUT_PinSet0(0x01);
MIOS_DOUT_PinSet0(0x02);
MIOS_DOUT_PinSet0(0x03);	
MIOS_DOUT_PinSet1(pin);		  
}
else
{if(pin >=4 && pin <=7)    	// bei button 4-7 soll nurletzte gedrückte led leuchten
{
MIOS_DOUT_PinSet0(0x04);
MIOS_DOUT_PinSet0(0x05);
MIOS_DOUT_PinSet0(0x06);
MIOS_DOUT_PinSet0(0x07);	
MIOS_DOUT_PinSet1(pin);	
}
else
{if(pin >=8 && pin <=15)    	// bei button 8-15 soll nurletzte gedrückte led leuchten
{
MIOS_DOUT_SRSet(1, 0x00);	
MIOS_DOUT_PinSet1(pin);	
}
else
{if(pin >39 && pin <50)		// bei button 40 - 49 nurletzte gedrückte led leuchten
{
MIOS_DOUT_SRSet(5, 0x00);	
MIOS_DOUT_PinSet0(0x30);
MIOS_DOUT_PinSet0(0x31);
MIOS_DOUT_PinSet1(pin);	
}
else
{if(pin >=56 && pin <=57)	// led von button 56 - 57 soll nur leuchten wenn button gedrückt
{
MIOS_DOUT_PinSet(pin, MIOS_DOUT_PinGet(pin) ^ 0xFF);	
}
else
{if(pin ==58)	// Button 58 soll alle LED´s ausschalten
{
MIOS_DOUT_SRSet(0, 0x00);
MIOS_DOUT_SRSet(1, 0x00);
MIOS_DOUT_SRSet(2, 0x00);
MIOS_DOUT_SRSet(3, 0x00);
MIOS_DOUT_SRSet(4, 0x00);
MIOS_DOUT_SRSet(5, 0x00);
MIOS_DOUT_SRSet(6, 0x00);
MIOS_DOUT_SRSet(7, 0x00);
}
else                           //alle buttons anderen sollen die leds togglen
{if (pin_value == 1) 
return;

MIOS_DOUT_PinSet(pin, MIOS_DOUT_PinGet(pin) ^ 0xFF);

MIOS_MIDI_BeginStream();

MIOS_MIDI_TxBufferPut(0x90);
MIOS_MIDI_TxBufferPut(0x3C + pin);
MIOS_MIDI_TxBufferPut(0x64 + pin);

MIOS_MIDI_EndStream();
}}}}}}

}
/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when an encoder has been moved
// incrementer is positive when encoder has been turned clockwise, else
// it is negative
/////////////////////////////////////////////////////////////////////////////
void ENC_NotifyChange(unsigned char encoder, char incrementer) __wparam
{
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when a pot has been moved
/////////////////////////////////////////////////////////////////////////////
void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam
{
  // a pot has been moved, send CC# at channel 1
  MIOS_MIDI_TxBufferPut(0xb0 + pin); // CC at channel 1
  MIOS_MIDI_TxBufferPut(07);  // pin number corresponds to CC number
  MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin));   // don't send 10bit pin_value,
                                                     // but 7bit value

}

Link to comment
Share on other sites

Pack doch mal in die DISPLAY_Init sowas wie:

MIOS_LCD_CursorSet(0x00);

MIOS_LCD_PrintCString("Test 13");

Dann siehst Du wenigstens gleich ob die neue Version drauf ist. Wenn das nicht hilft funktioniert der Upload offensichtlich nicht.

Sowas:

if(pin >=4 && pin <=7) 

solltest Du unbedingt klammern, es sei denn Du bist Dir 100% wie Dein Compiler die Bindungen wichtet. Sicherer ist also

if ((pin >= 4) && (pin <= 7)) 

Noch was am Rand: Einrückungen sind eine tolle Sache, solltest Du Dir angewöhnen, das hilft anderen (wie mir) Deine Code schneller lesen zu können. Außerdem kannst Du Dir eine Menge Deiner {} sparen. Geschmackssache aber ich finde das so deutlich besser zu lesen ;)

void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparam
{
// Midi Events senden
MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0x90);
MIOS_MIDI_TxBufferPut(pin);     
MIOS_MIDI_TxBufferPut(pin_value ? 0x00 : 0x7f);

if (pin < 4) {            // bei button 0-3 soll nurletzte gedrückte led leuchten
MIOS_DOUT_PinSet0(0x00);
MIOS_DOUT_PinSet0(0x01);
MIOS_DOUT_PinSet0(0x02);
MIOS_DOUT_PinSet0(0x03);
MIOS_DOUT_PinSet1(pin);  
} else
if ((pin >=4) && (pin <=7)) {    // bei button 4-7 soll nurletzte gedrückte led leuchten
MIOS_DOUT_PinSet0(0x04);
MIOS_DOUT_PinSet0(0x05);
MIOS_DOUT_PinSet0(0x06);
MIOS_DOUT_PinSet0(0x07);
MIOS_DOUT_PinSet1(pin);
} else
if ((pin >=8) && (pin <=15)) {    // bei button 8-15 soll nurletzte gedrückte led leuchten
MIOS_DOUT_SRSet(1, 0x00);
MIOS_DOUT_PinSet1(pin);
} else
if ((pin > 39) && (pin < 50)) { // bei button 40 - 49 nurletzte gedrückte led leuchten
MIOS_DOUT_SRSet(5, 0x00);
MIOS_DOUT_PinSet0(0x30);
MIOS_DOUT_PinSet0(0x31);
MIOS_DOUT_PinSet1(pin);
} else
if ((pin >=56) && (pin <=57)) {// led von button 56 - 57 soll nur leuchten wenn button gedrückt
MIOS_DOUT_PinSet(pin, MIOS_DOUT_PinGet(pin) ^ 0xFF);
else
if (pin == 58) {// Button 58 soll alle LED´s ausschalten
MIOS_DOUT_SRSet(0, 0x00);
MIOS_DOUT_SRSet(1, 0x00);
MIOS_DOUT_SRSet(2, 0x00);
MIOS_DOUT_SRSet(3, 0x00);
MIOS_DOUT_SRSet(4, 0x00);
MIOS_DOUT_SRSet(5, 0x00);
MIOS_DOUT_SRSet(6, 0x00);
MIOS_DOUT_SRSet(7, 0x00);
} else {                          //alle buttons anderen sollen die leds togglen
if (pin_value == 1)
return;

MIOS_DOUT_PinSet(pin, MIOS_DOUT_PinGet(pin) ^ 0xFF);

MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0x90);
MIOS_MIDI_TxBufferPut(0x3C + pin);
MIOS_MIDI_TxBufferPut(0x64 + pin);
MIOS_MIDI_EndStream();
}
}[/code]

Link to comment
Share on other sites

Macht er

Nen display hab ich leider nicht woran ich es also sehen könnte.

<grummel>'nen ist die Abkürzung für einen, es heißt aber das Display; somit ist es ein Display und damit abgekürzt 'n Display.</grummel>

Das mit den klammerungen hat mein compiler ohne probleme gemacht

Na klar, kompilieren kannst Du das. Aber ob es das macht, was Du erwartest ist eine ganz andere Sachen. Einige Operatoren binden stärker als andere; gleiches Prinzip wie bei "Punkt vor Strich". Abgesehen davon hilft eine anständige Klammerung unmittelbar der Lesbarkeit und damit mittelbar Fehler zu vermeiden.

Bekomm ich denn über MIDI  irgend ne rückmeldung vom Core wenn der upload funktioniert hat?

Wenn Du mit MIOS Studio und "Smart Mode" hochlädst, ja. Dann werden alle gesendeten Pakete quittiert. Du könntest auch einfach in der USER_INIT ein paar Bytes per MIDI rausschicken - evtl. sowas wie eine Versionsnummer. Dann siehst Du auch ob's klappt.

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

×
×
  • Create New...