Bi-Color matrix

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Sat Sep 22, 2012 12:27 am

Am trying to get the const arrays to tell the PIC which row and colum to tune on but can't seem to get it working. Am reviewing several different codes as well as looking at the Tetris code that Grham Mitchel wrote. Now theres a guy that knows how to write code.
Just putting along with a short basic const array code but have yet to get the WHILE TRUE loop to get the right data. Like I stated I have cut the code down to basics, bare bones.

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by brad » Sat Sep 22, 2012 8:40 am

Have you had a look at the code that I used for Super Pixel Bros to drive a matrix?

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Sat Sep 22, 2012 11:14 pm

Not yet but will go look at it.
And I eliminated the GHOSTING. Making some progress but still working on wHY the CONST arrays are not working as planned.

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by brad » Sun Sep 23, 2012 9:38 am

Can you post a photo or perhaps a video of what is happening?

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Sun Sep 23, 2012 2:11 pm

Getting late (10pm here and the dog wants to go to bed as well as me and my wife)
The dog knows when its 10pm every night.
Will post a video and progress I have made with the code.
Got the porta working just fine but when it drops down to portB look out!!

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Sun Sep 23, 2012 9:54 pm

Here is a video. The leds continue to turn on but convulated order after the sub end?
http://s992.photobucket.com/albums/af44 ... bf2046.mp4

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Sun Sep 23, 2012 9:57 pm

here is the matrix grid
Attachments
port graph.png
port graph.png (53.7 KiB) Viewed 21752 times

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Sun Sep 23, 2012 10:01 pm

forgot to add code

Code: Select all

{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : Doug Bezaire                                *
*  Notice  : Copyright (c) 2011 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 4/7/2011                                                       *
*  Version : 1.0                                                            *
*  Notes   :    data file 4/7/2011                                                            *
*          :                                                                *
*****************************************************************************
}
'device and clock
Device = 18F4520
Clock = 20
//Config OSC = INTIO67                // Use the Internal Oscillator
 

 



'*********************************************************************
'Compiler directives like oscillator settings


'*********************************************************************
'#Options for include statements - must be before include statements




'*********************************************************************
'Includes


Include "utils.bas"



'*********************************************************************
'Dimension Statements (variable and constants
//                        row 3     row 2& 4   rows 1 & 5    row 1,2,4,5  all rows                stp
Const Rows(7) As Byte = (%00000001, %00000010,  %000100,   %0001000,   %000010000, %00100000, %10000000 ) // Active RowPort pins for each section of the arrow
Const Brow(7) As Byte = (%00000001, %00000010,  %000100,   %0001000,   %000010000, %00100000, %10000000 )
//                     7 colums from right to left                                                  
Const Col(7) As Byte = (%000010001, %00001010, %00000100, %000001010, %00000100, %00100000, %11100000)  // Active ColPort pin for each section of the arrow
Const ColB(7) As Byte =(%000010001, %00001010, %00000100, %000001010, %00000100, %00100000, %11100000) 
 //                       col3         col4       col5
 Const stp(8) As Byte = (%00000000, %00001110, %00010001,%00010001,%00010001,%00010001,%00001110, %00000000)        




Dim row As PORTA               // portA 0-3
Dim row_tris As TRISA
Dim colm As PORTC              //portc 0 - 4
Dim colm_tris As TRISC
Dim rowB As PORTB             // portB 0-3
Dim rowB_tris As TRISB
Dim count As Word
Dim i As Byte
Dim x As Byte
//DIM x AS BYTE
//dim col as byte
'*********************************************************************
'Subroutines and functions

 //RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
Sub right()
// get port data
  For x = 0 To 7
  row=Rows(x) 
  colm=Col(x)
  rowB=Brow(x)
   // NOTE the matrix is viewed for testing w/ pin 1 lower left hand corner
  Next
  colm=Col(0) // colums 0 to 4 left to right
  row = Rows(0) //rows 0 to 6 top to bottom
  DelayMS(1000)
  
  colm=Col(1)
  row = Rows(1)
  DelayMS(1000)
  
  colm=Col(2)
  row = Rows(2)
   DelayMS(1000)
   
  colm=Col(3)
  row = Rows(3)
   DelayMS(1000)

  colm=Col(0)          
  rowB = Brow(4)
  DelayMS(1000)
  
  rowB_tris = 0  // enable portB
  
  colm=ColB(1)
  rowB = Brow(5)
  DelayMS(1000)
 
  
  colm=ColB(2)
  rowB = Brow(6)
  DelayMS(1000)
 
  colm=ColB(3)  
  rowB = Brow(2)
  DelayMS(1000)
  
  colm=ColB(4)          
  rowB = Brow(3)
  DelayMS(1000)
  portb=0
  porta=0
  portc = 0
 
End Sub
//RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR


