Jump to content

fsvo

Members
  • Posts

    5
  • Joined

  • Last visited

    Never

About fsvo

  • Birthday 01/01/1

Profile Information

  • Gender
    Not Telling

fsvo's Achievements

MIDIbox Newbie

MIDIbox Newbie (1/4)

0

Reputation

  1. Thanks again. I also took the easy way and switched to a 452 and it's working now :) I will however look into your advice for other projects ptitjes. Now i just need to work some more on the code, it's not working exactly as intended with my shift register setup yet. I will come back and show u the result of the porject when it's done :)
  2. OK as i mentioned i'm using the 4685 with the 452.h file. Is this a problem? I tried upload the hex now but the display dies after rebooting MIOS and nothing seem to work. Actually even the sdcc skeleton 1.9 template program only running a "Hello World" on the display isn't displaying a Hello World. I can't find a .h file for 4685 anywhere on the net. Is this my problem anyway?
  3. Thanks guys, awesome, i shoud've figured that one out by myself. Im getting a sucessful compile that feels great. I will see later today how well it works after an upload, i guess not very good the first try ;D
  4. In that case i could try to be more specific. I was following those steps before, downloaded perl, sdcc and gputils, installed it correctly etc. Here the help stops in the docs and info i can found on all the midibox pages. Running make.bat on the "empty" main.c in the /sdcc_skeleton/ works without error. I figured i could use this method and get it to work with some more code added. I get some error but there might just be coding errors left then? I'm currently including cmios.h and pic18f452.h EDIT: worked it down to just one error i think, what can that be? Here´s the compiling: [tt] Compiling main.c Processor: 18F452 main.c:103: error 65: function 'Init' already has body main.c:110: error 103: code not generated for 'Tick' due to previous errors main.c:118: error 103: code not generated for 'Timer' due to previous errors main.c:129: error 103: code not generated for 'DISPLAY_Init' due to previous err ors main.c:138: error 103: code not generated for 'DISPLAY_Tick' due to previous err ors main.c:145: error 103: code not generated for 'MPROC_NotifyReceivedEvnt' due to previous errors main.c:153: error 103: code not generated for 'MPROC_NotifyFoundEvent' due to pr evious errors main.c:161: error 103: code not generated for 'MPROC_NotifyTimeout' due to previ ous errors main.c:168: error 103: code not generated for 'MPROC_NotifyReceivedByte' due to previous errors main.c:175: error 103: code not generated for 'SR_Service_Prepare' due to previo us errors main.c:182: error 103: code not generated for 'SR_Service_Finish' due to previou s errors main.c:190: error 103: code not generated for 'DIN_NotifyToggle' due to previous errors main.c:199: error 103: code not generated for 'ENC_NotifyChange' due to previous errors main.c:206: error 103: code not generated for 'AIN_NotifyChange' due to previous errors ERROR! [/tt]
  5. Hi all I have no coding experience but a friend helped me very fast to write a piece of code, he said would do the job i want to be done with my core module. I'll post it here just to show, I'm not sure it's perfectly correct but that's not my problem. I don't know how to get this code onto the 18f4685. As I'm not coding myself the world of compilers and files seems huge. I've tried to play around in MPLAB, sdcc skeleton, using example programs etc, but I'm not getting very close. I figured i need to include some mios files, a pic file? (452 only choice?) but how, where, more precise. short said i need some kinda step by step help to make this code a working hex :) I'm into learning C so if i knew how to get code going with the MIOS i could go learning from there. I know it's a pretty big question but also advice leading in the right direction is much appreciated! As you can see (i guess :)), the code is supposed to output a bunch of data which i´ll connect to several shift registers and then LED´s giving one LED for each button on a digital piano, via MIDI. Im posting the code mostly because it might be funnier for you coders ^^ Thank You #include "cmios.h" #include "pic18f452.h" #define BIT_CLOCK 0 #define BIT_LATCH 1 #define BIT_DATA 2 #define CHANNEL 1 #define NOTEON 0x90 #define NOTEOFF 0x80 #define NOTE_OFFSET 15 #define BITASSIGN( bit, val ) PORTA = ( PORTA & ~( 1 << bit ) ) | ( val << bit ); unsigned char min( unsigned char a, unsigned char b ) { return a < b ? a : b; } unsigned char buffer[ 11 ]; void Init( ) { TRISA &= ~( ( 1 << BIT_CLOCK ) | ( 1 << BIT_LATCH ) | ( 1 << BIT_DATA ) ); } void Delay( ) { int i=0; for( i; i<1000; ++i ); } void ShiftBits( ) { BITASSIGN( BIT_CLOCK, 1 ); Delay( ); BITASSIGN( BIT_CLOCK, 0 ); } void LatchRegisters( ) { BITASSIGN( BIT_LATCH, 1 ); Delay( ); BITASSIGN( BIT_LATCH, 0 ); } void UpdateLeds( ) { unsigned char j=0; unsigned char bit=0; for( j; j<11; ++j ) for( bit; bit<8; ++bit ) { BITASSIGN( BIT_DATA, ( buffer[ j ] >> bit ) & 1 ); ShiftBits( ); } LatchRegisters( ); } void OnNoteOn( unsigned char note ) { buffer[ note >> 3 ] |= 1 << ( note & 7 ); UpdateLeds( ); } void OnNoteOff( unsigned char note ) { buffer[ note >> 3 ] &= ~( 1 << ( note & 7 ) ); UpdateLeds( ); } void USER_MPROC_NotifyReceivedEvent( unsigned char evnt0, unsigned char evnt1, unsigned char evnt2 ) { if( ( ( NOTEOFF | CHANNEL ) == evnt0 ) || ( ( ( NOTEON | CHANNEL ) == evnt0 ) && ( 0 == evnt2 ) ) ) OnNoteOff( min( 0x6C, evnt1 - NOTE_OFFSET ) ); else if( ( NOTEON | CHANNEL ) == evnt0 ) OnNoteOn( min( 0x6C, evnt1 - NOTE_OFFSET ) ); }
×
×
  • Create New...