November 22, 2024, 10:46:58 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Computer Matrix Board

Started by GregO, September 15, 2007, 02:46:38 PM

Previous topic - Next topic

GregO

Jon,
I corrected the connections from the outputs to the "W" line on the TTL pins as instructed and the unit seems to work.  I tested the output side of the ULN and have 1 dead and lots of varying voltages on the others. 

When I demoed it I had the wires to the outputs and back fed from the Vss terminal to 1 of the outputs just to get some blinking action, doing this I believe damaged the ULN.

My first step in debugging it will be to replace the ULN. Second step will be to check the LED's to make sure that they are not burned out, then check the solder connections and make sure they are not shorted. 

All this of course won't happen until I get home tonight!

Thanks!

GregO

GregO


JonnyMac

Let me try this again... in the Charlie-plexing scheme the ULN is not used.  At all.  Period.  The LED that's on is driven by setting two I/O pins (the Px.W pins) to output mode with one high (anode side of LED) and one low (cathode side of LED) -- all other I/O pins are made inputs.

You will never see a voltage out of the ULN; it either floats or connects to ground.  The proper way to test the ULN output is to put a volt meter between V+ and an OUTx terminal that is on; you should read your system voltage.  When the OUTx terminal is off, the meter will read nothing -- as if you disconnected the negative side of the circuit (which is what the ULN does).
Jon McPhalen
EFX-TEK Hollywood Office

GregO

Jon,
Thanks for the clarification, sorry to be so..... I'll check my wiring and LED's to see why they are lighting odd and forget the ULN.  I'm using 12 volts, could it be that I need more juice?

GregO

JonnyMac

No.  The Charlie-plexing arrangement only lights one LED at a time; the Prop-1 can handle that.  If you need multiple LEDs working at once, then you're going to need additional external hardware to create a matrix.
Jon McPhalen
EFX-TEK Hollywood Office

GregO

Jon,
I understand that the charlieplexing will only light 1 led at a time.  Are the TTL pins supposed to be active when the Prop-1 switch is in the "1" position?  I am in the process of examining my soldering on the led's, obviously something is not correct there because I'm getting multiple led's lit at the same time at varying degrees of brightness.  They swith to fast to keep track of them, but I notice that the block of D29 and D30 do not seem to light at all.  I have switched to another Prop-1 that I have and it does the same.

GregO

JonnyMac

Yes, the TTL outputs (5v) are available in positions 1 and 2 of the power switch; the Px connects to the output pins of the processor (through a 220-ohm reistor).

Please post you code -- you may just need a PAUSE in the loop somewhere.
Jon McPhalen
EFX-TEK Hollywood Office

GregO

I am using the your program for the charlieplexing.  I have not altered it just copied it into the unit with the editor of course.

GregO

GregO

I'm pretty sure that my solder job is a contributing factor, its pretty much a birdsnest.  see photo.

GregO

JonnyMac

Check your wiring carefully, then write test code that lights one LED at a time -- one should always test the constituent parts of a program before going for broke.
Jon McPhalen
EFX-TEK Hollywood Office

GregO

Jon,
I went over the wiring and found that I had 6 bad LED's and missed 2 connections.  I replaced and corrected and then looked at the program and realized that your Cylon 10 program only operated 10 of the LED's. 

I changed your numbers (see below) to include the rest of the LED's and now all the LED's light one at a time and "race" back and forth. 

The speed control works so I can adjust that easily.  I also removed the If Then trigger references too.

I beleive that due to nature of charlieplexing and how I soldered the LED's into the circuit, (The LED's are where I made ALL of the connections) is why some of the LED's light at less than full brightness in a random pattern.  This is not a displeasing side effect!  It gives the panel the appearance of "thinking". 

Is there a way to randomize the "race" (1 to 30 and 30 to 1)?  That combined with the "thinking" should really look cool.

Now to start building the new panels!

Thanks!

GregO


