Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

bi color matrix

Status
Not open for further replies.

MrDEB

Well-Known Member
trying to implement a bi color led matrix but my code won't switch from GREEN to RED.
portd = GREEN colums while portC = RED
using a common cathode (Knigbright TBC40-11EGWA)
All the leds work but the 7 rows (anodes) are using portA.0-A.3 & portB.0 - B.3
tried designating different colum dsignations for the RED and GREEN but to no avail.
Presently just working on the RIGHT sub
must be a better way to mix different port output bits
Code:
device and clock
 Device = 18f4520
Clock = 20 // 20mhz clock




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 ColG(7) As Byte = (%00000100, %00001010,  %00010001,   %00011011,   %00100001, %11111111, %00011100 ) // Active RowPort pins for each section of the arrow
Const ColR(7) As Byte = (%00000100, %00001010,  %00010001,   %00011011,   %00100001, %11111111, %00011100 ) // Active RowPort pins for each section of the arrow
//                     7 colums from right to left                                                  
Const Rows(7) As Byte = (%00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01100000)  // Active ColPort pin for each section of the arrow
 //                       col3         col4       col5
 Const stp(8) As Byte = (%00000000, %00001110, %00010001,%00010001,%00010001,%00010001,%00001110, %00000000)        




Dim row As PORTA
Dim row_tris As TRISA      //trisx to make all outputs
Dim rowB As PORTB
Dim rowB_tris As TRISB
Dim colmC As PORTC
Dim colmC_tris As TRISC     //red
Dim colmD As PORTD
Dim colmD_tris As TRISD     //green
Dim count As Word
Dim i As Byte

//DIM x AS BYTE
//dim col as byte
'*********************************************************************
'Subroutines and functions


 //RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
Sub right()

 
  For i = 0 To 6  // this is to loop it long enough
                    // to see it
  colmc=ColR(3)
  row = Rows(1)
 // rowB=Rows(0)
  DelayMS(3000)
  Next

  //colmD=Col(i)          
  //row = Rows(1)
  //DelayMS(1000)
 
  // colmD=Col(i)          
  //row = Rows(2)
  //DelayMS(1000)
End Sub
//RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

//LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL  
Sub left()

 
  For i = 7 To 0 Step -1   // this is to loop it long enough
                    // to see it
  colmd=Colg(0)
  row = Rows(1)
  DelayMS(70)
  Next

  colmD=ColG(1)          
  row = Rows(1)
  DelayMS(70)
  //next
   colmD=ColG(2)          
  row = Rows(4)
  DelayMS(70)
End Sub
//LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Sub stop()

 
  For i = 0 To 7   // this is to loop it long enough
                    // to see it
  colmD= %01111110     // L/R sides of stop sign    %01100010
  row = %00011110
  DelayMS(10)
 
  colmD= %00011100        //TOP BOTTOM of sign
  row = %01100001
 
  DelayMS(10)
  //NEXT
  //   FOR i = 0 TO 10
      colmD= %000100010
      row = %0000100001
      DelayMS(10)
      colmD= %00010100
      row = %00001010
      DelayMS(10)
 
      colmD= %00001000
      row = %00000100
      DelayMS(100)
 
      Next
  // row = Rows(4)  //%00110001

 // colm=stp(1)          
 // row = Rows(6)
  //DELAYMS(1000)
 // 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.
colmD= 0
row = 0
row_tris = 0
colmD_tris = 0
count = 0
//x=100

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


'*********************************************************************
'Main program loop.  This continues forever

While true
 setalldigital
      For count = 0 To 20    // this is to loop it long enough
left()
DelayMS(2000)
 //stop
 Next
 Wend
 {    
 FOR count = 0 TO 20
 left
 DELAYMS(100)
 NEXT

  FOR count = 0 TO 20  
 stop
 DELAYMS(100)
 NEXT                
 WEND
 
    }

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

