PDA

View Full Version : Parallax SX48 Code to Propeller Chip Code



Tony11
11-20-2010, 04:14 AM
Hi

What I would like to know is, can I run this code(look down for code) from the Parallax SX48. Run this same code but on Propeller Chip. Will the code work from one to the other? So in my words,
copy and past it to the Propeller Chip. If this will not work, can some one get me started on the code for propeller chip to run the (Sure Electronics 0832 Dot Matrix Display).


thank you






' ================================================== =======================
'
' Author.... Timothy Gilmore
' Date...... 05/25/09
' Updated... 09/19/09
' Email..... gilmoret@us.saic.com
' File...... 0832_Display_SX48_verD5_TEST.sxb
' Purpose... Use with 0832 LED Display Info Board from Sure Electronics:
' http://www.sureelectronics.net/goods.php?id=903 for $8.00.
'
' ================================================== =======================

' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------

' Sure Electronics 0832 Display code adapted for the Parallax SX48 in SX/B.
' Arduino 2416 code: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225239439
' since there was nothing I could find for the 0832 Displays. Both the Sure
' Electronics 2416 and 0832 display boards use the HT1632 LED driver.
'
' 0832 display uses nibbles in its 64 memory addresses.
'
'
' It should also be possible to adapt this code for use
' with the Sure Electronics 2416 display.
'
' Also up to 3* of these 0832 displays can be combined
' into chip selectable devices with minor code adjustment.
'
' * Only 3 can be used together using an SX48 due to ram availability
' ---------------------------------------------------------------------------
' Command Usage:
' --------------
'
'
' COMMAND Command Code, Display Number(1-3) (e.g. COMMAND BLON, 2)
' Command Codes: SYSDIS -Disable system oscillator
' SYSON -Enable system oscillator
' LEDOFF -Turn off LED
' LEDON -Turn on LED
' BLOFF -LED Blink On
' BLON -LED Blink Off
' SLVMD -Slave Mode
' MSTMD -Master Mode
' RCCLK -Use on-chip clock
' EXTCLK -Use external clock
' COMS10 -commons options
' PWM_B(x) -pulse width modulation (PWM) value
' (e.g. x=15 full brightness 16/16 Duty Cycle, x=0 very dim 1/16 Duty Cycle)
'
' SENDATA Address(0-63), DataNibble, Display Number(1-3) (e.g. SENDDATA 0, $F, 3)
'
'
'
'
' DISPLAY 16 Character String (e.g. DISPLAY " Hello World!!! ")
'
' SCROLL_LEFT (e.g. SCROLL_LEFT) NOTE: Use a DISPLAY command before SCROLL_LEFT or SCROLL_RIGHT
'
' SCROLL_RIGHT (e.g. SCROLL_RIGHT)
'
'
' DRAW Data Label (e.g. DRAW Picture1) NOTE: Use a DRAW command before DRAW_SCROLL_LEFT or DRAW_SCROLL_RIGHT
'
' DRAW_SCROLL_LEFT (e.g. DRAW_SCROLL_LEFT)
'
' DRAW_SCROLL_RIGHT (e.g. DRAW_SCROLL_RIGHT)
'
'
' ---------------------------------------------------------------------------




' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------

DEVICE SX48, OSC4MHZ, BOR42
FREQ 4_000_000 ' Use internal 4 MHz sx48 clock
ID "0832"


' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------

ht1632_data PIN RA.0 OUTPUT ' Connect to Data (pin 7)
ht1632_wrclk PIN RA.1 OUTPUT ' Connect to Write clock (pin 5)
CS_1 PIN RB.0 OUTPUT ' Connect to Chip Select 1 (pin 3)
CS_2 PIN RB.1 OUTPUT ' Connect to Chip Select 2 (pin 1)
CS_3 PIN RB.2 OUTPUT ' Connect to Chip Select 3 (pin 2)
' Not enough SX48 ram to use (4) 0832 displays.
' Only (3) can be used with and SX48.

' Also bring over +5vdc (pin 16)
' and ground (pin 15).

' -------------------------------------------------------------------------
' Variables
' -------------------------------------------------------------------------

cmd VAR Byte
addr VAR Byte
data_ VAR Byte

tmpB1 VAR Byte
tmpB2 VAR Byte
tmpB3 VAR Byte

tmpB4 VAR Byte

addr2 VAR Byte

PWM_B VAR Byte(16)

ctr VAR Byte
ctr2 VAR Byte

dispNo VAR Byte

tmpW1 VAR Word
tmpW2 VAR Word

charBuf VAR Byte(6)
charBufFix VAR Byte(6)

cs VAR Byte

shadowram VAR Byte(192) ' Only enough SX48 ram for (3) 0832 displays !!


' PWM_B(0) = $A0 ' CMD= 101x-PPPP-x PWM duty cycle 1/16
' PWM_B(1) = $A1 ' CMD= 101x-PPPP-x PWM duty cycle 2/16
' PWM_B(2) = $A2 ' CMD= 101x-PPPP-x PWM duty cycle 3/16
' PWM_B(3) = $A3 ' CMD= 101x-PPPP-x PWM duty cycle 4/16
' PWM_B(4) = $A4 ' CMD= 101x-PPPP-x PWM duty cycle 5/16
' PWM_B(5) = $A5 ' CMD= 101x-PPPP-x PWM duty cycle 6/16
' PWM_B(6) = $A6 ' CMD= 101x-PPPP-x PWM duty cycle 7/16
' PWM_B(7) = $A7 ' CMD= 101x-PPPP-x PWM duty cycle 8/16
' PWM_B(8) = $A8 ' CMD= 101x-PPPP-x PWM duty cycle 9/16
' PWM_B(9) = $A9 ' CMD= 101x-PPPP-x PWM duty cycle 10/16
' PWM_B(10) = $AA ' CMD= 101x-PPPP-x PWM duty cycle 11/16
' PWM_B(11) = $AB ' CMD= 101x-PPPP-x PWM duty cycle 12/16
' PWM_B(12) = $AC ' CMD= 101x-PPPP-x PWM duty cycle 13/16
' PWM_B(13) = $AD ' CMD= 101x-PPPP-x PWM duty cycle 14/16
' PWM_B(14) = $AE ' CMD= 101x-PPPP-x PWM duty cycle 15/16
' PWM_B(15) = $AF ' CMD= 101x-PPPP-x PWM duty cycle 16/16


