U understand the basic principal of extracting the const array data which are 8 bits per byte which should work but trying to get all the rows to enable the colums dosen't seem to work.
take for example %00000001
if you load this into say porta then the led on pin 0 should light.
%00000111 = the leds on pins A0, A1, and A2 should light?
If I understand this correctly then i shouldn't get any ghosting and at one point I only had the RED leds to come on but I got some green leds as well which I never declared green leds on portD
Am going to start from scratch again and try and figure out what is going haywire
here is where I am now but when the LEDs in colum 2 only are supposed to light, I get LEDs in colum 3 that come on brighter than the leds in colum 2. Hope that makes sense.
Am contemplating just calling out say (A0, C1) which should turn on a red led in the first row (0-7Top to Bottom) and the second colum (0-4L>R). This may be wrong but ??
Code: Select all
{
*****************************************************************************
* Name : UNTITLED.BAS *
* Author : [select VIEW...EDITOR OPTIONS] *
* Notice : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 9/26/2012 *
* Version : 1.0 *
* Notes : *
* : *
*****************************************************************************
}
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 RowsA(7) As Byte = (%00000001, %00000010, %00000100, %0001000, %00010000, %00100000, %10000000 ) // Active RowPort pins for each section of the arrow
Const RowsB(7) As Byte = (%00000001, %00000010, %00000100, %0001000, %000010000, %00100000, %10000000 )
// 7 colums from right to left
Const RedDataCol(7) As Byte = (%000010001, %00001010, %00000100, %000010001, %00001001, %00000000, %00000000) // 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)
dim x as byte
dim RedBuffer(7) as byte
dim rowA_Buffer(7) as byte
dim rowB_Buffer(7) as byte
dim rowA as porta
dim rowB as portb
dim red_leds as portc
//LOAD ARRAYS
sub Save_graphics()
for x = 0 to 6
RedBuffer(x) = RedDataCol(x)
RowA_Buffer(x) = RowsA(x)
rowB_Buffer(x)= RowsB(x)
next
end sub
sub Display_Graphics()
for x = 0 to 3
red_leds = RedDataCol(x)
// if x<=3 then
rowA =RowsA(x)
delayms(2000)
next
// else
for x = 0 to 2
red_leds = RedDataCol(x)
rowB = RowsB(x)
delayms(3000)
next
end sub
//start of program
setalldigital
trisa = %00000000
trisb = %00000000
trisc = %00000000
trisd = %00000000
red_leds = 0
Save_graphics()
Display_Graphics