PDA

View Full Version : the need for speed



george miyagi
07-25-2005, 12:20 AM
hi
i am controlling 6 daisy-chained max7219s, via an external application, written in Processing. The thing is, the data coming in is comnig in really slowly. Would appreciate it if anyone had any ideas as to why?

Could it be because i'm sending 2 wait strings (the "*"'s)? But without them it doesn't seem to work.
also, i have tried sending other data than binary to the BS, but can't seem to get it to work....

here's the code:





progPin CON 16 ' The programming PIN
ledCmd VAR BYTE
serStr VAR BYTE(10)

Clock CON 0 ' shift clock to MAX7219
DPin CON 1 ' shift data to MAX7219
Load CON 2 '


'======Constants==========================

Decode CON $09 ' bcd decode
Intensity CON $0A ' brightness
Scan CON $0B ' scan (column) limit
ShutDn CON $0C ' shutdown (1 = on)
Test CON $0F ' display test mode

Yes CON 1
No CON 0


'==========Variables=========================

index VAR NIB ' loop counter
idxOdd VAR index.BIT0 ' is index odd? (1 = yes)
d7219 VAR BYTE ' data for MAX7219
char VAR BYTE ' character ee address
col VAR NIB ' column value
row VAR NIB ' row value
a VAR WORD ' ee pointer
b VAR BYTE
' Baud CON 16468
Baud CON 84
' Baud CON 32

'=====EEPROM Data=============================

'=========Initialization========================== ============
'++++++This is edited code++++
'++++ LOOKUP index,[Scan,7,Intensity,7,ShutDn,1],d7219 +++++
'================================================= ==============
LOW Load
Initialize:
DIRL = %111 ' clock, data and load pins
FOR index = 0 TO 5
LOOKUP index,[Scan,7,Intensity,7,ShutDn,1],d7219
SHIFTOUT Dpin,Clock,MSBFIRST,[d7219]
IF idxOdd = No THEN NoLoad
PULSOUT Load,3 ' load parameter
NoLoad:
NEXT
'==========Clear buffers========================================

'================================================= ==============
'DATA

Main:

get_Data:

FOR col = 1 TO 8

SERIN progPin, Baud, [WAIT ("*"), BIN serStr(0), BIN serStr(1), BIN serStr(2), BIN serStr(3), BIN serStr(4), BIN serStr(5)] ' wait for Comm
FOR b=0 TO 5
SHIFTOUT Dpin,Clock,MSBFIRST,[col, serStr(b)]
NEXT
PULSOUT Load,3
SEROUT progPin, Baud, ' SEND the serial DATA

NEXT



GOTO Main
'================================================= ===============





and here's a snipped from processing:




for (row=0;row<8;row++){
print (row);
for (matrix=5;matrix>-1;matrix--){
delay(40);
output = (picData[matrix][row]);
myPort.write("*");
myPort.write(output);
myPort.write("*");
}

}
}


Post Edited (george miyagi) : 7/24/2005 4:47:48 PM GMT

Bean
07-25-2005, 12:34 AM
Why are you sending a "*" after the data ? That could get the receiver out-of-sync.
Bean.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95

http://www.parallax.com/detail.asp?product_id=30012

Product web site: www.sxvm.com (http://www.sxvm.com)

"One experiment is worth a thousand theories"
·

george miyagi
07-25-2005, 01:01 AM
I'm not sure (and can't really remember how i came to the conclusion to put it in) , but without it, it doesn't work. ie. my data comes through garbled.
++++++++

Ammendment:
Hold, that i got it to work without the extra "*" but am still somewhat lacking in speed? how about shifting 16 bits at a time through the serial?

Post Edited (george miyagi) : 7/25/2005 6:03:44 AM GMT