//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'Notice Function name, code steps, function end. Indenting shows what's contained 'inside the function or subroutine

'Note: If any subroutine calls another subroutine or function, the called sub or
'      function must be placed first in the listing


'*********************************************************************
'Program initialization - only gets done once. Define initial variable conditions and etc.
colm = 0
row = 0
rowB = 0
row_tris = 0
colm_tris = 0
//rowB_tris = 0
count = 0
//x=100

'Note: The above happens only once when the program initializes.


'*********************************************************************
'Main program loop.  This continues forever
// Start Of Program...
//OSCCON = %01111111                  // Sets up the internal oscillator
SetAllDigital                       // Make all Pins digital I/O's
PORTA=%00000000
PORTB=%00000000
PORTC=%00000000
PORTD=%00000000
While true

      For count = 0 To 8    // this is to loop it long enough
right()
DelayMS(2000)

 Next
 
 Wend


'Note: the above goes on forever.  This is the main program and all action
'      is directed from within this loop
 //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx          
   
  

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by brad » Mon Sep 24, 2012 7:35 am

I was just having a look at your arrays and have noticed that they are all over the place in that they have varying numbers of bits in them. These are your arrays:

Code: Select all

Const Rows(7) As Byte = (%00000001, %00000010,  %000100,   %0001000,   %000010000, %00100000, %10000000 )
Const Brow(7) As Byte = (%00000001, %00000010,  %000100,   %0001000,   %000010000, %00100000, %10000000 )                                             
Const Col(7) As Byte = (%000010001, %00001010, %00000100, %000001010, %00000100, %00100000, %11100000)
Const ColB(7) As Byte =(%000010001, %00001010, %00000100, %000001010, %00000100, %00100000, %11100000) 
Const stp(8) As Byte = (%00000000, %00001110, %00010001,%00010001,%00010001,%00010001,%00001110, %00000000)
And here they are again but one byte per line (see how they vary in bits)

Code: Select all

Const Rows(7) As Byte = (
%00000001, 
%00000010,  
%000100,   
%0001000,   
%000010000, 
%00100000, 
%10000000 )
Const Brow(7) As Byte = (
%00000001, 
%00000010,  
%000100,   
%0001000,   
%000010000, 
%00100000, 
%10000000 )                                             
Const Col(7) As Byte = (
%000010001, 
%00001010, 
%00000100, 
%000001010, 
%00000100, 
%00100000, 
%11100000)
Const ColB(7) As Byte =(
%000010001, 
%00001010, 
%00000100, 
%000001010, 
%00000100, 
%00100000, 
%11100000) 
Const stp(8) As Byte = (
%00000000, 
%00001110, 
%00010001,
%00010001,
%00010001,
%00010001,
%00001110, 
%00000000)
I'd first correct that, then if you could show me which are your cathodes and anodes I will be able to write your code out and see how I can help some more.

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Mon Sep 24, 2012 11:09 am

Maybe I have the bits wrong but the first 4 displays are right as for an arrow RA0 - RA3
00010001 00001001 00001000 00010001
second arrow

the arrow is supposed to scroll across the 5 x 7 matrix. Each port has 8 bit? with each 0 or 1 being that pin is HIGH or LOW?
0 0 0 1 0 0 0 1
RA7 RA6 RA5 RA4 RA3 RA2 RA1 RA0 I am hoping this is correct method?
I think I got this right for what I am attempting to do seeing how I have had no schooling in writing code BUT I subscribed to John Mans PIC C COURSE for half price. Maybe I can grasp proper coding.
This project is my second in actually writing the entire code using code examples and trying different things out. I found that without inserting the TRISC where I did (when portB is to start displaying) nothing from portC is displayed. Tried inserting else where but then everything is jumbled up. As it is now the first four rows display correctly.
Attachments
Matrix led layout.png
Matrix led layout.png (148.67 KiB) Viewed 21740 times

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by brad » Tue Sep 25, 2012 8:55 pm

Perhaps some of my code might help.

Here is some code that I wrote a while ago for a Merry Christmas message on a RED/GREEN 8x8 led matrix.

If you have any questions with the code, let me know!

Code: Select all


Device = 18F45K20           ' Tell the compiler what chip we are using
Clock = 8                  ' Tell the compiler what we will be setting the clock to (in Mhz)           
Config MCLRE = OFF          
Config FOSC = intio67       ' Internal oscillator, IO on pins 6 and 7

Include "utils.bas"