' -------------------------------------------------------------------------
' Constants
' -------------------------------------------------------------------------

' Commands written to the chip consist of a 3 bit "ID", followed by
' either 9 bits of "Command code" or 7 bits of address_ + 4 bits of data_.

HT1632_ID_CMD CON 4 ' ID = %100 - Commands
HT1632_ID_RD CON 6 ' ID = %110 - Read RAM
HT1632_ID_WR CON 5 ' ID = %101 - Write RAM

SYSDIS CON $00 ' CMD= 0000-0000-x Turn off oscil
SYSON CON $01 ' CMD= 0000-0001-x Enable system oscil
LEDOFF CON $02 ' CMD= 0000-0010-x LED duty cycle gen off
LEDON CON $03 ' CMD= 0000-0011-x LEDs ON
BLOFF CON $08 ' CMD= 0000-1000-x Blink ON
BLON CON $09 ' CMD= 0000-1001-x Blink Off
SLVMD CON $10 ' CMD= 0001-00xx-x Slave Mode
MSTMD CON $14 ' CMD= 0001-01xx-x Master Mode
RCCLK CON $18 ' CMD= 0001-10xx-x Use on-chip clock
EXTCLK CON $1C ' CMD= 0001-11xx-x Use external clock
COMS10 CON $28 ' CMD= 0010-ABxx-x commons options



' ================================================== =======================
PROGRAM Start
' ================================================== =======================

' -------------------------------------------------------------------------
' Subroutine Declarations
' -------------------------------------------------------------------------

CHIPSELECT SUB 1
CHIPFREE SUB 1
COMMAND SUB 2
SENDDATA SUB 3
SETUP SUB 0

DISPLAY SUB 2 ' Displays 16 char message string
SCROLL_LEFT SUB 0 ' Scrolls message to the left
SCROLL_RIGHT SUB 1 ' Scrolls message to the right

DELAY_MS SUB 1, 2 ' delay in milliseconds

DRAW SUB 2 ' Display 3*32 (96) x 8 picture
DRAW_SCROLL_LEFT SUB 0 ' Scrolls left a 96 x 8 picture
DRAW_SCROLL_RIGHT SUB 0 ' Scrolls right a 96 x 8 picture

' -------------------------------------------------------------------------
' Program Code
' -------------------------------------------------------------------------

Start:

SETUP

Main:
COMMAND PWM_B(15), 1
COMMAND PWM_B(15), 2
COMMAND PWM_B(15), 3

DRAW Picture1 'Draw picture in Label "Picture1:"
DELAY_MS 1000

DRAW_SCROLL_LEFT 'Scrolls left data picture
DELAY_MS 1000

DRAW_SCROLL_RIGHT 'Scrolls right data picture
DELAY_MS 1000


FOR ctr2 = 0 TO 2
FOR ctr = 0 TO 15
COMMAND PWM_B(ctr), 1
COMMAND PWM_B(ctr), 2
COMMAND PWM_B(ctr), 3
DISPLAY "SX48 -> (3) 0832"
DELAY_MS 100
NEXT ctr
FOR ctr = 15 TO 0 STEP - 1
COMMAND PWM_B(ctr), 1
COMMAND PWM_B(ctr), 2
COMMAND PWM_B(ctr), 3
DISPLAY "0123456789ABCDEF"
DELAY_MS 100
NEXT ctr
NEXT ctr2

COMMAND PWM_B(15), 1 ' 100% brightness PWM
COMMAND PWM_B(15), 2 ' 100% brightness PWM
COMMAND PWM_B(15), 3 ' 100% brightness PWM
DISPLAY "Watch the fading"
DELAY_MS 500

'COMMAND LEDOFF, dispNo ' Turn OFF display to load message
'DISPLAY " 0832", dispNo ' Display/load message for scroll routines
'COMMAND LEDON, dispNo ' Turn ON display to scroll message

'SCROLL_LEFT ' Scrolls DISPLAY message to the left - NOT WORKING YET !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!
'DELAY_MS 500

' SCROLL_RIGHT dispNo ' Scrolls DISPLAY message to the right
' DELAY_MS 500

COMMAND PWM_B(8), 1 ' 50% brightness PWM
COMMAND PWM_B(8), 2 ' 50% brightness PWM
COMMAND PWM_B(8), 3 ' 50% brightness PWM
DISPLAY "Watch the fading"
DELAY_MS 500

COMMAND PWM_B(4), 1 ' 25% brightness PWM
COMMAND PWM_B(4), 2 ' 25% brightness PWM
COMMAND PWM_B(4), 3 ' 25% brightness PWM
DISPLAY "Watch the fading"
DELAY_MS 500

COMMAND PWM_B(0), 1 ' 1/16 brightness PWM
COMMAND PWM_B(0), 2 ' 1/16 brightness PWM
COMMAND PWM_B(0), 3 ' 1/16 brightness PWM
DISPLAY "Watch the fading"
DELAY_MS 500

