Shop OBEX P1 Docs P2 Docs Learn Events
ColorPAL Troubles — Parallax Forums

ColorPAL Troubles

John BoardJohn Board Posts: 371
edited 2012-02-03 00:59 in Accessories
Hi Y'all,

I've just had an exciting box in the post... with *Most* my ordered parts in them, however, after much enjoyment with the 4x16 LCD and a bit of playing around with the other stuff, I came to the ColorPAL which doesn't want to co-op.

Can anyone help me, I'm using the BOE with the bs2px, the sensor is plugged directly into the solderless breadboard. I have tried all the sample code, but none seems to work... Please Help!


' =========================================================================
'
'   File...... ColorPAL_transit.bs2
'   Purpose... ColorPAL smooth transition demo.
'   Author.... Phil Pilgrim -- Bueno Systems, Inc.
'   E-mail.... propeller@phipi.com
'   Started... 17 Apr 2009
'   Updated... 26 Jan 2010: Changed reset delay from 50 ms. to 80ms.
'
'   {$STAMP BS2px}
'   {$PBASIC 2.5}
'
' =========================================================================


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


' This program programs the ColorPAL to transition red->green->blue->red
' in a continuous loop. It does not program the ColorPAL's EEPROM.


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


sio     PIN 15           ' Serial I/O com pin for ColorPAL.


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


' Baudrate definitions. Serial I/O must be open-drain. The ColorPAL includes
' a pullup internally.


#SELECT $STAMP
  #CASE BS2, BS2E, BS2PE
    baud    CON  119 + 32768
  #CASE BS2SX, BS2P
    baud    CON  327 + 32768
  #CASE BS2PX
    baud    CON  536 + 32768
#ENDSELECT


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


red     VAR Word          ' Received RGB values from ColorPAL.
grn     VAR Word
blu     VAR Word


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


GOSUB Reset               ' Reset the ColorPAL and enter direct command mode.


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


SEROUT sio, baud, ["= t20 (00 R G B ) !"]
DO:LOOP


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


' Reset: Sends a long break to reset ColorPAL and enter direct command mode.


Reset:
  LOW sio                   'Pull sio low to eliminate any residual charge.
  INPUT sio                 'Return pin to input.
  DO UNTIL sio : LOOP       'Wait for pin to be pulled high by ColorPAL.
  LOW sio                   'Pull pin low.
  PAUSE 80                  'Keep low for 80ms to enter Direct mode.
  INPUT sio                 'Return pin to input.
  PAUSE 10                  'Pause another 10ms
  RETURN

Thanks in advance,

P.S. I am using relavly fresh batts, so it isn't them