' Array Constants
Const RedDataMerryChristmas(107) As Byte = (%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%11111110,%00000100,%00011000,%00000100,%11111110,%00000000,%11111110,%10010010,%10010010,%10000010,%00000000,%11111110,%00010010,%00010010,%11101100,%00000000,%11111110,%00010010,%00010010,%11101100,%00000000,%00000110,%00001000,%11110000,%00001000,%00000110,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000)
Const GreenDataMerryChristmas(107) As Byte = (%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111100,%10000010,%10000010,%01000100,%00000000,%11111110,%00010000,%00010000,%11111110,%00000000,%11111110,%00010010,%00010010,%11101100,%00000000,%10000010,%11111110,%10000010,%00000000,%01001100,%10010010,%10010010,%01100100,%00000000,%00000010,%11111110,%00000010,%00000000,%11111110,%00000100,%00011000,%00000100,%11111110,%00000000,%11111100,%00010010,%11111100,%00000000,%01001100,%10010010,%10010010,%01100100,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000)

' variables
Dim x As Byte
Dim GreenBuffer(8) As Byte
Dim RedBuffer(8) As Byte
Dim ScrollingTextOffset As Word
Dim ScrollingTextSpeed As Byte

' port setup
Dim RedLEDs As PORTD
Dim GreenLEDs As PORTB
Dim Anodes As PORTC

'sub routines
Sub UpdateScrollingText()
    If ScrollingTextSpeed <> 0 Then
        Dec(ScrollingTextSpeed)
    Else
        ScrollingTextSpeed = 60 
        Inc(ScrollingTextOffset)
        If ScrollingTextOffset > (Bound(GreenDataMerryChristmas) - 8) Then ' we need to check if we have reached the start of the last eight columns of data that's why we take away 8
            ScrollingTextOffset = 0
        EndIf
    EndIf         
End Sub

Sub SaveGraphics()
    For x = 0 To 7
        GreenBuffer(x) = GreenDataMerryChristmas(x + ScrollingTextOffset)
        RedBuffer(x) = RedDataMerryChristmas(x + ScrollingTextOffset)
    Next
End Sub

Sub DisplayGraphics()
    For x = 0 To 7
        GreenLEDs = GreenBuffer(x) Xor %11111111    ' we need to XOR the data so that we invert them (because we are sending the data to cathodes, not anodes)
        RedLEDs = RedBuffer(x) Xor %11111111
        Anodes.bits(x) = 1  ' turn on the row of anodes
        DelayMS(1)
        Anodes.bits(x) = 0  ' turn off the row of anodes
    Next
End Sub

// Start Of Program
SetAllDigital

TRISA = %00000000           ' PORTA outputs except pin 0 (which is the button input)
TRISB = %00000000           ' PORTB outputs
TRISC = %00000000           ' PORTC outputs
TRISD = %00000000           ' PORTC outputs
TRISE = %00000001           ' PORTC outputs

OSCCON = %01110000          ' Internal oscillator running at 8mHz
OSCTUNE.bits(6) = 1         ' enable PLL so we can run this thing at 32Mhz

GreenLEDs = %00000000
RedLEDs = %00000000 
Anodes = %00000000

ScrollingTextOffset = 0
scrollingtextspeed = 60

// Main Loop
While True()                        // This creates an infinite loop
    UpdateScrollingText  
    SaveGraphics
    DisplayGraphics                                     
Wend                                // Loop back to the while loop as long as we havent finished.


MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Tue Sep 25, 2012 10:16 pm

THANKS
I printed it out and now to go get a cup of coffee and study it.
Oh yea when are you going to release the schematic etc for that project. I have never been able to locate any files for the project.
Been to instructables but file links are for DIPTRACE download.

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Wed Sep 26, 2012 5:42 am

I printed out your code and I see what it is doing so I am rewriting my code using your example.
QUESTION why are you in the sub DisplayGraphics() did you Xor the outputs. Would it not have been easier? to just take all of portB low instead of making them HIGH then Xor?
there must be a reason that I am missing.

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by MrDEB » Wed Sep 26, 2012 2:01 pm

I changed your code around to suit the 5 x 7 matrix but it is not condussive to what it should be.
The matrix rows (0-6 anodes) progress down but the 5th one doesn't light and only the 3rd (0-4) colums(cathodes) light up.
Been changing the anodes_B math but all I get is heartache LOL.
It appears the Red_leds data is not being read?
will hack at it some more but it is looking better as it goes from top to bottom smoothly.
Oh one other thing, the last two LEDs in the 3 colum come on at a faster rate, seems like the delayms(500) is shorter.
I have noticed I have been finding my mistakes faster than I used to. Guess I am learning something. Maybe because I am not being belittled like I was over at that other web site--LOL

Code: Select all

{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : Doug Bezaire                                *
*  Notice  : Copyright (c) 2011 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 4/7/2011                                                       *
*  Version : 1.0                                                            *
*  Notes   :    data file 4/7/2011                                                            *
*          :                                                                *
*****************************************************************************
}
'device and clock
Device = 18F4520
Clock = 20
//Config OSC = INTIO67                // Use the Internal Oscillator
 

 