COMMAND PWM_B(15), 1 ' 100% brightness PWM
COMMAND PWM_B(15), 2 ' 100% brightness PWM
COMMAND PWM_B(15), 3 ' 100% brightness PWM
DISPLAY " Disappear "
DELAY_MS 500

COMMAND PWM_B(15), 1 ' 100% brightness PWM
COMMAND PWM_B(15), 2 ' 100% brightness PWM
COMMAND PWM_B(15), 3 ' 100% brightness PWM
DISPLAY " "
DELAY_MS 500

COMMAND BLON, 1 ' Blink on display
COMMAND BLON, 2 ' Blink on display
COMMAND BLON, 3 ' Blink on display
DELAY_MS 1000
DISPLAY "It can Blink on."
DELAY_MS 5000
COMMAND BLOFF, 1 ' Blink off display
COMMAND BLOFF, 2 ' Blink off display
COMMAND BLOFF, 3 ' Blink off display
DISPLAY " "
DELAY_MS 1000

GOTO Main


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

' Use: DELAY_MS ms
' -- delay program for 'ms' milliseconds

SUB DELAY_MS
IF __PARAMCNT = 1 THEN ' byte parameter?
tmpW1 = __PARAM1
ELSE
tmpW1 = __WPARAM12
ENDIF
PAUSE tmpW1
ENDSUB


' Use: e.g. DRAW Picture1

SUB DRAW
tmpW1 = __WPARAM12 ' start of label (96 bytes)
FOR addr = 0 TO 63
READINC tmpW1, tmpB1 ' read first 64 nibble addresses of picture data
tmpB2.3 = tmpB1.0 ' perform bit correction for the ht1632
tmpB2.2 = tmpB1.1
tmpB2.1 = tmpB1.2
tmpB2.0 = tmpB1.3
SENDDATA addr, tmpB2, 1 ' send correct byte (xxxx1111) where x=don't care and use 1's and 0's
addr2 = addr + 1 ' use another variable for the next address increment
SWAP tmpB1 ' SWAP nibbles (e.g. 1001 1100 --> 1100 1001)
tmpB2.3 = tmpB1.0 ' perform bit correction for the ht1632
tmpB2.2 = tmpB1.1
tmpB2.1 = tmpB1.2
tmpB2.0 = tmpB1.3
SENDDATA addr2, tmpB2, 1 ' send correct byte (xxxx1111) where x=don't care and use 1's and 0's
NEXT addr
FOR addr = 64 TO 127
READINC tmpW1, tmpB1 ' read second 64 nibble addresses of picture data
tmpB2.3 = tmpB1.0
tmpB2.2 = tmpB1.1
tmpB2.1 = tmpB1.2
tmpB2.0 = tmpB1.3
SENDDATA addr, tmpB2, 2
addr2 = addr + 1
SWAP tmpB1
tmpB2.3 = tmpB1.0
tmpB2.2 = tmpB1.1
tmpB2.1 = tmpB1.2
tmpB2.0 = tmpB1.3
SENDDATA addr2, tmpB2, 2
NEXT addr
FOR addr = 128 TO 191
READINC tmpW1, tmpB1 ' read third 64 nibble addresses of picture data
tmpB2.3 = tmpB1.0
tmpB2.2 = tmpB1.1
tmpB2.1 = tmpB1.2
tmpB2.0 = tmpB1.3
SENDDATA addr, tmpB2, 3 '
addr2 = addr + 1
SWAP tmpB1
tmpB2.3 = tmpB1.0
tmpB2.2 = tmpB1.1
tmpB2.1 = tmpB1.2
tmpB2.0 = tmpB1.3
SENDDATA addr2, tmpB2, 3
NEXT addr
ENDSUB


' Use: e.g. DRAW_SCROLL_LEFT

SUB DRAW_SCROLL_LEFT

FOR tmpB2 = 0 TO 192 STEP 2
tmpB3 = tmpB2
FOR addr = 0 TO 63
READINC Pad0 + tmpB3, tmpB1 ' read picture data
tmpB4.3 = tmpB1.0 ' perform bit correction for the ht1632
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr, tmpB4, 1 ' send correct byte (xxxx1111) where x=don't care and use 1's and 0's
addr2 = addr + 1 ' use another variable for the next address increment
SWAP tmpB1 ' SWAP nibbles (e.g. 1001 1100 --> 1100 1001)
tmpB4.3 = tmpB1.0 ' perform bit correction for the ht1632
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr2, tmpB4, 1 ' send correct byte (xxxx1111) where x=don't care and use 1's and 0's
NEXT addr
FOR addr = 0 TO 63
READINC Pad0 + tmpB3, tmpB1
tmpB4.3 = tmpB1.0
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr, tmpB4, 2
addr2 = addr + 1
SWAP tmpB1
tmpB4.3 = tmpB1.0
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr2, tmpB4, 2
NEXT addr
FOR addr = 0 TO 63
READINC Pad0 + tmpB3, tmpB1
tmpB4.3 = tmpB1.0
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr, tmpB4, 3
addr2 = addr + 1
SWAP tmpB1
tmpB4.3 = tmpB1.0
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr2, tmpB4, 3
NEXT addr
DELAY_MS 50
NEXT tmpB2
ENDSUB

' Use: e.g. DRAW_SCROLL_RIGHT

SUB DRAW_SCROLL_RIGHT

