
protofuse
Programmer-
Posts
288 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Blogs
Gallery
Everything posted by protofuse
-
[solved/ keyword static and LUT] common anode matrix & ISR
protofuse replied to protofuse's topic in MIOS programming (C)
with the following code, it works fine and fast (no flickering...etc) void DisplayLED(unsigned char column, unsigned char color) __wparam { color >>= 4; MIOS_DOUT_PinSet(column+8, (color & 0x01)); // RED color >>= 1; MIOS_DOUT_PinSet(column+8+8, (color & 0x01)); // BLUE color >>= 1; MIOS_DOUT_PinSet(column+8+8+8, (color & 0x01)); // GREEN } ///////////////////////////////////////////////////////////////////////////// // This function is called by MIOS before the shift register are loaded ///////////////////////////////////////////////////////////////////////////// void SR_Service_Prepare(void) __wparam { // HELPED BY BUGFIGHT => http://www.midibox.org/forum/index.php/topic,12786.0.html static unsigned char row; static unsigned char lastrow; unsigned int x; row = ++row & 0x07; // 8 cycle = 6.25% duty cycle //MIOS_DOUT_SRSet(0, 0); MIOS_DOUT_PinSet0(lastrow); // lastrow ON made OFF MIOS_DOUT_PinSet1(row); // row driver pin #row ON for (x = 0; x < 8; x++) { //DisplayLED(x , matrix[row][x]); // for the row row, cycle of all column MIOS_DOUT_PinSet(x+8+8, 0x01); MIOS_DOUT_PinSet(x+8+8+8,0x01); } lastrow = row; } So I guess the problem comes from the DisplayLED() parser. Indeed, in the ISR, I'm calling this function to parse the following "lookup table" : // we create a 2-dimensional array with 64 entries for led color storage for the clip matrix controller part // each entry consists of 1 byte coded like that: // 0x00 = OFF // 0x10 = RED // 0x20 = GREEN // 0x40 = BLUE // 0x30 = RED + GREEN = YELLOW // 0x60= GREEN + BLUE = CYAN // 0x50 = RED + BLUE = MAGENTA // 0x70 = WHITE // The meaning of the bytes can be found in the MIDI spec // (-> http://www.harmony-central.com/MIDI/Doc/table1.html) // (-> http://www.harmony-central.com/MIDI/Doc/table2.html) // (-> http://www.harmony-central.com/MIDI/Doc/table3.html) // // structure is matrix[ROW][COLUMN]=COLOR static unsigned char matrix[8][8] = { {0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10}, {0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20}, {0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30}, {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40}, {0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50}, {0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60}, {0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70}, {0x00,0x30,0x00,0x50,0x00,0x70,0x00,0x00} }; unsigned char isn't probably the good type... am I right? the result of (color & 0x01) seems to be 0 everytime ...(or something ^= 1) (where color = an element of the matrix[][] lookup table. if someone could guide me, it would be very appreciated :) -
sudden core problem? bootloader problem?
protofuse replied to protofuse's topic in Testing/Troubleshooting
all is ok. when it happens: try to restart the core, upload a new code etc etc one time, it will happen ! -
sudden core problem? bootloader problem?
protofuse replied to protofuse's topic in Testing/Troubleshooting
now it is better (?) MIOS V1.9f (C) 2007 T.Klose but core seems stuck. I read about checking voltage, gnd etc. I did it. all is ok. I read about core stuck.. it is impossible as I read. I tried to "force" upload by restarting it and sending my .hex without waiting checksum confirmation... all the same. it is stuck in this state. strange. a long time ago, I fixed all PSU problem. it is very stable and reliable. if someone gets an idea for me to test/try etc. If I find a trick, I post here :) -
hello, by investigating my rgb led driver (http://www.midibox.org/forum/index.php/topic,14109.msg121450.html#new) I had a strange problem: when I restart the core, leds part is ok (except my code problem... but I mean, some leds are as they must be) but my "pretty" LCD gives me a strange message: ME5 >505$$ o7$$ and it seems I cannot upload anything :-( does it happen in special conditions ? may I do a mistake? is it a known behaviour?
-
[solved/ keyword static and LUT] common anode matrix & ISR
protofuse replied to protofuse's topic in MIOS programming (C)
I retested. 1) I tried 10ms and this code: a static light pattern for the led. I only post Init() and SR_Service_Prepare() : void Init(void) __wparam { // configure the core1 as midibox-link FORWARD Point // see infos about midibox-link here: http://www.ucapps.de/midibox_link.html MIOS_MIDI_MergerSet(MIOS_MIDI_MERGER_MBLINK_EP); // set shift register update frequency MIOS_SRIO_UpdateFrqSet(10); // 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); // all pin of row driver low MIOS_DOUT_SRSet(0, 0); MIOS_DOUT_SRSet(1, 0); MIOS_DOUT_SRSet(2, 0); MIOS_DOUT_SRSet(3, 0); } void SR_Service_Prepare(void) __wparam { MIOS_DOUT_PinSet(2+8, 0x01); MIOS_DOUT_PinSet(2+8+8, 0x01); MIOS_DOUT_PinSet(2+8+8+8,0x01); MIOS_DOUT_PinSet(7+8, 0x00); MIOS_DOUT_PinSet(7+8+8, 0x01); MIOS_DOUT_PinSet(7+8+8+8,0x01); } ok it works! no cycle, all hardcoded. 2) the same light pattern in init() and not in ISR it works too. but the code posted in the first post doesn't work anymore any ideas? even with update SR refresh is 1ms or 10ms ... etc.. all the same. -
warnings when compiling my app for 18f4620
protofuse replied to WickedBlade's topic in MIOS programming (C)
my only warning is : warning: processor mismatch in "mulint.o" so, I guess it compiles for the right processor! I hope... -
warnings when compiling my app for 18f4620
protofuse replied to WickedBlade's topic in MIOS programming (C)
I still have the error. I didn't really figure out what you did to fix the thing.. recompile sdcc ? sorry -
hello, fortunately, I built my common anode matrix rgb led driver (THANKS TO LUCEM who detailed me all the process, and made me understand!) - row (anodes) driver is SR + resistor 1k + transistor BC547 used as a switch to source 5V to rows.. - column (cathodes) driver is 3 ULN to sink current + 3 SR. (3 = one for each color) I have a little problem now with the code (only the code, I guess) When I basically turn pins high in Init(), it works very fine ! But the process has to be done in ISR via SR_Service_Prepare() when I do that, no led are up... 1st SR is for ROW driver 2, 3, 4th are for RBG color COLUMN driver here are the code involved: ///////////////////////////////////////////////////////////////////////////// // Include files ///////////////////////////////////////////////////////////////////////////// #include <cmios.h> #include <pic18fregs.h> #include <protodeck.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; // we create a 2-dimensional array with 23 entries for mapping between potentiometers movements & events associated // each entry consists of two bytes: // o one for the first MIDI byte (MIDI status) => 0xb* means CC message for Channel * // o a second for the second MIDI byte (=> CC number) // The meaning of the bytes can be found in the MIDI spec // (-> http://www.harmony-central.com/MIDI/Doc/table1.html) // (-> http://www.harmony-central.com/MIDI/Doc/table2.html) // (-> http://www.harmony-central.com/MIDI/Doc/table3.html) const unsigned char pot_event_map[23][2] = { //AIN 11 // Pots 1-12 = drums controls pots => channel 10 {0xb9, 0x01}, {0xb9, 0x02}, {0xb9, 0x03}, {0xb9, 0x04}, {0xb9, 0x05}, {0xb9, 0x06}, {0xb9, 0x07}, {0xb9, 0x08}, {0xb9, 0x09}, {0xb9, 0x0A}, {0xb9, 0x0B}, {0xb9, 0x0C}, // Pots 13-18 = EQ = channel 16 {0xbF, 0x01}, {0xbF, 0x02}, {0xbF, 0x03}, {0xbF, 0x04}, {0xbF, 0x05}, {0xbF, 0x06}, // Pot 19 = Master Volume = channel 16 {0xbF, 0x07}, // Pots 20-23 = multifunctionnal purpose pots = channel 16 {0xbF, 0x08}, {0xbF, 0x09}, {0xbF, 0x10}, {0xbF, 0x0A}, }; // we create a 2-dimensional array with 64 entries for mapping between switches push & events associated // each entry consists of two bytes: // o one for the first MIDI byte (MIDI status) => 0x9* means Note message for Channel * // o a second for the second MIDI byte (=> Note number) // This const is parsed lower by void DIN_NotifyToggle() // The meaning of the bytes can be found in the MIDI spec // (-> http://www.harmony-central.com/MIDI/Doc/table1.html) // (-> http://www.harmony-central.com/MIDI/Doc/table2.html) // (-> http://www.harmony-central.com/MIDI/Doc/table3.html) const unsigned char button_event_map[64][2] = { //------- clip matrix control //-------- DIN11 // Buttons 1-8 = tracks mute = channel 1-8 {0x90, 0x01}, {0x91, 0x01}, {0x92, 0x01}, {0x93, 0x01}, {0x94, 0x01}, {0x95, 0x01}, {0x96, 0x01}, {0x97, 0x01}, // Buttons scenes 1 = 9-16 = channel 1-8 {0x90, 0x02}, {0x91, 0x02}, {0x92, 0x02}, {0x93, 0x02}, {0x94, 0x02}, {0x95, 0x02}, {0x96, 0x02}, {0x97, 0x02}, // Buttons scenes 2 = 17-24 = channel 1-8 {0x90, 0x03}, {0x91, 0x03}, {0x92, 0x03}, {0x93, 0x03}, {0x94, 0x03}, {0x95, 0x03}, {0x96, 0x03}, {0x97, 0x03}, // Buttons scenes 3 = 25-32 = channel 1-8 {0x90, 0x04}, {0x91, 0x04}, {0x92, 0x04}, {0x93, 0x04}, {0x94, 0x04}, {0x95, 0x04}, {0x96, 0x04}, {0x97, 0x04}, //-------- DIN12 // Buttons scenes 4 = 33-40 = channel 1-8 {0x90, 0x05}, {0x91, 0x05}, {0x92, 0x05}, {0x93, 0x05}, {0x94, 0x05}, {0x95, 0x05}, {0x96, 0x05}, {0x97, 0x05}, // Buttons scenes 5 = 41-48 = channel 1-8 {0x90, 0x06}, {0x91, 0x06}, {0x92, 0x06}, {0x93, 0x06}, {0x94, 0x06}, {0x95, 0x06}, {0x96, 0x06}, {0x97, 0x06}, // Buttons scenes 6 = 49-56 = channel 1-8 {0x90, 0x07}, {0x91, 0x07}, {0x92, 0x07}, {0x93, 0x07}, {0x94, 0x07}, {0x95, 0x07}, {0x96, 0x07}, {0x97, 0x07}, // Buttons scenes control = 57-62 = CHANNEL 16 {0x9F, 0x01}, {0x9F, 0x02}, {0x9F, 0x03}, {0x9F, 0x04}, {0x9F, 0x05}, {0x9F, 0x06}, // Buttons offset control = 63,64 = CHANNEL 16 {0x9F, 0x07}, {0x9F, 0x08} }; static unsigned int clipButtons[8] = { 0,0,0,0,0,0,0,0 }; // we create a 2-dimensional array with 64 entries for led color storage for the clip matrix controller part // each entry consists of 1 byte coded like that: // 0x00 = OFF // 0x10 = RED // 0x20 = GREEN // 0x40 = BLUE // 0x30 = RED + GREEN = YELLOW // 0x60= GREEN + BLUE = CYAN // 0x50 = RED + BLUE = MAGENTA // 0x70 = WHITE // The meaning of the bytes can be found in the MIDI spec // (-> http://www.harmony-central.com/MIDI/Doc/table1.html) // (-> http://www.harmony-central.com/MIDI/Doc/table2.html) // (-> http://www.harmony-central.com/MIDI/Doc/table3.html) // // structure is matrix[ROW][COLUMN]=COLOR static unsigned char matrix[8][8] = { {0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10}, {0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20}, {0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30}, {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40}, {0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50}, {0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60}, {0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70}, {0x00,0x30,0x00,0x50,0x00,0x70,0x00,0x00} }; ///////////////////////////////////////////////////////////////////////////// // This function is called by MIOS after startup to initialize the // application ///////////////////////////////////////////////////////////////////////////// void Init(void) __wparam { // configure the core1 as midibox-link FORWARD Point // see infos about midibox-link here: http://www.ucapps.de/midibox_link.html MIOS_MIDI_MergerSet(MIOS_MIDI_MERGER_MBLINK_EP); // 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); // all pin of row driver low MIOS_DOUT_SRSet(0, 0); } ///////////////////////////////////////////////////////////////////////////// // 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 { // clear screen MIOS_LCD_Clear(); // print static messages MIOS_LCD_CursorSet(0x00); // first line MIOS_LCD_PrintCString("1AIN DIN DOUT"); MIOS_LCD_CursorSet(0x40); // second line MIOS_LCD_PrintCString("xx:xxx xxxx xxxx"); // request display update app_flags.DISPLAY_UPDATE_REQ = 1; } ///////////////////////////////////////////////////////////////////////////// // 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 { // do nothing if no update has been requested if( !app_flags.DISPLAY_UPDATE_REQ ) return; // clear request app_flags.DISPLAY_UPDATE_REQ = 0; // print status of AIN MIOS_LCD_CursorSet(0x40 + 0); MIOS_LCD_PrintBCD2(last_ain_pin + 1); MIOS_LCD_PrintChar(':'); MIOS_LCD_PrintBCD3(MIOS_AIN_Pin7bitGet(last_ain_pin)); // print status of DIN MIOS_LCD_CursorSet(0x40 + 7); MIOS_LCD_PrintBCD3(last_din_pin + 1); MIOS_LCD_PrintChar(MIOS_DIN_PinGet(last_din_pin) ? 'o' : '*'); // print status of DOUT MIOS_LCD_CursorSet(0x40 + 12); MIOS_LCD_PrintBCD3(last_dout_pin + 1); MIOS_LCD_PrintChar(MIOS_DOUT_PinGet(last_dout_pin) ? '*' : 'o'); } ///////////////////////////////////////////////////////////////////////////// // 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 when a complete MIDI event has been received ///////////////////////////////////////////////////////////////////////////// void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam { int channelIndex = evnt0; int noteIndex = evnt1; unsigned char value = evnt2; // _COLOR_OFF 0x00 00000000 // _COLOR_RED 0x10 00010000 // _COLOR_GREEN 0x20 00100000 // _COLOR_BLUE 0x40 01000000 // _COLOR_CYAN 0x60 01100000 // _COLOR_MAGENTA 0x50 01010000 // _COLOR_YELLOW 0x30 00110000 // _COLOR_WHITE 0x70 01110000 /*if (channelIndex >= 0 && channelIndex < 8) { if ( noteIndex > _NOTE_RECEIVE_OFFSET && noteIndex < _NOTE_RECEIVE_OFFSET +8 ) { matrix[noteIndex-_NOTE_RECEIVE_OFFSET][channelIndex] = value ; } }*/ } ///////////////////////////////////////////////////////////////////////////// // 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 { } void DisplayLED(unsigned char column, unsigned char color) __wparam { color >>= 4; MIOS_DOUT_PinSet(column+8, (color & 0x01)); // RED color >>= 1; MIOS_DOUT_PinSet(column+8+8, (color & 0x01)); // BLUE color >>= 1; MIOS_DOUT_PinSet(column+8+8+8, (color & 0x01)); // GREEN } ///////////////////////////////////////////////////////////////////////////// // This function is called by MIOS before the shift register are loaded ///////////////////////////////////////////////////////////////////////////// void SR_Service_Prepare(void) __wparam { // HELPED BY BUGFIGHT => http://www.midibox.org/forum/index.php/topic,12786.0.html static unsigned char row; static unsigned char lastrow; unsigned int x; row = ++row & 0x07; // 8 cycle = 6.25% duty cycle MIOS_DOUT_PinSet0(lastrow); // row driver pin of last row on pulled OFF MIOS_DOUT_PinSet1(row); // row driver pin #row ON for (x = 0; x < 8; x++) { DisplayLED(x , matrix[row][x]); // for the row row, cycle all column } lastrow = row; } ///////////////////////////////////////////////////////////////////////////// // 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 { // a button has been pressed, send Note at channel 1 // MIOS_MIDI_BeginStream(); // MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1 // MIOS_MIDI_TxBufferPut(pin); // pin number corresponds to note number // MIOS_MIDI_TxBufferPut(pin_value ? 0x00 : 0x7f); // buttons are high-active // MIOS_MIDI_EndStream(); unsigned char channel; unsigned char note; channel = button_event_map[pin][0]; note = button_event_map[pin][1]; if (pin_value == 0) { if (clipButtons[channel] != 0) { return; } clipButtons[channel] = 1; } else { clipButtons[channel] = 0; } MIOS_MIDI_BeginStream(); MIOS_MIDI_TxBufferPut(channel); // first value from table = CHANNEL MIOS_MIDI_TxBufferPut(note); // second value from table = NOTE MIOS_MIDI_TxBufferPut(pin_value ? 0x00 : 0x7f); // 1 MIOS_MIDI_EndStream(); // notify display handler in DISPLAY_Tick() that DIN value has changed last_din_pin = pin; app_flags.DISPLAY_UPDATE_REQ = 1; } ///////////////////////////////////////////////////////////////////////////// // 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#<pin-number> at channel 1 // MIOS_MIDI_BeginStream(); // MIOS_MIDI_TxBufferPut(0xb0); // CC at channel 1 // MIOS_MIDI_TxBufferPut(pin); // pin number corresponds to CC number // MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); // don't send 10bit pin_value, but 7bit value // MIOS_MIDI_EndStream(); // send mapped CC value MIOS_MIDI_BeginStream(); MIOS_MIDI_TxBufferPut(pot_event_map[pin][0]); // first value from table MIOS_MIDI_TxBufferPut(pot_event_map[pin][1]); // second value from table MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); // 7bit pot value MIOS_MIDI_EndStream(); // notify display handler in DISPLAY_Tick() that AIN value has changed last_ain_pin = pin; app_flags.DISPLAY_UPDATE_REQ = 1; } void ClearMatrix(void) __wparam { unsigned int column = 0; unsigned int row = 0; for (row = 0; row < 8; row++) { for (column = 0; column < 8; column++) { matrix[row][column] = _COLOR_OFF; } } } Indeed, it is the same code used by noofny/mike with his common cathode matrix. but the hardware matches this code too, no? if someone could help me . . . :)
-
all is ok, on the hardware side. I built my common anode matrix driver (not as difficult as I thought) I have to tweak my code now. I probably open another thread..
-
Mike... I'm working just now on the driver ... ;) It WILL work fine today. and the curse will be away :D
-
btw, on this : http://www.sparkfun.com/commerce/product_info.php?products_id=105 we can see 2 things confusing (for me, but for other I guess): - if I read the text I read: common cathode. - If I read the name: triple output LED RGB. in my (little) head, I think the title should be ... triple input LED RGB am I stupid? or just ... cursed (private joke for nils) ..?
-
blm-module ?
-
no problem. it shouldn't be a code problem. my matrix isn't common cathode... but common anode. thanks besthongkong ! I ordered common cathode, you sent common anode... if I wasn't a newbie, of course I'd check it before soldering but ... btw, thanks to lucem. he detailed me how I can make it works with darlington and BC547 too... I guess it will work ... tomorrow! all the best
-
lucem just helps me to design the correct stuff to use my (finally) common anode matrix! I have to add : besthongkong.com made this mistake 2 times! as a newbie, I didn't check it first. but it was the case: I bought common cathode, they sent common anode!
-
I made a lot of tests this morning (and still on this) 1) I remove all the din, ain hook in order to test only DOUT. => it doesn't work 2) 1) + I tested without ISR.. all the lighting stuff in INIT (I only light up 1 led by using 2 MIOS_DOUT_PinSet1(); instruction... it doesn't work my LED are common cathode... sold as common cathode BUT I have a big doubt! I searched a lot, find a lot of schematics. cathode is the pin from which the current goes out ??? right? if it is right, it means my matrix is driven like that: 3x74HC595 drive anode (current enter in LED from 595) and ULN2803 sink current from all cathode... Right?? I take a led alone... I connected the longest pin (supposed to be the "common" cathode) to GND and one of other pin to 5V....... nothing happens! ! ! ! ! ! I reversed it: longest pin to 5V, another one to Gnd........ LIGHT UP! My conclusion, I have a matrix of common anode ! ! ! ! ! ! !! and I bought common cathode ... I guess there was a mistake in the shipment :-( so 2 questions: 1) are my experiments exact ? 2) if they are, it means I have a common anode matrix, pretty, but common anode. Could I use it with the same kind of DOUT / ULN2803 ??? if I can't, no problem, I spent too much time to track this stupid problem, and I'm ready to buy again buttons + CC LED in order to redbuild the stuff.
-
ok, it isn't right. thanks nils for your few minutes :P MIOS_DOUT_SRSet(_MATRIX_DOUT_START, 0); send 0 to all pin of the _MATRIX_DOUT_START n-th shiftregister ... in my case the first one so I cycle rows and I do: MIOS_DOUT_SRSet(_MATRIX_DOUT_START, 0); MIOS_DOUT_PinSet1(row); it means that cyclicly, I put 5V to the pin 1 and nothing to the other, after that 5V to pin2 etc etc so the row / ULN cycle seems to be correct.. where is my mistake . . . .? in the code I attached, I commented all clearmatrix calls. the purpose is to light up leds to see if it works........ the matrix[][] structure is defined to make leds shining... but, maybe, I missed something and ... all work and I don't know it causes the code switch off the led .... no... It cannot be that
-
ok janis, I saw that in the link I posted too. but how can it help in my case? I mean: what should I change? if I have 2 DIN + 1 DOUT, NUMBER_OF_SRIO = 12 ? in the definition: [tt]MIOS_DOUT_SRSet void MIOS_DOUT_SRSet(unsigned char sr, unsigned char sr_value) sets value of DOUT shift register number of shift register in <sr> value in <sr_value>[/tt] when I do: MIOS_DOUT_SRSet(_MATRIX_DOUT_START, 0); MIOS_DOUT_PinSet1(row); I guess I put 5V to the pin "row" of the _MATRIX_DOUT_START n-th shiftregister ? I don't understand completely what MIOS_DOUT_SRSet() does...
-
hello, I probably exhumed an old thread by posting that: http://www.midibox.o...index.php/topic,12786.msg121206/topicseen.html#msg121206 so I'd prefer to repost another topic. 1 DOUT where the first SR is connected to 1 ULN2803 with his pin 9 to GND (pin 10 not connected to anything) the purpose is the handling of a 8x8 RGB common cathode led matrix. the code comes from ain64_din128_dout128 apps. SR_Service_Prepare has been modified to handle the ULN to cycle the matrix. it doesn't work. I guess it should, because noofny/mike did... we have the same code, and almost the same hardware..... BUT, he chained his 2 DOUT on the same core, I have 1 DOUT per core. the code has been altered to fit with my hardware, of course. but I may missed something. the code part to look at are : void DisplayLED(unsigned char column, unsigned char color) __wparam { color >>= 4; MIOS_DOUT_PinSet(column+8, (color & 0x01)); // RED color >>= 1; MIOS_DOUT_PinSet(column+8+8, (color & 0x01)); // BLUE color >>= 1; MIOS_DOUT_PinSet(column+8+8+8, (color & 0x01)); // GREEN } ///////////////////////////////////////////////////////////////////////////// // This function is called by MIOS before the shift register are loaded ///////////////////////////////////////////////////////////////////////////// void SR_Service_Prepare(void) __wparam { // HELPED BY BUGFIGHT ON MIDIBOX - http://www.midibox.org/forum/index.php/topic,12786.0.html static unsigned char row; unsigned int x; //edit* just noticed, no reason for this to be static row = ++row & 0x07; //<-- here you were cycling 16 rows i think you meant 8, no? //this would have resulted in a 6.25% duty cycle (vs 12.5%). //note that the duomatrix uses a 25% duty cycle MIOS_DOUT_SRSet(_MATRIX_DOUT_START, 0); //<-- hardwire bad, napster good. define constants // so you can move your matrix in the chain MIOS_DOUT_PinSet1(row); for (x = 0; x < 8; x++) { DisplayLED(x , matrix[row][x]); } } _MATRIX_DOUT_START is 0 in each case cause ULN is on the 1st SR. NUMBER_OF_SRIO is defined to 12 cause I have 2 DIN + 1 DOUT on the core considered here (2x4 + 1x4 = 12) I have big doubts about these constants. I saw that: http://www.midibox.o...[]=din&s[]=dout probably, I don't activate the correct pin... if someone could point me in the right way, it would be very great and interesting :) I attached my main.c and my main.h main.c main.h main.c main.h
-
hello, 6 months after, I'm almost ok with my deck. I use the same code that the one of noofny, but I don't have 2 DOUT on the same core: I have one DOUT on each core. I made a modification and I'm using smashTV DOUT with 4 SR, 3 resistor arrays + 1 ULN2803. The ULN2803 pin9 is clamped to GND, the pin 10 isn't connected to nothing (the mistake is here ....????) I attached the main.c & main.h of the core 1 but I did the same thing for led handling for the core 2. The code of noofny works fine for his 2 DOUT chained, I altered it to make it working with my solo DOUT... BUT it doesn't work! the code part to look at are : void DisplayLED(unsigned char column, unsigned char color) __wparam { color >>= 4; MIOS_DOUT_PinSet(column+8, (color & 0x01)); // RED color >>= 1; MIOS_DOUT_PinSet(column+8+8, (color & 0x01)); // BLUE color >>= 1; MIOS_DOUT_PinSet(column+8+8+8, (color & 0x01)); // GREEN } ///////////////////////////////////////////////////////////////////////////// // This function is called by MIOS before the shift register are loaded ///////////////////////////////////////////////////////////////////////////// void SR_Service_Prepare(void) __wparam { // HELPED BY BUGFIGHT ON MIDIBOX - http://www.midibox.org/forum/index.php/topic,12786.0.html static unsigned char row; unsigned int x; //edit* just noticed, no reason for this to be static row = ++row & 0x07; //<-- here you were cycling 16 rows i think you meant 8, no? //this would have resulted in a 6.25% duty cycle (vs 12.5%). //note that the duomatrix uses a 25% duty cycle MIOS_DOUT_SRSet(_MATRIX_DOUT_START, 0); //<-- hardwire bad, napster good. define constants // so you can move your matrix in the chain MIOS_DOUT_PinSet1(row); for (x = 0; x < 8; x++) { DisplayLED(x , matrix[row][x]); } } could someone help me a bit? all the best, main.c main.h main.c main.h
-
I didn't finish this custom. but I did other custom for my project which you can see on my website. I just received the reliable midibox modules from SmashTV :)
-
hello I began to make a big PCB with all modules connected. I didn't finish because I ordered the reliable modules from SmashTV: - double sided - coated they just arrived hom today :)
-
hehe yes I already put it inside the box I had all in my box already I also have my frontpanel etc etc If I didn't have all these problems, I would have my protodeck already functionnal (obvious sentence.. but..) my blog is here, if you are interested: http://www.julienbayle.net/diy/protodeck/blog/
-
cause my PSU output is already regulated.
-
hello Alex and thanks a lot for your advice I plan to have only one plug with only one position that fits. I'll put a fuse just at the psu output in order to protect my 3 lines (2 pcbs + pots supplies)
-
not a + sign, it was the cursor I let here (sorry) 5v = + GNDPWR = Ground "external or internal 5 volts PSU will be used" what do you mean? I'll use one ECM40 PSU to drive my 2 cores with 2 separate line (I mean cores take current directly on the psu)