years ago I assembled a Compurterized Christmas light display but since sold the entire setup.
I recall the SSR or triac boards used an opti-isolator, couple resistors but instead of using a computer, I want to just use a PIC to drive the opti_isolator. Just started looking for leftover plans and parts but figure would ask first.
I used infaview and converted to a jpeg and hopefully it works
I added net labels and discovered why I fried the pic. I used the wrong port? B.0 and B.1
Yes I understand ONLY ONE LED PER ROW
here is how I hope to turn on 4 LEDs at a time then cycle from 1 - 4
Code:
{
{
*****************************************************************************
* Name : UNTITLED.BAS *
* Author : [select VIEW...EDITOR OPTIONS] *
* Notice : Copyright (c) 2020 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 3/15/2020 *
* Version : 1.0 *
* Notes : 4x4 matrix 12/18/22 *
* : *
*****************************************************************************
}
Module 4x4 ledmatrix
//LED MATRIX
Dim RED As PORTC.3
Dim WHITE AS PORTC.4
Dim BLUE AS PORTC.5
Dim GREEN AS PORTC.6
Dim ROW_1 As PORTB.5
Dim ROW_2 As PORTB.4
Dim ROW_3 As PORTB.3
Dim ROW_4 As PORTB.2
// make led pins outputs and turn them all off
Public Sub AllOff()
// turn off columns
Low(RED)
Low(WHITE)
Low(BLUE)
Low(GREEN)
// turn off rows
High(ROW_1)
High(ROW_2)
High(ROW_3)
HIGH(ROW_4)
End Sub
// turn on a single led
// led_no = 0 -> nothing on (all off)
// = 1 - 4 -> turn on specified led
Public Sub SetLed(led_no As Byte=0)
AllOff()
Select (led_no)
Case 1
RED = 1
ROW_1 =0
WHITE = 1
ROW_2 = 0
BLUE = 1
ROW_3 = 0
GREEN = 1
ROW_4 = 0
Case 2
RED = 1
ROW_2 =0
WHITE = 1
ROW_3 = 0
BLUE = 1
ROW_4 = 0
GREEN = 1
ROW_1 = 0
Case 3
RED = 1
ROW_3 =0
WHITE = 1
ROW_4 = 0
BLUE = 1
ROW_1 = 0
GREEN = 1
ROW_2 = 0
Case 4
RED = 1
ROW_4 =0
WHITE = 1
ROW_1 = 0
BLUE = 1
ROW_2 = 0
GREEN = 1
ROW_3 = 0
End Select
End Sub
SetLed()
// init
AllOff()
End Module
The rows are individually controlled by portb.2 - b.5 so ALL THE ROWS are not all on or off.
Unless you or I are missing something, but I have an actual board where the rows are independent of each other.
There are four separate COLUMNS - but there is no X-Y matrix, no rows.
All four LEDs are connected in parallel in each column, with both a colour and a "row" connection linked vertically to each column, rather than the row connections being across the columns to give the matrix connection.
That's how they are in the EasyEDA screen grab, anyway.
THIS is what YOUR schematic shows. The ONLY OPTIONS are ALL ON or ALL OFF. So either your SCHEMATIC is WRONG (imagine that) or your UNDERSTANDING OF THE CIRCUIT is wrong.
THIS is what YOUR schematic shows. The ONLY OPTIONS are ALL ON or ALL OFF. So either your SCHEMATIC is WRONG (imagine that) or your UNDERSTANDING OF THE CIRCUIT is wrong.
LOOK AT YOUR SCHEMATIC, you know, the "corrected" one after I explained and drew you a picture of what it showed. Trace the circuit. Explain how it can possibly do as you claim (HINT: IT CANNOT).
You haven't taken the 30 seconds to understand what I posted over 10 posts ago.
I'm afraid MrDEB has missed the point. IF his schematic is accurate, then what he wants to do is impossible. If it is possible to turn on a single LED in a row, the schematic is incorrect.
In either event, nobody can keep with the code as it's either:
● Not possible to do want he wants
Or
● Nobody knows what's actually connected to what, so any comments on the code are useless.
Here is the correct schematic, not the one in #250
this code should work? It is TOGGLING the columns and rows
Maybe some confusion about using the 2 pin plugs. Here the LEDs are used instead.
I could be wrong but maybe not?
Code:
Case 1
RED = 1
ROW_1 =0
DelayMS(300)//enough to see ON?
Toggle(RED) // turn off RED
WHITE = 1 //turn on WHITE
ROW_2 = 0
DelayMS(300)
Toggle(WHITE)
BLUE = 1
ROW_3 = 0
DelayMS(300)
Toggle(BLUE)
GREEN = 1
ROW_4 = 0
DelayMS(300)
Toggle(GREEN)
Your 4x4 matrix can be turned on from a 16 bit variable and 4 LEDs can be illuminated at any one time via interrupt (very fast so it looks like all lit LEDs are on permanently). That way your main code can simply set the bit in the 16 bit variable. Plus your on time is 25% instead of 6%. You do realise that with 5V and 330Ω resistors and an on time of 6% the LED current will be ~0.5mA - not very bright. Dropping the resistor to 33Ω will increase it to 5mA .
Has anyone got an example of an ISR in swordfish basic?