FOR tmpB2 = 192 TO 0 STEP -2
tmpB3 = tmpB2
FOR addr = 0 TO 63
READINC Pad0 + tmpB3, tmpB1 ' read picture data
tmpB4.3 = tmpB1.0 ' perform bit correction for the ht1632
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr, tmpB4, 1 ' send correct byte (xxxx1111) where x=don't care and use 1's and 0's
addr2 = addr + 1 ' use another variable for the next address increment
SWAP tmpB1 ' SWAP nibbles (e.g. 1001 1100 --> 1100 1001)
tmpB4.3 = tmpB1.0 ' perform bit correction for the ht1632
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr2, tmpB4, 1 ' send correct byte (xxxx1111) where x=don't care and use 1's and 0's
NEXT addr
FOR addr = 0 TO 63
READINC Pad0 + tmpB3, tmpB1
tmpB4.3 = tmpB1.0
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr, tmpB4, 2
addr2 = addr + 1
SWAP tmpB1
tmpB4.3 = tmpB1.0
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr2, tmpB4, 2
NEXT addr
FOR addr = 0 TO 63
READINC Pad0 + tmpB3, tmpB1
tmpB4.3 = tmpB1.0
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr, tmpB4, 3
addr2 = addr + 1
SWAP tmpB1
tmpB4.3 = tmpB1.0
tmpB4.2 = tmpB1.1
tmpB4.1 = tmpB1.2
tmpB4.0 = tmpB1.3
SENDDATA addr2, tmpB4, 3
NEXT addr
DELAY_MS 50
NEXT tmpB2
ENDSUB

' Use: e.g. DISPLAY "0123456789ABCDEF"

SUB DISPLAY
tmpW1 = __WPARAM12 ' start of string
addr = 0
FOR tmpB3 = 0 TO 15 ' 16 characters over (3) 0832 displays
READINC tmpW1, tmpB1 ' get character
' handle non-printable
IF tmpB1 < $20 THEN ' non-printable?
tmpB1 = " "
ENDIF
' convert non-ASCII chars to space
IF tmpB1 > 127 THEN
tmpB1 = " "
ENDIF
' read character map into char buffer
tmpB1 = tmpB1 - $20 ' zero adjust
tmpW2 = tmpB1 * 6 ' calc character offset
FOR tmpB2 = 0 TO 5
READINC ASCII_Set + tmpW2, charBuf(tmpB2) ' read character map
charBufFix(tmpB2).3 = charBuf(tmpB2).0 ' Adjust for reversed nibbles...
charBufFix(tmpB2).2 = charBuf(tmpB2).1
charBufFix(tmpB2).1 = charBuf(tmpB2).2
charBufFix(tmpB2).0 = charBuf(tmpB2).3
shadowram(addr) = charBufFix(tmpB2) ' Use 1/2 of the byte (nibble 1)
INC addr
SWAP charBuf(tmpB2) ' Use second 1/2 of the byte (nibble 2)
charBufFix(tmpB2).3 = charBuf(tmpB2).0 ' Adjust for reversed nibbles...
charBufFix(tmpB2).2 = charBuf(tmpB2).1
charBufFix(tmpB2).1 = charBuf(tmpB2).2
charBufFix(tmpB2).0 = charBuf(tmpB2).3
shadowram(addr) = charBufFix(tmpB2)
INC addr
NEXT tmpB2
NEXT tmpB3


FOR addr = 0 TO 63
SENDDATA addr, shadowram(addr), 1 ' Display message over (3) 0832 displays
addr2 = addr + 64
SENDDATA addr, shadowram(addr2), 2
addr2 = addr2 + 64
SENDDATA addr, shadowram(addr2), 3
NEXT addr
ENDSUB

' Use: e.g. SCROLL_LEFT - NOT WORKING YET !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!

SUB SCROLL_LEFT

' FOR tmpB2 = 0 TO 192 STEP 2 ' Scroll left from right side off display to center of disply
' FOR addr = 0 TO 63
' tmpB3 = tmpB2 + addr
' tmpB3 = tmpB3 - 64
' IF tmpB3 > 191 THEN
' tmpB3 = 128
' ENDIF
' SENDDATA addr, shadowram(tmpB3), 3
' NEXT addr
' FOR addr = 0 TO 63
' tmpB3 = tmpB2 + addr
' tmpB3 = tmpB3 - 128
' IF tmpB3 > 127 THEN
' tmpB3 = 64
' ENDIF
' SENDDATA addr, shadowram(tmpB3), 2
' NEXT addr
' FOR addr = 0 TO 63
' tmpB3 = tmpB2 + addr
' tmpB3 = tmpB3 - 192
' IF tmpB3 > 63 THEN
' tmpB3 = 0
' ENDIF
' SENDDATA addr, shadowram(tmpB3), 1
' NEXT addr
' DELAY_MS 50
' NEXT tmpB2


FOR tmpB2 = 0 TO 191 STEP 2 ' Scroll left from center of display to left side off display
FOR addr = 0 TO 63
tmpB3 = tmpB2 + addr
IF tmpB3 > 63 THEN
tmpB3 = 0
ENDIF
SENDDATA addr, shadowram(tmpB3), 1
NEXT addr
FOR addr = 0 TO 63
tmpB3 = tmpB2 + addr
tmpB3 = tmpB3 + 64
IF tmpB3 > 127 THEN
tmpB3 = 64
ENDIF
SENDDATA addr, shadowram(tmpB3), 2
NEXT addr
FOR addr = 0 TO 63
tmpB3 = tmpB2 + addr
tmpB3 = tmpB3 + 128
IF tmpB3 > 191 THEN
tmpB3 = 128
ENDIF
SENDDATA addr, shadowram(tmpB3), 3
NEXT addr
DELAY_MS 50
NEXT tmpB2
ENDSUB


' Use: e.g. SCROLL_RIGHT DispNo(1-4)

