Question regarding software problem (Driving 7 x 5 L.E.D matrix)

Basrad

Member
Hi all,

Been playing with a LED matrix 7 x 5

My software works ok, but if i make a minor change, It stops working.

To start with i issued high / low commands to switch the rows on or of, but decided to change to e.g. let pinsb = %00000001

This worked fine with all but the last line. When I change the Col_5 routing on line 42 from high / low commands to the pinsb = command it stops working. Any ideas on whats going wrong? Works with all the other sections above...

The same happens when I do the same to the last routine too :(

Code:
; using 18m2 to drive 7 x 5 led matrix
; Row Pins bank b = led row
; 0 = 1 , 1 = 2 , 2 = 3 , 4 = 5 , 5 = 6 , 6 = 7, 7 = N.C
;
; c.0 = cOLUM 1
; c.1 = cOLUM 2
; c.2 = cOLUM 3
; c.6 = cOLUM 4
; c.7 = cOLUM 5

setfreq m32  ; set clock


do

gosub Col_1   ; enable col1

let pinsb = %11111110   ; set rows
gosub clr

gosub Col_2

let pinsb = %11111100
gosub clr

gosub Col_3

let pinsb = %11111000
gosub clr

gosub Col_4

let pinsb = %11110000
gosub clr

gosub Col_5

low b.0
low b.1
low b.2
low b.3
low b.4
high b.5
high b.6

gosub clr



loop


; WRIGHT TO ScREEN clear

CLr:
pause 10
let pinsb = %00000000
return

Col_1: ; cOLUM 1

let pinsc = %11111110


return

Col_2: ; cOLUM 2

let pinsc = %11111101


return

Col_3: ; cOLUM 3

let pinsc = %11111011

return

Col_4: ; cOLUM 4

let pinsc = %10111111


return

Col_5: ; cOLUM 5

high  c.0
high c.1
high c.2
high c.6
low c.7


return
 

Basrad

Member
The code above works 100%, but this code below does not seem to work at all?

Code:
; Row Pins bank b = led row
; 0 = 1 , 1 = 2 , 2 = 3 , 4 = 5 , 5 = 6 , 6 = 7, 7 = N.C
;
;
; c.0 = cOLUM 1
; c.1 = cOLUM 2
; c.2 = cOLUM 3
; c.6 = cOLUM 4
; c.7 = cOLUM 5
setfreq m32


do






gosub Col_1

let pinsb = %11111110
gosub clr

gosub Col_2

let pinsb = %11111100
gosub clr

gosub Col_3

let pinsb = %11111000
gosub clr

gosub Col_4

let pinsb = %11110000
gosub clr

gosub Col_5

let pinsb = %11100000

gosub clr



loop


; WRIGHT TO ScREEN clear

CLr:
pause 10
let pinsb = %00000000
return

Col_1: ; cOLUM 1

let pinsc = %11111110


return

Col_2: ; cOLUM 2

let pinsc = %11111101


return

Col_3: ; cOLUM 3

let pinsc = %11111011

return

Col_4: ; cOLUM 4

let pinsc = %10111111


return

Col_5: ; cOLUM 5

let pinsc = %01111111


return
 

PaulRB

Senior Member
Basrad, the second version of your code has nothing to set the pins as outputs. They default to inputs on startup. The high/low commands in the first code set them to outputs. You need to use dirsB = ... and dirsC = ... at the start of the second code.

Paul
 
Last edited:
Top