intellijel Posted June 1, 2008 Report Share Posted June 1, 2008 I was looking at ways to hook up a max7221 to the midibox. I am always thinking in terms of retaining the functionality of a midbox64 but being able to change how certain things are done.I know there was a max72xx driver created as part of the Stribe project in the repository However I am not sure how to hook this up to core if I am using it for DOUT, DIN and AIN modules as well.I am also trying to avoid re-inventing the wheel or writing too much new code since the BLM project already exists and works well.I was wondering if I could just connect a max7221 chip in place of where two 74HC595's on a DOUT module would be and then used the normal MIOS code for writing to a dout module to control it? (as long as I read the max7221 data sheet and sent the appropriate values to control it.... e.g. I may have to write a few of my own functions for it)I could also do all this stuff with just the standard DOUTs but then I lose the ability to easily control the broghtness of each led matrix I drive. I want to use three cascaded max7221 chips to drive an rgb led matrix of 8x8. It is nice that each one only needs a single resistor value to set the brightness of the whole colour.I could also do this with the 74HC595 by pwm the chip enable pin BUT how do I program this into mios? what pin do I use as the pwm output? Should I get a dedicated square wave generator to do this? If so, how do I control it with software? Quote Link to comment Share on other sites More sharing options...
TK. Posted June 1, 2008 Report Share Posted June 1, 2008 Controlling a MAX7221 via DOUT interface requires a lot of programming skills, because you need to know, how to write a "sequential state machine" which controls the register write accesses on each SRIO update cycle. PWM: see this articleHowever, I think, that the application has enough spare pins to drive the chip via GPIOs (only the CS# line should be a dedicated output, all others can be shared).The README describes, how to adapt the pins - it's easy!Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
intellijel Posted June 1, 2008 Author Report Share Posted June 1, 2008 heheh EASY for you! ;)Those pins (from port C) are being used by the AIN module no? (J6 on the core). What other pins could I use as GPIO?With something like Arduino it is so clear what one has assigned to each pin and how those pins will be used. I guess with MIOS I am still getting lost between what has already been pre-allocated in MIOS and what I can override or assign with my C apps. Still hazy on elements of the big picture...Also I don't know what LATC and TRISC are.I assume "shared with other outputs" means that two of those pins can use a port/pins that will also be used for other purposes (they take turns) but the CS pin needs to be dedicated. I may be missing something really obvious or simple about how to integrate this into MB64 or simmilar app that has AIN, DIN and DOUT modules attached to it.thanks! Quote Link to comment Share on other sites More sharing options...
TK. Posted June 1, 2008 Report Share Posted June 1, 2008 With something like Arduino it is so clear what one has assigned to each pin and how those pins will be used. I guess with MIOS I am still getting lost between what has already been pre-allocated in MIOS and what I can override or assign with my C apps. Still hazy on elements of the big picture...I guess, that you missed the pin list: http://www.ucapps.de/mios/mios_pin_list.txtI would propose to start with pin RC4, RC5, RD4 (I guess, that you are not using touch sensors)In order to assign these pins, add following lines to the Makefile:[tt]# include MAX72xx driverMAX72XX_DEFINES += -DMAX72XX_CHAINLENGTH=1MAX72XX_DEFINES += -DMAX72XX_LAT_CS=LATC -DMAX72XX_TRIS_CS=TRISC -DMAX72XX_PIN_CS=4MAX72XX_DEFINES += -DMAX72XX_LAT_SCLK=LATC -DMAX72XX_TRIS_SCLK=TRISC -DMAX72XX_PIN_SCLK=5MAX72XX_DEFINES += -DMAX72XX_LAT_DIN=LATD -DMAX72XX_TRIS_DIN=TRISD -DMAX72XX_PIN_DIN=4include $(MIOS_PATH)/modules/max72xx/max72xx.mk[/tt]LATx and TRISx are described in the PIC datasheet. For you it's probably sufficient to know, that they control the pin output value and tristate driverBtw.: this is how you can add the driver into a C application. I assume that you will do the first experiments in C to save time. I'm currently a bit too lazy to describe the differences between defining constants in assembly (which would be done in main.inc) and in C (where it is done in the makefile)However, the AOUT driver is a nice example which shows the differences (e.g., have a look into the most recent MBSID/MBFM/MBSEQ or MBCV code)All the documentation issues are btw. a big blocking point for me, which prevents me from releasing the programming platform. I fear, all the different possibilities makes it too complicated. :(Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
stryd_one Posted June 2, 2008 Report Share Posted June 2, 2008 There's also an expanded pin list on the wiki... It's pretty much the same, but has some added info.http://www.midibox.org/dokuwiki/mios_pin_listIf you need help adding modules, just shout out. Quote Link to comment Share on other sites More sharing options...
intellijel Posted June 3, 2008 Author Report Share Posted June 3, 2008 I had seen those documents before but I simply forgot them :PThanks a lot for the help guys! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.