SUB SCROLL_RIGHT
cs = __PARAM1
FOR tmpB2 = 64 TO 1 STEP -2 ' Scroll right from left side off display to center of disply
FOR addr = 0 TO 63
tmpB3 = tmpB2 + addr
SENDDATA addr, shadowram(tmpB3), cs
NEXT addr
DELAY_MS 50
NEXT tmpB2
FOR tmpB2 = 64 TO 1 STEP -2 ' Scroll right from center of display to right side off display
FOR addr = 0 TO 63
tmpB3 = tmpB2 + addr
tmpB3 = tmpB3 - 64
IF tmpB3 > 63 THEN
tmpB3 = 0
ENDIF
SENDDATA addr, shadowram(tmpB3), cs
NEXT addr
DELAY_MS 50
NEXT tmpB2
ENDSUB


' Use: CHIPSELECT dispNo(1-4)

SUB CHIPSELECT
IF __PARAM1 = 1 THEN
LOW CS_1
ELSEIF __PARAM1 = 2 THEN
LOW CS_2
ELSEIF __PARAM1 = 3 THEN
LOW CS_3
ENDIF
ENDSUB

' Use: CHIPFREE dispNo(1-4)

SUB CHIPFREE
IF __PARAM1 = 1 THEN
HIGH CS_1
ELSEIF __PARAM1 = 2 THEN
HIGH CS_2
ELSEIF __PARAM1 = 3 THEN
HIGH CS_3
ENDIF
ENDSUB

' Use: COMMAND CommandCode, dispNo(1-3)

SUB COMMAND
cmd = __PARAM1
cs = __PARAM2
CHIPSELECT cs ' Select chip
SHIFTOUT ht1632_data, ht1632_wrclk, MSBFIRST, HT1632_ID_CMD\3
SHIFTOUT ht1632_data, ht1632_wrclk, MSBFIRST, cmd
SHIFTOUT ht1632_data, ht1632_wrclk, MSBFIRST, 0\1
CHIPFREE cs
ENDSUB

' Use: ht1632_senddata Address, Data, dispNo(1-3)

SUB SENDDATA
addr = __PARAM1
data_ = __PARAM2
cs = __PARAM3
CHIPSELECT cs ' Select chip
SHIFTOUT ht1632_data, ht1632_wrclk, MSBFIRST, HT1632_ID_WR\3
SHIFTOUT ht1632_data, ht1632_wrclk, MSBFIRST, addr\7
SHIFTOUT ht1632_data, ht1632_wrclk, MSBFIRST, data_\4
CHIPFREE cs
ENDSUB

SUB SETUP
CHIPFREE 1 'Disable all 3 Displays
CHIPFREE 2
CHIPFREE 3
FOR dispNo = 1 TO 3 'Setup commands for (3) Displays
COMMAND SYSDIS, dispNo ' Disable system
COMMAND COMS10, dispNo ' 8*32, PMOS drivers
COMMAND MSTMD, dispNo ' Master Mode
COMMAND SYSON, dispNo ' System on
COMMAND LEDON, dispNo ' LEDs on
COMMAND BLOFF, dispNo ' Blink off
FOR ctr = 0 TO 191
SENDDATA ctr, 0, dispNo ' clear all the displays!
NEXT ctr
NEXT dispNo
FOR ctr = $A0 TO $AF ' set the PWM control variable
tmpB1 = ctr - $A0
PWM_B(tmpB1) = ctr
NEXT ctr
ENDSUB


Pad0:
DATA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Picture1: 'Picture1 Label (sideways picture)
DATA %11111111
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %11111111

DATA %11111111
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %11111111

DATA %11111111
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %10000001
DATA %11111111

Pad1:
DATA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0



ASCII_Set:

'================================================= =====
'Number_Data: $20-$3F !"#$%&'()*+,-./0123456789:;<=>?
'================================================= =====
Number_Data:

Space:
DATA %00000000 'Space
DATA %00000000
DATA %00000000
DATA %00000000
DATA %00000000
DATA %00000000

Exclamation:
DATA %00000000 '!
DATA %00000000
DATA %01001111
DATA %00000000
DATA %00000000
DATA %00000000

DoubleQuote:
DATA %00000000 '"
DATA %00000111
DATA %00000000
DATA %00000111
DATA %00000000
DATA %00000000

PoundSign:
DATA %00010100 '#
DATA %01111111
DATA %00010100
DATA %01111111
DATA %00010100
DATA %00000000

DollarSign:
DATA %00100100 '$
DATA %00101010
DATA %01111111
DATA %00101010
DATA %00010010
DATA %00000000

PercentSign:
DATA %00100011 '%
DATA %00010011
DATA %00001000
DATA %01100100
DATA %01100010
DATA %00000000

AndSign:
DATA %00110110 '&
DATA %01001001
DATA %01010101
DATA %00100010
DATA %01010000
DATA %00000000

SingleQuote:
DATA %00000000 ''
DATA %00000101
DATA %00000011
DATA %00000000
DATA %00000000
DATA %00000000

OpenParenthesis:
DATA %00000000 '(
DATA %00011100
DATA %00100010
DATA %01000001
DATA %00000000
DATA %00000000

CloseParenthesis:
DATA %00000000 ')
DATA %01000001
DATA %00100010
DATA %00011100
DATA %00000000
DATA %00000000

Star:
DATA %00010100 '*
DATA %00001000
DATA %00111110
DATA %00001000
DATA %00010100
DATA %00000000

PlusSign:
DATA %00001000 '+
DATA %00001000
DATA %00111110
DATA %00001000
DATA %00001000
DATA %00000000

Comma:
DATA %00000000 ',
DATA %01010000
DATA %00110000
DATA %00000000
DATA %00000000
DATA %00000000

NegativeSign:
DATA %00001000 '-
DATA %00001000
DATA %00001000
DATA %00001000
DATA %00001000
DATA %00000000

DecmialPoint:
DATA %00000000 '.
DATA %01100000
DATA %01100000
DATA %00000000
DATA %00000000
DATA %00000000

