Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : 8x8 LED Matrix Orientation
Author | Message | ||||
ion507 Newbie Joined: 05/12/2014 Location: AustraliaPosts: 14 |
G'day All, I've been playing around with 3 of these 8x8 LED displays with MAX7219 drivers for the last few weeks as a larger display for my timer project that can be read across the room. I started off with the demo that ViscomJim put on the forum. Since then I have a program that works to display some graphics or a counter but I want to make sure I have the orientation of the displays correct before it is all mounted in a a case as I saw a few people saying that their displays came up sideways or mirrored with some other demo programs. This is how I have mounted mine: For this setup, connections from the MicroMite come in at the bottom of the left display module. The output from the first module is then fed to the bottom of the unit on the right and repeated. If I do an SPI write &H0101, the top left LED illuminates. Have I got my display upside down? &H0101 turns on the LSB of column 0 according to the datasheet. Is there a convention for feeding the serial data in from the left module or from the right? The software can be modified to suit either but someone must have an idea of how it is usually done. Thanks for members help with my previous queries, I'm slowly getting up to speed with the MicroMite. Cheers, |
||||
MM_Wombat Senior Member Joined: 12/12/2011 Location: AustraliaPosts: 139 |
I had this version running using my maximite v3.2, with a modification to the source code to turn the spi from an 8 bit to 16 bit routine. A Link to that thread. Picture and small video... I'm pretty sure I had the data coming in from the left, and then moving into the next chip on the right, then the next on the right. mytext$=" Maximite by Geoff Graham, MMBasic V3.2 . Program by Dennis Wyatt."
SetPin 18, 2 'set rx pin AS a digital input SetPin 19, 8 'set tx pin AS an output Pin(20) = 1 : SetPin 20, 8 ' set clk pin high THEN set it AS an output Pin(17) = 1 : SetPin 17, 8 'pin 17 will be used AS the enable signal Cls hex1 = 0 : test1 = 0 Option base 0 Dim blink(3) : blink(0)=160 : blink(1)=176 : blink(2)=144 blinker=0 pausetime=51 Dim bcodeHEX(2) : bcodeHEX(0)=0 : bcodehex(1)=4 Dim displaydigit0(1500) ' 250 Characters 6 column wide Dim characters(96,5) GoSub dataread GoSub builddisplaydata leadingzeroes$="000000000000" 'setup chips temp1=&H0900 ' no decode mode temp2=temp1 temp3=temp1 GoSub senddata temp1=&H0b07 ' scan limit temp2=temp1 temp3=temp1 GoSub senddata temp1=&H0A04 'intensity global temp2=temp1 temp3=temp1 GoSub senddata temp1=&H0C81 ' wake up temp2=temp1 temp3=temp1 GoSub senddata Do text$=Inkey$ If text$="3" Then 'test display test1=Not test1 temp1=&H0F00 + test1 temp2=temp1 temp3=temp1 GoSub senddata EndIf If text$="8" Or text$="q" Then 'shutdown temp1=&H0C80 temp2=temp1 temp3=temp1 GoSub senddata If text$="q" Then End EndIf If text$="b" Then 'blink blinker=(blinker + 1) Mod 3 GoSub buildfeature temp2=temp1 temp3=temp1 GoSub senddata EndIf 'write all digits then increment textpos to scroll text temp1=&H0100+displaydigit0(textpos Mod scrollcount) temp2=&H0100+displaydigit0((textpos+8) Mod scrollcount) temp3=&H0100+displaydigit0((textpos+16) Mod scrollcount) GoSub senddata temp1=&H0200+displaydigit0((textpos+1) Mod scrollcount) temp2=&H0200+displaydigit0((textpos+9) Mod scrollcount) temp3=&H0200+displaydigit0((textpos+17) Mod scrollcount) GoSub senddata temp1=&H0300+displaydigit0((textpos+2) Mod scrollcount) temp2=&H0300+displaydigit0((textpos+10) Mod scrollcount) temp3=&H0300+displaydigit0((textpos+18) Mod scrollcount) GoSub senddata temp1=&H0400+displaydigit0((textpos+3) Mod scrollcount) temp2=&H0400+displaydigit0((textpos+11) Mod scrollcount) temp3=&H0400+displaydigit0((textpos+19) Mod scrollcount) GoSub senddata temp1=&H0500+displaydigit0((textpos+4) Mod scrollcount) temp2=&H0500+displaydigit0((textpos+12) Mod scrollcount) temp3=&H0500+displaydigit0((textpos+20) Mod scrollcount) GoSub senddata temp1=&H0600+displaydigit0((textpos+5) Mod scrollcount) temp2=&H0600+displaydigit0((textpos+13) Mod scrollcount) temp3=&H0600+displaydigit0((textpos+21) Mod scrollcount) GoSub senddata temp1=&H0700+displaydigit0((textpos+6) Mod scrollcount) temp2=&H0700+displaydigit0((textpos+14) Mod scrollcount) temp3=&H0700+displaydigit0((textpos+22) Mod scrollcount) GoSub senddata temp1=&H0800+displaydigit0((textpos+7) Mod scrollcount) temp2=&H0800+displaydigit0((textpos+15) Mod scrollcount) temp3=&H0800+displaydigit0((textpos+23) Mod scrollcount) GoSub senddata textpos=textpos+1 ' If textpos =65000 Then textpos=textpos-65000 Pause pausetime If text$="i" Then Print "Please enclose in quotes, for punctuation to be displayed" Input "Enter text "; mytext$ Print Len(mytext$) GoSub builddisplaydata EndIf If text$="p" Then pausetime = (pausetime +10) Mod 200 Print pausetime EndIf Loop senddata: ' rem Pin(17) = 0 'assert the enable line (active low) Timer = 0 junk1 = SPI(18, 19, 20, temp3, H, 0, 16) 'send the command junk1 = SPI(18, 19, 20, temp2, H, 0, 16) 'send the command junk1 = SPI(18, 19, 20, temp1, H, 0, 16) 'send the command tempcount=(tempcount+1) Mod 256 junk2 = SPI(18,19,20,tempcount,H,0,8) Pin(17) = 1 'deselect the slave ' duration=Timer ' datasent1=temp1: datareturned1 = junk1 ' temp = temp1 : junk = junk1 ' datasent=temp : datareturned=junk ' zerotemp$= Right$(leadingzeroes$,16-Len(Bin$(temp))) ' zerojunk$= Right$(leadingzeroes$,16-Len(Bin$(junk))) ' Print " "; zerotemp$+Bin$(temp) ' Print " "; zerojunk$+Bin$(junk) ' Print "Duration = ";duration;" mS" ' Print Hex$(datasent);",";Hex$(datareturned) ' Print "-------------------------" Return buildFeature: temp1=&H0E00 temp1= temp1 Or bcodehex(hex1) temp1= temp1 Or blink(blinker) Return Dataread: For i= 0 To 95 For j= 0 To 4 Read a characters(i,j)= a Next j Next i Return Data &b00000000, &b00000000, &b00000000, &b00000000, &b00000000 ' space Data &b00000000, &b00000000, &b01111001, &b00000000, &b00000000 ' exclamation_mark Data &b00000000, &b01110000, &b00000000, &b01110000, &b00000000 ' double_quotes Data &b00010100, &b01111111, &b00010100, &b01111111, &b00010100 ' hash Data &b00010010, &b00101010, &b01111111, &b00101010, &b00100100 ' dollar_sign Data &b01100010, &b01100100, &b00001000, &b00010011, &b00100011 ' percent Data &b00110110, &b01001001, &b01010101, &b00100010, &b00000101 ' ampersand Data &b00000000, &b01010000, &b01100000, &b00000000, &b00000000 ' apostrophe Data &b00000000, &b00011100, &b00100010, &b01000001, &b00000000 ' left_parenthesis Data &b00000000, &b01000001, &b00100010, &b00011100, &b00000000 ' right_parenthesis Data &b00010100, &b00001000, &b00111110, &b00001000, &b00010100 ' asteriska Data &b00001000, &b00001000, &b00111110, &b00001000, &b00001000 ' plus Data &b00000000, &b00000101, &b00000110, &b00000000, &b00000000 ' comma Data &b00001000, &b00001000, &b00001000, &b00001000, &b00001000 ' minus Data &b00000000, &b00000011, &b00000011, &b00000000, &b00000000 ' full_stop Data &b00000010, &b00000100, &b00001000, &b00010000, &b00100000 ' forward_slash Data &b00111110, &b01000101, &b01001001, &b01010001, &b00111110 ' zero Data &b00000000, &b00100001, &b01111111, &b00000001, &b00000000 ' one Data &b00100001, &b01000011, &b01000101, &b01001001, &b00110001 ' two Data &b01000010, &b01000001, &b01010001, &b01101001, &b01000110 ' three Data &b00001100, &b00010100, &b00100100, &b01111111, &b00000100 ' four Data &b01110010, &b01010001, &b01010001, &b01010001, &b01001110 ' five Data &b00011110, &b00101001, &b01001001, &b01001001, &b00000110 ' six Data &b01000000, &b01000111, &b01001000, &b01010000, &b01100000 ' seven Data &b00110110, &b01001001, &b01001001, &b01001001, &b00110110 ' eight Data &b00110000, &b01001001, &b01001001, &b01001010, &b00111100 ' nine Data &b00000000, &b00110110, &b00110110, &b00000000, &b00000000 ' colon Data &b00000000, &b00110101, &b00110110, &b00000000, &b00000000 ' semicolon Data &b00001000, &b00010100, &b00100010, &b01000001, &b00000000 ' less_than Data &b00010100, &b00010100, &b00010100, &b00010100, &b00010100 ' equals Data &b00000000, &b01000001, &b00100010, &b00010100, &b00001000 ' greater_than Data &b00100000, &b01000000, &b01000101, &b01001000, &b00110000 ' question_mark Data &b00100110, &b01001001, &b01001111, &b01000001, &b00111110 ' at Data &b00111111, &b01000100, &b01000100, &b01000100, &b00111111 ' A Data &b01111111, &b01001001, &b01001001, &b01001001, &b00110110 ' B Data &b00111110, &b01000001, &b01000001, &b01000001, &b00100010 ' C Data &b01111111, &b01000001, &b01000001, &b00100010, &b00011100 ' D Data &b01111111, &b01001001, &b01001001, &b01001001, &b01000001 ' E Data &b01111111, &b01001000, &b01001000, &b01001000, &b01000000 ' F Data &b00111110, &b01000001, &b01001001, &b01001001, &b00101111 ' G Data &b01111111, &b00001000, &b00001000, &b00001000, &b01111111 ' H Data &b00000000, &b01000001, &b01111111, &b01000001, &b00000000 ' I Data &b00000010, &b00000001, &b01000001, &b01111110, &b01000000 ' J Data &b01111111, &b00001000, &b00010100, &b00100010, &b01000001 ' K Data &b01111111, &b00000001, &b00000001, &b00000001, &b00000001 ' L Data &b01111111, &b00100000, &b00011000, &b00100000, &b01111111 ' M Data &b01111111, &b00010000, &b00001000, &b00000100, &b01111111 ' N Data &b00111110, &b01000001, &b01000001, &b01000001, &b00111110 ' O Data &b01111111, &b01001000, &b01001000, &b01001000, &b00110000 ' P Data &b00111110, &b01000001, &b01000101, &b01000010, &b00111101 ' Q Data &b01111111, &b01001000, &b01001100, &b01001010, &b00110001 ' R Data &b00110001, &b01001001, &b01001001, &b01001001, &b01000110 ' S Data &b01000000, &b01000000, &b01111111, &b01000000, &b01000000 ' T Data &b01111110, &b00000001, &b00000001, &b00000001, &b01111110 ' U Data &b01111100, &b00000010, &b00000001, &b00000010, &b01111100 ' V Data &b01111110, &b00000001, &b00001110, &b00000001, &b01111110 ' W Data &b01100011, &b00010100, &b00001000, &b00010100, &b01100011 ' X Data &b01110000, &b00001000, &b00000111, &b00001000, &b01110000 ' Y Data &b01000011, &b01000101, &b01001001, &b01010001, &b01100001 ' Z Data &b00000000, &b01111111, &b01000001, &b01000001, &b00000000 ' left_square Data &b00100000, &b00010000, &b00001000, &b00000100, &b00000010 ' back_slash Data &b00000000, &b01000001, &b01000001, &b01111111, &b00000000 ' right_square Data &b00010000, &b00100000, &b01000000, &b00100000, &b00010000 ' circumflex Data &b10000000, &b10000000, &b10000000, &b10000000, &b10000000 ' underscore Data &b00000000, &b01000000, &b00100000, &b00010000, &b00000000 ' grave_accent Data &b00000010, &b00010101, &b00010101, &b00010101, &b00001111 ' a Data &b01111111, &b00001001, &b00001001, &b00001001, &b00000110 ' b Data &b00001110, &b00010001, &b00010001, &b00010001, &b00010001 ' c Data &b00000110, &b00001001, &b00001001, &b00001001, &b01111111 ' d Data &b00001110, &b00010101, &b00010101, &b00010101, &b00001101 ' e Data &b00000000, &b00001000, &b00111111, &b01001000, &b00100000 ' f Data &b00001001, &b00010101, &b00010101, &b00010101, &b00011110 ' g Data &b01111111, &b00001000, &b00001000, &b00001000, &b00000111 ' h Data &b00000000, &b00000000, &b00101111, &b00000000, &b00000000 ' i Data &b00000010, &b00000001, &b00000001, &b01011110, &b00000000 ' j Data &b00000000, &b01111111, &b00000100, &b00001010, &b00010001 ' k Data &b00000000, &b01000001, &b01111111, &b00000001, &b00000000 ' l Data &b00011111, &b00010000, &b00001110, &b00010000, &b00011111 ' m Data &b00011111, &b00001000, &b00010000, &b00010000, &b00001111 ' n Data &b00001110, &b00010001, &b00010001, &b00010001, &b00001110 ' o Data &b00011111, &b00010100, &b00010100, &b00010100, &b00001000 ' p Data &b00001000, &b00010100, &b00010100, &b00010100, &b00011111 ' q Data &b00011111, &b00001000, &b00010000, &b00010000, &b00001000 ' r Data &b00001001, &b00010101, &b00010101, &b00010101, &b00010010 ' s Data &b00010000, &b00010000, &b01111110, &b00010001, &b00010010 ' t Data &b00011110, &b00000001, &b00000001, &b00000001, &b00011110 ' u Data &b00011100, &b00000010, &b00000001, &b00000010, &b00011100 ' v Data &b00011110, &b00000001, &b00000110, &b00000001, &b00011110 ' w Data &b00010001, &b00001010, &b00000100, &b00001010, &b00010001 ' x Data &b00010000, &b00001001, &b00000110, &b00001000, &b00010000 ' y Data &b00010001, &b00010011, &b00010101, &b00011001, &b00010001 ' z Data &b00001000, &b00110110, &b01000001, &b01000001, &b00000000 ' leftcurly Data &b00000000, &b00000000, &b01111111, &b00000000, &b00000000 ' vertline Data &b00000000, &b01000001, &b01000001, &b00110110, &b00001000 ' rightcurly Data &b00000100, &b00001000, &b00001000, &b00001000, &b00010000 ' tilde Data &b01111111, &b01000001, &b01000001, &b01000001, &b01111111 ' del buildDisplayData: scrollcount=0 textpos=0 For k=1 To Len(mytext$) chartext=Asc(Mid$(mytext$,k,1)) chartext=chartext-32 displaydigit0((k-1)*6)=characters(chartext,0) displaydigit0((k-1)*6+1)=characters(chartext,1) displaydigit0((k-1)*6+2)=characters(chartext,2) displaydigit0((k-1)*6+3)=characters(chartext,3) displaydigit0((k-1)*6+4)=characters(chartext,4) If chartext=63 Then displaydigit0((k-1)*6+5)=&b10000000 Else displaydigit0((k-1)*6+5)=0 EndIf scrollcount=scrollcount+6 Next k displaydigit0(scrollcount+0)=0 displaydigit0(scrollcount+1)=0 displaydigit0(scrollcount+2)=0 displaydigit0(scrollcount+3)=0 displaydigit0(scrollcount+4)=0 displaydigit0(scrollcount+5)=0 scrollcount=scrollcount+6 Return I haven't looked at this code for the MaxiMite for 2 years, so my memory ain't as good as it used to be. I haven't looked at a micromite yet. Keep plugging away, it is fun learning But can be expensive (if you keep blowing things up). Maximite, ColourMaximite, MM+ |
||||
Print this page |