=========================================================================
'
'   File...... Cylon30.BS1 (star wars panelnew)
'   Purpose... 30 LED Cyclon-type display via Charlieplexing
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Modified.. Greg Owens
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Speed           = 7                     ' no ULN, remove SETUP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Leds            = PINS
SYMBOL  LedCtrl         = DIRS


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Pressed         = 1
SYMBOL  NotPressed      = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  theLed          = B2                    ' which LED is on
SYMBOL  pntr            = B3                    ' EEPROM pointer
SYMBOL  delay           = W5                    ' on-time for LED


' -----[ Initialization ]--------------------------------------------------

Reset:
  Leds = %00000000                              ' clear LEDs
  LedCtrl = %00000000                           ' disable outputs


' -----[ Program Code ]----------------------------------------------------

Main:


  FOR theLed = 1 TO 30
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT

  FOR theLed = 30 TO 2 STEP -1
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Pass LED to light (1 to 30) in "theLed"

Set_Led:
  IF theLed > 30 THEN Set_Led_Exit              ' bad LED #
    LedCtrl = %00000000                         ' disable LEDs
    pntr = theLed - 1 * 2                       ' point into table
    READ pntr, Leds                             ' get LED pins
    pntr = pntr + 1
    READ pntr, LedCtrl                          ' get control pins

Set_Led_Exit:
  RETURN

' -------------------------------------------------------------------------

' Use Prop-Pot to control speed

Speed_Delay:
  POT Speed, 110, delay
  delay = delay * 4                             ' scale to ~1 sec max
  PAUSE delay
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

Charlieplexed_Leds:

'            PINS       DIRS
'
  EEPROM (%00000001, %00000011)                 ' LED 1
  EEPROM (%00000010, %00000011)                 ' LED 2
  EEPROM (%00000001, %00000101)                 ' LED 3
  EEPROM (%00000100, %00000101)                 ' LED 4
  EEPROM (%00000001, %00001001)                 ' LED 5
  EEPROM (%00001000, %00001001)                 ' LED 6
  EEPROM (%00000001, %00010001)                 ' LED 7
  EEPROM (%00010000, %00010001)                 ' LED 8
  EEPROM (%00000001, %00100001)                 ' LED 9
  EEPROM (%00100000, %00100001)                 ' LED 10
  EEPROM (%00000010, %00000110)                 ' LED 11
  EEPROM (%00000100, %00000110)                 ' LED 12
  EEPROM (%00000010, %00001010)                 ' LED 13
  EEPROM (%00001000, %00001010)                 ' LED 14
  EEPROM (%00000010, %00010010)                 ' LED 15
  EEPROM (%00010000, %00010010)                 ' LED 16
  EEPROM (%00000010, %00100010)                 ' LED 17
  EEPROM (%00100000, %00100010)                 ' LED 18
  EEPROM (%00000100, %00001100)                 ' LED 19
  EEPROM (%00001000, %00001100)                 ' LED 20
  EEPROM (%00000100, %00010100)                 ' LED 21
  EEPROM (%00010000, %00010100)                 ' LED 22
  EEPROM (%00000100, %00100100)                 ' LED 23
  EEPROM (%00100000, %00100100)                 ' LED 24
  EEPROM (%00001000, %00011000)                 ' LED 25
  EEPROM (%00010000, %00011000)                 ' LED 26
  EEPROM (%00001000, %00101000)                 ' LED 27
  EEPROM (%00100000, %00101000)                 ' LED 28
  EEPROM (%00010000, %00110000)                 ' LED 29
  EEPROM (%00100000, %00110000)                 ' LED 30

JonnyMac