ForwardSlash:
DATA %00100000 '/
DATA %00010000
DATA %00001000
DATA %00000100
DATA %00000010
DATA %00000000

Number_0:
DATA %00111110 '0
DATA %01000101
DATA %01001001
DATA %01010001
DATA %00111110
DATA %00000000

Number_1:
DATA %00000000 '1
DATA %01000010
DATA %01111111
DATA %01000000
DATA %00000000
DATA %00000000

Number_2:
DATA %01000010 '2
DATA %01100001
DATA %01010001
DATA %01001001
DATA %01000110
DATA %00000000

Number_3:
DATA %00100001 '3
DATA %01000001
DATA %01000101
DATA %01001011
DATA %00110001
DATA %00000000

Number_4:
DATA %00011000 '4
DATA %00010100
DATA %00010010
DATA %01111111
DATA %00010000
DATA %00000000

Number_5:
DATA %00100111 '5
DATA %01000101
DATA %01000101
DATA %01000101
DATA %00111001
DATA %00000000

Number_6:
DATA %00111100 '6
DATA %01001010
DATA %01001001
DATA %01001001
DATA %00110000
DATA %00000000

Number_7:
DATA %00000001 '7
DATA %01111001
DATA %00000101
DATA %00000011
DATA %00000011
DATA %00000000

Number_8:
DATA %00110110 '8
DATA %01001001
DATA %01001001
DATA %01001001
DATA %00110110
DATA %00000000

Number_9:
DATA %00000110 '9
DATA %01001001
DATA %01001001
DATA %00101001
DATA %00011110
DATA %00000000

Colon:
DATA %00000000 ':
DATA %00110110
DATA %00110110
DATA %00000000
DATA %00000000
DATA %00000000

Semicolon:
DATA %00000000 ';
DATA %01010110
DATA %00110110
DATA %00000000
DATA %00000000
DATA %00000000

LessThan:
DATA %00001000 '<
DATA %00010100
DATA %00100010
DATA %01000001
DATA %00000000
DATA %00000000

Equal:
DATA %00010100 '=
DATA %00010100
DATA %00010100
DATA %00010100
DATA %00010100
DATA %00000000

GreaterThan:
DATA %00000000 '>
DATA %01000001
DATA %00100010
DATA %00010100
DATA %00001000
DATA %00000000

Question:
DATA %00000010 '?
DATA %00000001
DATA %01010001
DATA %00001001
DATA %00000110
DATA %00000000

'================================================= =========
'UC_Aplhabet_Data: $40-$5F @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
'================================================= =========
UC_Aplhabet_Data:

AtSign:
DATA %00110000 '@
DATA %01001001
DATA %01111001
DATA %01000001
DATA %00111110
DATA %00000000

UC_Letter_A:
DATA %01111100 'A
DATA %00010010
DATA %00010001
DATA %00010010
DATA %01111100
DATA %00000000

UC_Letter_B:
DATA %01000001 'B
DATA %01111111
DATA %01001001
DATA %01001001
DATA %00110110
DATA %00000000

UC_Letter_C:
DATA %00111110 'C
DATA %01000001
DATA %01000001
DATA %01000001
DATA %00100010
DATA %00000000

UC_Letter_D:
DATA %01000001 'D
DATA %01111111
DATA %01000001
DATA %01000001
DATA %00111110
DATA %00000000

UC_Letter_E:
DATA %01111111 'E
DATA %01001001
DATA %01001001
DATA %01000001
DATA %01000001
DATA %00000000

UC_Letter_F:
DATA %01111111 'F
DATA %00001001
DATA %00001001
DATA %00000001
DATA %00000001
DATA %00000000

UC_Letter_G:
DATA %00111110 'G
DATA %01000001
DATA %01001001
DATA %01001001
DATA %00111010
DATA %00000000

UC_Letter_H:
DATA %01111111 'H
DATA %00001000
DATA %00001000
DATA %00001000
DATA %01111111
DATA %00000000

UC_Letter_I:
DATA %00000000 'I
DATA %01000001
DATA %01111111
DATA %01000001
DATA %00000000
DATA %00000000

UC_Letter_J:
DATA %00100000 'J
DATA %01000000
DATA %01000001
DATA %00111111
DATA %00000001
DATA %00000000

UC_Letter_K:
DATA %01111111 'K
DATA %00001000
DATA %00010100
DATA %00100010
DATA %01000001
DATA %00000000

UC_Letter_L:
DATA %01111111 'L
DATA %01000000
DATA %01000000
DATA %01000000
DATA %01000000
DATA %00000000

UC_Letter_M:
DATA %01111111 'M
DATA %00000010
DATA %00001100
DATA %00000010
DATA %01111111
DATA %00000000

UC_Letter_N:
DATA %01111111 'N
DATA %00000010
DATA %00000100
DATA %00001000
DATA %01111111
DATA %00000000

UC_Letter_O:
DATA %00111110 'O
DATA %01000001
DATA %01000001
DATA %01000001
DATA %00111110
DATA %00000000

UC_Letter_P:
DATA %01111111 'P
DATA %00001001
DATA %00001001
DATA %00001001
DATA %00000110
DATA %00000000

UC_Letter_Q:
DATA %00111110 'Q
DATA %01000001
DATA %01010001
DATA %00100001
DATA %01011110
DATA %00000000

UC_Letter_R:
DATA %01111111 'R
DATA %00001001
DATA %00011001
DATA %00101001
DATA %01000110
DATA %00000000

UC_Letter_S:
DATA %00100110 'S
DATA %01001001
DATA %01001001
DATA %01001001
DATA %00110010
DATA %00000000