can't help but feel that a FOR NEXT loop would shorten this up?
this is just the sub routine.
Code:
Sub right()

 
  
   Red_led=ColR(0) //row 1
   row = Rows(0)
        
   DelayMS(2000)
   Red_led=ColR(1) //row 2
   row = Rows(1)
   
   DelayMS(2000)  
   Red_led=ColR(2)  //row 3
   row = Rows(2)
   
    DelayMS(2000)   
   Red_led=ColR(3) //row 4
   row = Rows(3)
   
    DelayMS(700)       //clear porta rows 
    Red_led=ColR(0)
    row = Rows(4)
   
    Red_led=ColR(4)   //row 5 
    rowB = RowsB(0)   
 
   
    
   
    DelayMS(700)       //row 6
   Red_led=ColR(5)
   rowB = RowsB(1)
   
    DelayMS(700)       //row 7
    Red_led=ColR(6)
    rowB = RowsB(2)
    DelayMS(700)
    rowB = RowsB(3)   //clear bits   
     
    
 
 


 
  

  DelayMS(1000)

 
End Sub
 
I screwed up a wet dream!!

I cleaned up my code but somewhere I screwed up because it fails to work now.
Back to the drawing board
Code:
{
*****************************************************************************
*  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 // 20mhz clock
'*********************************************************************
'Compiler directives like oscillator settings
'*********************************************************************
'#Options for include statements - must be before include statements

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


Include "utils.bas"

'*********************************************************************
'Dimension Statements (variable and constants
//                        colum 3    colum 2&4   colum 1 & 5   colum 1,2,4,5         all colum                stp
Const ColG(7) As Byte = (%00010001, %00010010,  %00000100,   %00011011,   %00100001, %11111111, %00011100 ) // Active RowPort pins for each section of the arrow
  
Const RowsB(4) As Byte = (%00000001, %00000010, %00000100, %00000000 )  // Active ColPort pin for each section of the arrow

Const ColR(7) As Byte = (%00010001, %000010010,  %00000100,   %00011011,   %00100001, %11111111, %00000000 ) // Active RowPort pins for each section of the arrow
Const Rows(7) As Byte = (%00000001, %00000010,  %00000100,   %0001000,   %00000000, %0000010, %0000100 )

// NOTE matrix has pin 1 in bottom left corner for test viewing
//                    rows from left to right                                                  



 //                       col3         col4       col5
 Const stp(8) As Byte = (%00000000, %00001110, %00010001,%00010001,%00010001,%00010001,%00001110, %00000000)        




Dim row As PORTA
Dim row_tris As TRISA      //trisx to make all outputs
Dim rowB As PORTB
Dim rowB_tris As TRISB
Dim Green_led As PORTC
Dim Green_led_tris As TRISC     //red
Dim Red_led As PORTD
Dim Red_led_tris As TRISD     //green

Dim count As Word
Dim i As Byte
Dim x As Byte

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


 //RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
Sub right()

 
  
  
 
 
 
   Red_led=ColR(0) //row 1
   row = Rows(0)
 
   DelayMS(2000)
   Red_led=ColR(1) //row 2
   row = Rows(1)
 
   DelayMS(2000)  
   Red_led=ColR(2)  //row 3
   row = Rows(2)
 
    DelayMS(2000)   
   Red_led=ColR(3) //row 4
   row = Rows(3)
 
    DelayMS(700)       //clear porta rows 
    Red_led=ColR(0)
    row = Rows(4)
 
    Red_led=ColR(4)   //row 5 
    rowB = RowsB(0)   
 
 
 
 
    DelayMS(700)       //row 6
   Red_led=ColR(5)
   rowB = RowsB(1)
 
    DelayMS(700)       //row 7
    Red_led=ColR(6)
    rowB = RowsB(2)
    DelayMS(700)
    rowB = RowsB(3)   //clear bits   
 
 
 
 
 
 
 
 
 
  DelayMS(1000)
 
 
End Sub
//RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

//LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL  
Sub left()

 
  

 
  
   Red_led=ColR(0) //row 1
   row = Rows(0)
        
   DelayMS(2000)
    Red_led=ColR(1) //row 2
   row = Rows(1)
   
   DelayMS(2000)  
   Red_led=ColR(2)  //row 3
   row = Rows(2)
   
    DelayMS(2000)   
   Red_led=ColR(3) //row 4
   row = Rows(3)
   
    DelayMS(700)       //clear porta rows 
    Red_led=ColR(0)
    row = Rows(4)
   
   Red_led=ColR(4)   //row 5 
   rowB = RowsB(0)   
 
   DelayMS(700)       //row 6
     Red_led=ColR(5)
   rowB = RowsB(1)
   
    DelayMS(700)       //row 7
     Red_led=ColR(6)
   rowB = RowsB(2)
    DelayMS(700)
     rowB = RowsB(3)   //clear bits   
     
    
 
 


  DelayMS(1000)

End Sub
//RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
End Sub
//LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Sub stop()

 
  For i = 0 To 7   // this is to loop it long enough
                    // to see it
  Green_led= %01111110     // L/R sides of stop sign    %01100010
  row = %00011110
  DelayMS(10)
 
 Green_led= %00011100        //TOP BOTTOM of sign
  row = %01100001
 
  DelayMS(10)
  //NEXT
  //   FOR i = 0 TO 10
       Red_led= %000100010
      row = %0000100001
      DelayMS(10)
      Green_led= %00010100
      row = %00001010
      DelayMS(10)
 
     Green_led= %00001000
      row = %00000100
      DelayMS(100)
 
      Next
  // row = Rows(4)  //%00110001

 // colm=stp(1)          
 // row = Rows(6)
  //DELAYMS(1000)
 // 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.

row = 0
row_tris = 0
rowB =0
rowB_tris = 0
Red_led = 0
Green_led = 0
Red_led_tris = 0
Green_led_tris = 0
count = 0


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


'*********************************************************************
'Main program loop.  This continues forever

While true
 SetAllDigital
      For count = 0 To 20    // this is to loop it long enough
right()
DelayMS(1000)
 //stop
 Next
 Wend

'Note: the above goes on forever.  This is the main program and all action
'      is directed from within this loop
 //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
MrDEB, have you ever actually tried programming for yourself? You know, where you understand the commands and how to use them? From everything I've seen, all you do is copy example code and hope to hell it works.
 
The code I posted is what I wrote about a year or two ago. Self aught in programing but slow process in learning. I admit I do alot of trial and error but making progress. As far as copy n paste, yes but very little after I have learned what works and what doesn't. Its a learning process of learn by doing. Copy some code then make small changes to find out what makes it tick.
In this latest project I sorted out why my posted code doesn't seem to work as desired. Corrected it last night now on to getting it to scroll across the matrix. Got the wild idea to mix the red and green leds on same display but first want to investigate weather I can mix PortA with PortB in a more harmonious method.
 
It appears that you called 'right()' but you didn't call 'left()'

Could that be the issue? :p
 
I am just using the sub routine right() for developing the code to depict the desired graphic. the right() and the left() display are using the same const but in opposite directions.
The "graphic" is an arrow The problem is combining portA data with portB data bits (const () ).
Been studing how other codes do this but have yet to solve. Making progress as portA data works as desired but getting portB to continue the same data.
investigating using pbyte.
 
Mrdeb you can alias the ports to the const but you have to
Relize that the code is top down. So if you run one part in
A loop the next part runs after which probably not going to
Do what you want
 
code autoposy

I took a code that I am using to test port/LEDs and took in apart and discovered several things.
I was getting GHOSTING on some LEDs that were not supposed to be on. Put the PORTA=0 etc in and no ghosting. Kinda got the code to work. Using only the test() sub routine. I get LEDs that turn blink in sequence from top down (rows 0-3)
BUT the const for Red_Data (colums 0 to 4 Left to Right) has no effect. The LEDs blink sequentially in colum 3 only regardless what number I use for Red_Data(x)
This is a 5 x 7 bi color matrix common cathode driven by UNL2803 so both the row and colum pins must be HIGH
Read what Bebe posted but
alias the ports to the const but you have to
Relize that the code is top down.
???
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 9/19/2012                                                      *
*  Version : 1.0                                                            *
*  Notes   :brads suggestion 9/19/2012                                                                *
*          :                                                                *
*****************************************************************************
}
Device=18f4520
Clock = 20
Config MCLRE = Off
'*********************************************************************
'Includes


