MrDEB
Well-Known Member
Lets try BIT BANGING/ MULTIPLEXING
have been able to separate the blue and white CONST arrays
seems to look alright.
wanting to avoid overloading pins
have been able to separate the blue and white CONST arrays
seems to look alright.
wanting to avoid overloading pins
Code:
{
*****************************************************************************
* Name : UNTITLED.BAS *
* Author : [select VIEW...EDITOR OPTIONS] *
* Notice : Copyright (c) 2022 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 5/18/2022 *
* Version : 1.0 *
* Notes : 70 total LEDs blue and white *
* : thoughts to improve = add a counter and increase then decrease
: the delay just for one color = white? *
*****************************************************************************
}
'Program: CHRISTMAS STAR:
Device = 18F43K22
Clock = 8
// int osc and IO pin libraries
Include "intosc.bas"
#option DIGITALIO_INIT = true // automatically call setalldigital
Include "setdigitalio.bas"
// hardware
Dim Counter As Word
Dim Counter_up As Word
Dim Counter_down As Word
Dim m As Byte
Dim w As Byte
Dim x As Byte
Dim y As Byte
Dim z As Byte
Const BLUE_A(8)As Byte= (%00000000,
%00000000,
%00100000, //
%00010000, //
%00000000,
%00000000,
%00000000,
%00000000)
Const BLUE_B(8)As Byte= (%10000000, //
%01000000, //
%00100000, //
%00010000, //
%00001000, //
%00000000,
%00000000,
%00000000)
Const BLUE_C(8) As Byte= (%10000000, //
%01000000, //
%00100000, //
%00000000,
%00001000, //
%00000100, //
%00000010, //
%00000000)
Const BLUE_D(8) As Byte= (%10000000,
%01000000,//
%00100000, //
%00010000, //
%00000000,
%00000000,
%00000000,
%00000001) //
Const WHITE_A(8)As Byte=(%10000000,
%01000000,
%00000000,
%00000000,
%00001000,
%00000100,
%00000010,
%00000001)
Const WHITE_B(8)As Byte= (%00000000,
%00000000,
%0000000,
%00000000,
%00000000,
%00000100,
%00000010,
%00000001)
Const WHITE_C(8) As Byte= (%00000000,
%00000000,
%00000000,
%00010000,
%00000000,
%00000000,
%00000000,
%00000001)
Const WHITE_D(8) As Byte= (%10000000,
%00000000,
%00000000,
%00000000,
%00001000,
%00000100,
%00000010,
%00000000)
CONST BLUE_E(3)AS BYTE = (%00000100,
%00000010,
%00000001)
//-------------------------------------
// start of main program
//-------------------------------------
main:
// init hdw
// LED port - all outputs 2 LEDs per port in parallel 330 ohm resistor
TRISA = 0
TRISB = 0
TRISC = 0
TRISD = 0
TRISE = 0
PORTE=%000
PORTD=%00000000
PORTC=%00000000
PORTA=%00000000
PORTB=%00000000
'Counter = 100
'Counter_up = 150
'Counter_down = 150
setalldigital
While true
for x = 0 to 2
PORTE = BLUE_E(x)// colums 8 (L-R the X is the scan
DelayUS(500)
Next
FOR Z = 0 TO 7
PORTA = WHITE_A(Z)
DELAYUS(500)
PORTE=%000
PORTA=%00000000
PORTB = WHITE_B(Z)
DELAYUS(500)
PORTB=%00000000
PORTC = WHITE_C(Z)
DELAYUS(500)
PORTC=%00000000
PORTD = WHITE_D(Z)
DELAYUS(500)
PORTD=%00000000
NEXT
Wend