'*********************************************************************
'Compiler directives like oscillator settings


'*********************************************************************
'#Options for include statements - must be before include statements




'*********************************************************************
'Includes


Include "utils.bas"



'*********************************************************************
'Dimension Statements (variable and constants
//                        row 3     row 2& 4   rows 1 & 5    row 1,2,4,5  all rows                stp
Const Rows(7) As Byte = (%00000001, %00000010,  %000100,   %0001000,   %00010000, %00100000, %10000000 ) // Active RowPort pins for each section of the arrow
//Const Brow(7) As Byte = (%00000001, %00000010,  %000100,   %0001000,   %000010000, %00100000, %10000000 )
//                     7 colums from right to left                                                  
Const RedDataCol(7) As Byte = (%000010001, %00001010, %00000100, %000010000, %00000100, %00000100, %00001100)  // Active ColPort pin for each section of the arrow
Const GreenDataCol(7) As Byte =(%000010001, %00001010, %00000100, %000001010, %00000100, %00100000, %11100000) 
 //                       col3         col4       col5
 Const stp(8) As Byte = (%00000000, %00001110, %00010001,%00010001,%00010001,%00010001,%00001110, %00000000)        


' variables  
Dim count As Word
Dim x As Byte
//dim GreenBuffer(7) as byte  // green data location
dim RedBuffer(7) as byte    // red data location
dim Arrow_Speed as byte     //2 scrolling speed across the display
dim Scrolling_Arrow as word    //1 arrow graphic 

'set up ports
Dim row_A As PORTA          // portA 0-3     
Dim row_B As PORTB          //portB 0 - 2
Dim Red_leds As PORTc
//dim Green_leds as portd              
dim anodes_A as porta
dim anodes_B as portb

           




'*********************************************************************
'Subroutines and functions

 //RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
sub UpdateScrollSpeed() 
if Arrow_Speed <>0 then
   dec(Arrow_Speed)
else
   Arrow_Speed = 60
   inc (Scrolling_Arrow)
   if Scrolling_Arrow >(bound(RedDataCol)-6) then
   Scrolling_Arrow = 0
   endif
   endif
end sub
   
 
sub SaveGraphics()
    for x = 0 to 6           // increment the const array data and save
    RedBuffer(x) = RedDataCol (x + Scrolling_Arrow )  // load const arrays
  //  GreenBuffer(x) = GreenDataCol(+ Scrolling_Arrow)
    next 
end sub 

sub DisplayGraphics()
    for x = 0 to 6
       Red_leds = RedBuffer(x) Xor %11111111
    //   Green_leds = GreenBuffer(x)  Xor %11111111       // change to lows
       if x <=3 then 
       Anodes_A.bits(x) = 1  //turn on portA rows  0 - 3
       delayms(500)
       Anodes_A.bits(x) = 0
       else
       Anodes_B.bits(x-4) = 1  //turn on portB  rows 4-6
       end if
       delayms(500)
       Anodes_B.bits(x-4) = 0
    next
    end sub
      
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'Notice Function name, code steps, function end. Indenting shows what's contained 'inside the function or subroutine

'Note: If any subroutine calls another subroutine or function, the called sub or
'      function must be placed first in the listing


'*********************************************************************
'Program initialization - only gets done once. Define initial variable conditions and etc.

SetAllDigital                       // Make all Pins digital I/O's

trisa = %00000000
trisb = %00000000
trisc = %00000000
trisd = %00000000

'Note: The above happens only once when the program initializes.


'*********************************************************************
'Main program loop.  This continues forever
// Start Of Program...
 Red_leds = %00000000
// Green_leds = %00000000
 Anodes_A = 0
 Anodes_B = 0 
 Red_leds = 0

 Arrow_Speed =0     //2 scrolling speed across the display
 Scrolling_Arrow = 0   // arrow graphic

While true()

     // For count = 0 To 8    // this is to loop it long enough
      UpdateScrollSpeed
      savegraphics()
      displaygraphics()

DelayMS(2000)
 //stop

 
 Wend


'Note: the above goes on forever.  This is the main program and all action
'      is directed from within this loop
 //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx          
   
  

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bi-Color matrix

Post by brad » Wed Sep 26, 2012 9:43 pm

MrDEB wrote:I printed out your code and I see what it is doing so I am rewriting my code using your example.
QUESTION why are you in the sub DisplayGraphics() did you Xor the outputs. Would it not have been easier? to just take all of portB low instead of making them HIGH then Xor?
there must be a reason that I am missing.
The reason for this is because it is much easier to think about an LED lighting up when you send a logic 1 to it (rather than a 0) so all I need to do is go about making the code and drawing the text and graphics with logic 1's as on and 0's as off, and then as I am sending the data to the matrix I just add a super simple line of code that inverts the data for me :)

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 2 guests