Include "utils.bas"



'*********************************************************************
'Dimension Statements (variable and constants

Dim row As PORTA    // colums 0 to 3 and portb = 4 to 4 to 7 
//Dim rowB As PORTB
Dim red As PORTc   //colum  1 to 7
//Dim green As PORTD
Dim count As Word
Dim x As Byte
//
Const Red_Data(5) As Byte =   (%00000001, %00000011, %00000111 ,%00001111, %00011111)// 5 colums left to right
//Const green_data(7) As Byte = (%00000001, %00000011, %00000111 ,%00011111, %00111111, %01111111, %01111111)
Const R_ows(7) As Byte =      (%00000001, %00000011, %00000111 ,%00001111, %00011111, %01111111, %0000000)// 7 rows top to bottom

Sub test()
    
     For x = 0 To 3            // increment rows  top to bottom
     red = Red_Data(0)         // colum designation
     //row = 1         // colums data increment
     //row = R_ows(x)            // get row data
     delayms(500)
    // row = R_ows(6)            // clear the rows
    // If x<= 3 Then
     PORTA.bits(x)=1   //enable one row of cathodes  enable portA-0,1,2,3
     DelayMS(500)
    // Else 
    // PORTB.bits(x-4)=1  // enable one row of cathodes portB 0,1,2
    // DelayMS(1000)
    // EndIf
    // DelayMS(3000)
    porta = 0
    portb = 0
    portc = 0
    portd = 0
    
   Next
    