John

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-29 20:10
    John,

    We need more details:

    1. Please give an example of a sample program that you tried and what results you got from it.

    2. Also provide details about how the ColorPAL was connected to your BS2px.

    3. Did you see the LED light up when the ColorPAL was given the sample instruction?

    -Phil
  • John BoardJohn Board Posts: 371
    edited 2012-01-29 20:17
    Hi, Understand the need for more information,

    VDD is connected to... well... VDD...
    VSS is connected to GND
    SIG is connected to P15

    Here is the sample code as per the ColorPAL_transit example code:
    ' =========================================================================
    '
    '   File...... ColorPAL_transit.bs2
    '   Purpose... ColorPAL smooth transition demo.
    '   Author.... Phil Pilgrim -- Bueno Systems, Inc.
    '   E-mail.... propeller@phipi.com
    '   Started... 17 Apr 2009
    '   Updated... 26 Jan 2010: Changed reset delay from 50 ms. to 80ms.
    '
    '   {$STAMP BS2px}
    '   {$PBASIC 2.5}
    '
    ' =========================================================================
    
    
    ' -----[ Program Description ]---------------------------------------------
    
    
    ' This program programs the ColorPAL to transition red->green->blue->red
    ' in a continuous loop. It does not program the ColorPAL's EEPROM.
    
    
    ' -----[ I/O Definitions ]-------------------------------------------------
    
    
    sio     PIN 15           ' Serial I/O com pin for ColorPAL.
    
    
    ' -----[ Constants ]-------------------------------------------------------
    
    
    ' Baudrate definitions. Serial I/O must be open-drain. The ColorPAL includes
    ' a pullup internally.
    
    
    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        baud    CON  119 + 32768
      #CASE BS2SX, BS2P
        baud    CON  327 + 32768
      #CASE BS2PX
        baud    CON  536 + 32768
    #ENDSELECT
    
    
    ' -----[ Variables ]-------------------------------------------------------
    
    
    red     VAR Word          ' Received RGB values from ColorPAL.
    grn     VAR Word
    blu     VAR Word
    
    
    ' -----[ Initialization ]--------------------------------------------------
    
    
    GOSUB Reset               ' Reset the ColorPAL and enter direct command mode.
    
    
    ' -----[ Program Code ]----------------------------------------------------
    
    
    SEROUT sio, baud, ["= t20 (00 R G B ) !"]
    DO:LOOP
    
    
    ' -----[ Subroutines ]-----------------------------------------------------
    
    
    ' Reset: Sends a long break to reset ColorPAL and enter direct command mode.
    
    
    Reset:
      LOW sio                   'Pull sio low to eliminate any residual charge.
      INPUT sio                 'Return pin to input.
      DO UNTIL sio : LOOP       'Wait for pin to be pulled high by ColorPAL.
      LOW sio                   'Pull pin low.
      PAUSE 80                  'Keep low for 80ms to enter Direct mode.
      INPUT sio                 'Return pin to input.
      PAUSE 10                  'Pause another 10ms
      RETURN
    

    And the result... Zip, Nadda, Nothing, no blips, flashes, or bits of datum in the "Console" (Debug window).

    Thanks for responding,

    John
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-29 20:25
    John, one more request to make things more readable:

    attachment.php?attachmentid=78421&d=1297987572

    Thanks,
    -Phil
  • John BoardJohn Board Posts: 371
    edited 2012-01-29 20:29
    Post Edited!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-29 20:41
    Your Reset subroutine dos not have a RETURN instruction. Did you copy it incorrectly from the docs, or did it get lost when transcribing to the forum?

    -Phil
  • John BoardJohn Board Posts: 371
    edited 2012-01-29 20:51
    Got lost while transcribing to forum.

    Never the less, it made me jump at the thought of not including the sub's return statement....
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-29 21:00
    Just so I can load exactly what you used and try it, could you correct your first post again, so reflects the exact code that you used?

    Sorry for the trouble,
    -Phil
  • John BoardJohn Board Posts: 371
    edited 2012-01-29 21:06
    Mate, its no trouble at all, your doing me a favour, I am willing to assist you in all means possible!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-29 22:02
    John,

    I don't have a BS2px, but I tried the program you posted with a BS2 and a BS2p, and it works with both of those. I also double-checked the BS2px baud rate constant against the manual, and it's correct for 7200 baud. Are you absolutely sure that you've connected the ColorPAL properly and do not have the plug reversed? Also make doubly sure that the power jumper for P12-P15 is set for Vdd and not Vin, and that the BOE's three-position power switch is set all the way to the right.

    -Phil
  • John BoardJohn Board Posts: 371
    edited 2012-01-29 22:06
    To clear everything up, firstly, it is plugged straight into the solder-less board, I did try with the wire from the servo ports, but same result, also the jumped pin is set to the right setting.

    Thanks for your help anyway
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-29 22:09
    John,

    Do you have a BASIC Stamp other than the BS2px that you could try it with?

    -Phil
  • John BoardJohn Board Posts: 371
    edited 2012-01-30 17:47
    I do, I will try it and then get back to you.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-02 21:56
    John,

    I just tried your program with my newly-arrived BS2px, and it works just fine.

    -Phil
  • John BoardJohn Board Posts: 371
    edited 2012-02-03 00:59
    I will try again, make sure that it is wired right (Using the servo pins on the BOE) and will use the demo code written by... you...
Sign In or Register to comment.