UC_Letter_T:
DATA %00000001 'T
DATA %00000001
DATA %01111111
DATA %00000001
DATA %00000001
DATA %00000000

UC_Letter_U:
DATA %00111111 'U
DATA %01000000
DATA %01000000
DATA %01000000
DATA %00111111
DATA %00000000

UC_Letter_V:
DATA %00000111 'V
DATA %00011000
DATA %01100000
DATA %00011000
DATA %00000111
DATA %00000000

UC_Letter_W:
DATA %01111111 'W
DATA %00100000
DATA %00010000
DATA %00100000
DATA %01111111
DATA %00000000

UC_Letter_X:
DATA %01100011 'X
DATA %00010100
DATA %00001000
DATA %00010100
DATA %01100011
DATA %00000000

UC_Letter_Y:
DATA %00000011 'Y
DATA %00000100
DATA %01111000
DATA %00000100
DATA %00000011
DATA %00000000

UC_Letter_Z:
DATA %01100001 'Z
DATA %01010001
DATA %01001001
DATA %01000101
DATA %01000011
DATA %00000000

OpenBracket:
DATA %00000000 '[
DATA %01111111
DATA %01000001
DATA %01000001
DATA %00000000
DATA %00000000

BackSlash:
DATA %00000010 '\
DATA %00000100
DATA %00001000
DATA %00010000
DATA %00100000
DATA %00000000

CloseBracket:
DATA %00000000 ']
DATA %01000001
DATA %01000001
DATA %01111111
DATA %00000000
DATA %00000000

Caret:
DATA %00000100 '^
DATA %00000010
DATA %00000001
DATA %00000010
DATA %00000100
DATA %00000000

UnderBar:
DATA %01000000 '_
DATA %01000000
DATA %01000000
DATA %01000000
DATA %01000000
DATA %00000000

'================================================= ==========
'LC_Aplhabet_Data: $60-$7f `abcdefghijklmnopqrstuvwxyz{|}~
'================================================= ==========
LC_Aplhabet_Data:

OpeningSingleQuote:
DATA %00000000 '`
DATA %00000001
DATA %00000010
DATA %00000100
DATA %00000000
DATA %00000000

LC_Letter_A:
DATA %00100000 'a
DATA %01010100
DATA %01010100
DATA %01010100
DATA %01111000
DATA %00000000

LC_Letter_B:
DATA %01111111 'b
DATA %01001000
DATA %01001000
DATA %01001000
DATA %00110000
DATA %00000000

LC_Letter_C:
DATA %00111000 'c
DATA %01000100
DATA %01000100
DATA %01000100
DATA %01000100
DATA %00000000

LC_Letter_D:
DATA %00110000 'd
DATA %01001000
DATA %01001000
DATA %01001000
DATA %01111111
DATA %00000000

LC_Letter_E:
DATA %00111000 'e
DATA %01010100
DATA %01010100
DATA %01010100
DATA %01011000
DATA %00000000

LC_Letter_F:
DATA %00000000 'f
DATA %00001000
DATA %01111110
DATA %00001001
DATA %00000010
DATA %00000000

LC_Letter_G:
DATA %01001000 'g
DATA %01010100
DATA %01010100
DATA %01010100
DATA %00111100
DATA %00000000

LC_Letter_H:
DATA %01111111 'h
DATA %00001000
DATA %00001000
DATA %00001000
DATA %01110000
DATA %00000000

LC_Letter_I:
DATA %00000000 'i
DATA %00000000
DATA %01111010
DATA %00000000
DATA %00000000
DATA %00000000

LC_Letter_J:
DATA %00100000 'j
DATA %01000000
DATA %01000000
DATA %00111101
DATA %00000000
DATA %00000000

LC_Letter_K:
DATA %00000000 'k
DATA %01111111
DATA %00010000
DATA %00101000
DATA %01000100
DATA %00000000

LC_Letter_L:
DATA %00000000 'l
DATA %01000001
DATA %01111111
DATA %01000000
DATA %00000000
DATA %00000000

LC_Letter_M:
DATA %01111100 'm
DATA %00000100
DATA %00111000
DATA %00000100
DATA %01111100
DATA %00000000

LC_Letter_N:
DATA %01111100 'n
DATA %00001000
DATA %00000100
DATA %00000100
DATA %01111000
DATA %00000000

LC_Letter_O:
DATA %00111000 'o
DATA %01000100
DATA %01000100
DATA %01000100
DATA %00111000
DATA %00000000

LC_Letter_P:
DATA %01111100 'p
DATA %00010100
DATA %00010100
DATA %00010100
DATA %00001000
DATA %00000000

LC_Letter_Q:
DATA %00001000 'q
DATA %00010100
DATA %00010100
DATA %00010100
DATA %01111100
DATA %00000000

LC_Letter_R:
DATA %01111100 'r
DATA %00001000
DATA %00000100
DATA %00001000
DATA %00000000
DATA %00000000

LC_Letter_S:
DATA %01001000 's
DATA %01010100
DATA %01010100
DATA %01010100
DATA %00100100
DATA %00000000

LC_Letter_T:
DATA %00000100 't
DATA %00000100
DATA %00111111
DATA %01000100
DATA %00100100
DATA %00000000

LC_Letter_U:
DATA %00111100 'u
DATA %01000000
DATA %01000000
DATA %01000000
DATA %00111100
DATA %00000000

LC_Letter_V:
DATA %00011100 'v
DATA %00100000
DATA %01000000
DATA %00100000
DATA %00011100
DATA %00000000

LC_Letter_W:
DATA %00111100 'w
DATA %01000000
DATA %00110000
DATA %01000000
DATA %00111100
DATA %00000000

LC_Letter_X:
DATA %01000100 'x
DATA %00101000
DATA %00010000
DATA %00101000
DATA %01000100
DATA %00000000