Sure, selecting a random LED is easy using my standard random value (lottery) and modulus operator (//) trick:

' =========================================================================
'
'   File...... Random_Charlie.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Speed           = 7                     ' no ULN, remove SETUP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Leds            = PINS
SYMBOL  LedCtrl         = DIRS


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Pressed         = 1
SYMBOL  NotPressed      = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  theLed          = B2                    ' which LED is on
SYMBOL  pntr            = B3                    ' EEPROM pointer
SYMBOL  delay           = W4                    ' on-time for LED
SYMBOL  lottery         = W5                    ' random value


' -----[ Initialization ]--------------------------------------------------

Reset:
  Leds = %00000000                              ' clear LEDs
  LedCtrl = %00000000                           ' disable outputs


  ' -----[ Program Code ]----------------------------------------------------

Main:
  RANDOM lottery
  IF Trigger = NotPressed THEN Main             ' wait for trigger

  theLed = lottery // 30 + 1                    ' make 1 to 30
  GOSUB Set_Led
  GOSUB Speed_Delay

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Pass LED to light (1 to 30) in "theLed"

Set_Led:
  IF theLed < 1 OR theLed > 30 THEN Led_Exit    ' test for bad LED #
    LedCtrl = %00000000                         ' disable LEDs
    pntr = theLed - 1 * 2                       ' point into table
    READ pntr, Leds                             ' get LED pins
    pntr = pntr + 1
    READ pntr, LedCtrl                          ' get control pins

Led_Exit:
  RETURN

' -------------------------------------------------------------------------

' Use Prop-Pot to control speed

Speed_Delay:
  POT Speed, 110, delay                         ' read speed pot
  delay = delay * 4                             ' scale to ~1 sec max
  PAUSE delay
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

Charlieplexed_Leds:

'            PINS       DIRS
'
  EEPROM (%00000001, %00000011)                 ' LED 1
  EEPROM (%00000010, %00000011)                 ' LED 2
  EEPROM (%00000001, %00000101)                 ' LED 3
  EEPROM (%00000100, %00000101)                 ' LED 4
  EEPROM (%00000001, %00001001)                 ' LED 5
  EEPROM (%00001000, %00001001)                 ' LED 6
  EEPROM (%00000001, %00010001)                 ' LED 7
  EEPROM (%00010000, %00010001)                 ' LED 8
  EEPROM (%00000001, %00100001)                 ' LED 9
  EEPROM (%00100000, %00100001)                 ' LED 10
  EEPROM (%00000010, %00000110)                 ' LED 11
  EEPROM (%00000100, %00000110)                 ' LED 12
  EEPROM (%00000010, %00001010)                 ' LED 13
  EEPROM (%00001000, %00001010)                 ' LED 14
  EEPROM (%00000010, %00010010)                 ' LED 15
  EEPROM (%00010000, %00010010)                 ' LED 16
  EEPROM (%00000010, %00100010)                 ' LED 17
  EEPROM (%00100000, %00100010)                 ' LED 18
  EEPROM (%00000100, %00001100)                 ' LED 19
  EEPROM (%00001000, %00001100)                 ' LED 20
  EEPROM (%00000100, %00010100)                 ' LED 21
  EEPROM (%00010000, %00010100)                 ' LED 22
  EEPROM (%00000100, %00100100)                 ' LED 23
  EEPROM (%00100000, %00100100)                 ' LED 24
  EEPROM (%00001000, %00011000)                 ' LED 25
  EEPROM (%00010000, %00011000)                 ' LED 26
  EEPROM (%00001000, %00101000)                 ' LED 27
  EEPROM (%00100000, %00101000)                 ' LED 28
  EEPROM (%00010000, %00110000)                 ' LED 29
  EEPROM (%00100000, %00110000)                 ' LED 30


Note: If you leave the ULN installed you can get more than one LED on -- when not expected.  The reason for this is that the input to the ULN is about an 8K path to ground (this design keeps the ULN off unless specifically driven on) -- this resistance may allow an LED to light dimly (I saw this when I plugged a small Charlie-plex circuit into a Prop-1 that still had the ULN installed).
Jon McPhalen
EFX-TEK Hollywood Office

GregO

Jon!!!!
Thank you!!!! this is the effect I am looking for!!!
A couple of other questions....
With the switch in the 2 position there is voltage at the V+ and ground, would it be detrimental to the unit to power some non-controled LED's from there?  Just some that are steady on?
and
would the program be flexible enough to do a period of time in random mode then switch to the cylon race mode and then back again, say 30 seconds each?

Thanks!

GregO

GregO

Jon,
Thanks for your help and timely response to all of my questions.

GregO

JonnyMac

Greg,

Sorry I missed the questions from above. Yes, you can use V+/GND to power external devices -- no harm to the Charlie-plexing process.  Here's another version of your program that alternates between a random output and cyclon-style display.

' =========================================================================
'
'   File...... Random_Charlie_Cylon.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Speed           = 7                     ' no ULN, remove SETUP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Leds            = PINS
SYMBOL  LedCtrl         = DIRS


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Pressed         = 1
SYMBOL  NotPressed      = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  theLed          = B2                    ' which LED is on
SYMBOL  last            = B3                    ' last LED lit
SYMBOL  pntr            = B4                    ' EEPROM pointer
SYMBOL  cycles          = B5                    ' # of random cycles
SYMBOL  delay           = W4                    ' on-time for LED
SYMBOL  lottery         = W5                    ' random value


' -----[ Initialization ]--------------------------------------------------

Reset:
  Leds = %00000000                              ' clear LEDs
  LedCtrl = %00000000                           ' disable outputs


  ' -----[ Program Code ]----------------------------------------------------

Main:
  RANDOM lottery
  IF Trigger = NotPressed THEN Main             ' wait for trigger

  cycles = 0

Random_Leds:
  theLed = lottery // 30 + 1                    ' make 1 to 30
  IF theLed = last THEN Main
    last = theLed
  GOSUB Set_Led
  GOSUB Speed_Delay
  cycles = cycles + 1
  IF cycles < 30 THEN Random_Leds

  cycles = 0

Cylon_Leds:
  FOR theLed = 1 TO 30
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT
  FOR theLed = 30 TO 1 STEP -1
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT
  cycles = cycles + 1
  IF cycles < 2 THEN Cylon_Leds

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Pass LED to light (1 to 30) in "theLed"

Set_Led:
  IF theLed < 1 OR theLed > 30 THEN Led_Exit    ' test for bad LED #
    LedCtrl = %00000000                         ' disable LEDs
    pntr = theLed - 1 * 2                       ' point into table
    READ pntr, Leds                             ' get LED pins
    pntr = pntr + 1
    READ pntr, LedCtrl                          ' get control pins

Led_Exit:
  RETURN

' -------------------------------------------------------------------------

' Use Prop-Pot to control speed

Speed_Delay:
  POT Speed, 110, delay                         ' read speed pot
  delay = delay * 4                             ' scale to ~1 sec max
  PAUSE delay
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

Charlieplexed_Leds:

'            PINS       DIRS
'
  EEPROM (%00000001, %00000011)                 ' LED 1
  EEPROM (%00000010, %00000011)                 ' LED 2
  EEPROM (%00000001, %00000101)                 ' LED 3
  EEPROM (%00000100, %00000101)                 ' LED 4
  EEPROM (%00000001, %00001001)                 ' LED 5
  EEPROM (%00001000, %00001001)                 ' LED 6
  EEPROM (%00000001, %00010001)                 ' LED 7
  EEPROM (%00010000, %00010001)                 ' LED 8
  EEPROM (%00000001, %00100001)                 ' LED 9
  EEPROM (%00100000, %00100001)                 ' LED 10
  EEPROM (%00000010, %00000110)                 ' LED 11
  EEPROM (%00000100, %00000110)                 ' LED 12
  EEPROM (%00000010, %00001010)                 ' LED 13
  EEPROM (%00001000, %00001010)                 ' LED 14
  EEPROM (%00000010, %00010010)                 ' LED 15
  EEPROM (%00010000, %00010010)                 ' LED 16
  EEPROM (%00000010, %00100010)                 ' LED 17
  EEPROM (%00100000, %00100010)                 ' LED 18
  EEPROM (%00000100, %00001100)                 ' LED 19
  EEPROM (%00001000, %00001100)                 ' LED 20
  EEPROM (%00000100, %00010100)                 ' LED 21
  EEPROM (%00010000, %00010100)                 ' LED 22
  EEPROM (%00000100, %00100100)                 ' LED 23
  EEPROM (%00100000, %00100100)                 ' LED 24
  EEPROM (%00001000, %00011000)                 ' LED 25
  EEPROM (%00010000, %00011000)                 ' LED 26
  EEPROM (%00001000, %00101000)                 ' LED 27
  EEPROM (%00100000, %00101000)                 ' LED 28
  EEPROM (%00010000, %00110000)                 ' LED 29
  EEPROM (%00100000, %00110000)                 ' LED 30



Jon McPhalen
EFX-TEK Hollywood Office