End Sub
sub right()
   for x = 0 to 3
    red =Red_Data(1) 
    row = 1
    delayms(1000)
   
    delayms(1000)
  next
porta = 0  
portb = 0
portc = 0
portd = 0
end sub
TRISA = %00000000
TRISB = %00000000
TRISC = %00000000       // set ports as outputs
TRISD = %00000000

red = 0 //disable all cathodes

//green = 0 // disable all cathodes

count = 0
SetAllDigital
red = 0
row = 0
portb = 0
portc = 0
porta = 0
portd=0
While true
 For count =0 To 20    // run 21 times
 test()                // sub call
 DelayMS(1000)
 Next Wend
 
Looking at your code, I can't help but wonder if you have any clue about how the LED matrix display works?

It may look like many of the LEDs are illuminated at the same time, but only the LEDs in one column are illuminated at a given time. The columns are scanned fast enough so that the LEDs appear on to your eyeball. There's nothing magic about your CONSTANT data - it's just which LEDs are on in a given column.

You can cut and paste and "hack" all you want but if you don't understand how a matrix display works (to say nothing of the rest of the Basic commands), you're as likely to come up with something that works as a room full of monkeys.

Programming requires a bit more than copy and pasting. Seriously, how many people have told you that before?
 
The code I posted was not copy n paste. And yes I understand the principal behind an LED matrix.
And YES I am getting a GHOSTING effect. Looking at the code I don't see how but after I made sure that unwanted LEDs were OFF I eliminated GHOSTING. At first I thought I was seeing things but the LEDs were very dim. Using a DMM I could confirm that yes the voltage was very low but yes there is / was GHOSTING. I am not the only person who has seen this..
As far as the CONST arrays, I have had some success but I must be missing something because with the posted code I keep getting the wrong LEDs to come on. I compare it to code that has CONST arrays that work but have yet to figure it out but am learning in the process. Its called LEARNING BY DOING. Thats why the code is so short. I am eliminating any issues with extra unneeded code.
One can have all the degrees but still have no clue on how to do plain daily tasks. Have worked in a school district and some school administrators had no common sense.
In high school and college I became proficient in auto mechanics but after working in the real world I realized just how little I knew until I actually started learning by doing.
Most of the members on the web have experience in writing code, some even have degrees. I myself am self taught and learning by doing. Lots of stumbling along the way. I realize that being 64 years young I am getting a late start on this stuff.
 
The best way to do this is draw out your LEDs on a pice of paper
Give the rows a port and the columns a port map one led to
Each pin then scan one on at a time .
Code:
0100000
0010000
0001000
0000100
0000010
0000001
0000010
0000100
0001000
0010000
0100000
To change colors change the O's to a one and the one to
a O
 
Last edited:
I did that and got porta to cooperate but when it gets to port b it goes haywire.
Been hacking at the code making some progress. I found out several code commands that needed to be else where to work.
Will post tomorrow what I have so far. Looking at it it LOOKS like it is supposed to work.
 
video and code

first 4 lines work right but after that it goes haywire
[video]http://s992.photobucket.com/albums/af44/MrDEB/?action=view&current=Video1_zpsecbf2046.mp4[/video]
Code:
{
**************************************************  ***************************
*  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

 //RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR  RRRRRR
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
//RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR  RRRRRRRRRRRRRRRRR


//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'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
 //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top