LC_Letter_Y:
DATA %00000100 'y
DATA %01001000
DATA %00110000
DATA %00001000
DATA %00000100
DATA %00000000

LC_Letter_Z:
DATA %01000100 'z
DATA %01100100
DATA %01010100
DATA %01001100
DATA %01000100
DATA %00000000

OpeningCurlyBrace:
DATA %00001000 '{
DATA %00110110
DATA %01000001
DATA %01000001
DATA %00000000
DATA %00000000

VerticalLine:
DATA %00000000 '|
DATA %00000000
DATA %01111111
DATA %00000000
DATA %00000000
DATA %00000000

ClosingCurlyBrace:
DATA %00000000 '}
DATA %01000001
DATA %01000001
DATA %00110110
DATA %00001000
DATA %00000000

Tilde:
DATA %00000100 '~
DATA %00000010
DATA %00000010
DATA %00000010
DATA %00000001
DATA %00000000

Delete:
DATA %01111111 '$7F
DATA %01000001
DATA %01000001
DATA %01000001
DATA %01111111
DATA %00000000

'================================================= ====
' ASCII Character Set
'================================================= ====
' Char Dec Hex Description
' SP 32 20 Space
' ! 33 21 Exclamation mark
' " 34 22 Quotation mark
' # 35 23 Cross hatch (number sign)
' $ 36 24 Dollar sign
' % 37 25 Percent sign
' & 38 26 Ampersand
' ' 39 27 Closing single quote (apostrophe)
' ( 40 28 Opening parentheses
' ) 41 29 Closing parentheses
' * 42 2a Asterisk (star, multiply)
' + 43 2b Plus
' , 44 2c Comma
' - 45 2d Hyphen, dash, minus
' . 46 2e Period
' / 47 2f Slant (forward slash, divide)
' 0 48 30 Zero
' 1 49 31 One
' 2 50 32 Two
' 3 51 33 Three
' 4 52 34 Four
' 5 53 35 Five
' 6 54 36 Six
' 7 55 37 Seven
' 8 56 38 Eight
' 9 57 39 Nine
' : 58 3a Colon
' ; 59 3b Semicolon
' < 60 3c Less than sign
' = 61 3d Equals sign
' > 62 3e Greater than sign
' ? 63 3f Question mark
' @ 64 40 At-sign
' A 65 41 Uppercase A
' B 66 42 Uppercase B
' C 67 43 Uppercase C
' D 68 44 Uppercase D
' E 69 45 Uppercase E
' F 70 46 Uppercase F
' G 71 47 Uppercase G
' H 72 48 Uppercase H
' I 73 49 Uppercase I
' J 74 4a Uppercase J
' K 75 4b Uppercase K
' L 76 4c Uppercase L
' M 77 4d Uppercase M
' N 78 4e Uppercase N
' O 79 4f Uppercase O
' P 80 50 Uppercase P
' Q 81 51 Uppercase Q
' R 82 52 Uppercase R
' S 83 53 Uppercase S
' T 84 54 Uppercase T
' U 85 55 Uppercase U
' V 86 56 Uppercase V
' W 87 57 Uppercase W
' X 88 58 Uppercase X
' Y 89 59 Uppercase Y
' Z 90 5a Uppercase Z
' [ 91 5b Opening square bracket
' \ 92 5c Reverse slant (Backslash)
' ] 93 5d Closing square bracket
' ^ 94 5e Caret (Circumflex)
' _ 95 5f Underscore
' ` 96 60 Opening single quote
' a 97 61 Lowercase a
' b 98 62 Lowercase b
' c 99 63 Lowercase c
' d 100 64 Lowercase d
' e 101 65 Lowercase e
' f 102 66 Lowercase f
' g 103 67 Lowercase g
' h 104 68 Lowercase h
' i 105 69 Lowercase i
' j 106 6a Lowercase j
' k 107 6b Lowercase k
' l 108 6c Lowercase l
' m 109 6d Lowercase m
' n 110 6e Lowercase n
' o 111 6f Lowercase o
' p 112 70 Lowercase p
' q 113 71 Lowercase q
' r 114 72 Lowercase r
' s 115 73 Lowercase s
' t 116 74 Lowercase t
' u 117 75 Lowercase u
' v 118 76 Lowercase v
' w 119 77 Lowercase w
' x 120 78 Lowercase x
' y 121 79 Lowercase y
' z 122 7a Lowercase z
' { 123 7b Opening curly brace
' | 124 7c Vertical line
' } 125 7d Closing curly brace
' ~ 126 7e Tilde (approximate)
' DEL 177 7f Delete (rubout), cross-hatch box

hinv
11-20-2010, 06:20 AM
No, the propeller will not run SX code as it is a completely different architecture. You will need to learn spin, and for that I would recommend the Propeller Education Kit.

As for the dot matrix display, I do not know. It might be helpfull to check OBEX to see if someone has made a driver for it: http://obex.parallax.com/

I hope that helps. Welcome to the propeller. There is many helpful people here.

Doug

Mike Green
11-20-2010, 06:33 AM
The short answer is "no you can't".

Your program is written in SX-Basic. PropBasic is similar and written by the same author, but it's not anywhere near identical. You'll have to sit down with the two manuals and compare them, then go through your program, translating what you can and rewriting the rest. The processors are different as well and those differences may need some care. For example, the SX is an 8-bit processor and arithmetic is done on 8-bit values. SX-Basic allows you to do 16-bit operations, but it's really done as 8-bit double precision. The Propeller does 32-bit arithmetic even though you might be working on byte values.

roycarlson
11-30-2010, 06:50 PM
Does Tim Gilmore know you posted his code on this forum? I hope so...