PDA

View Full Version : How to make display move left and right



chai98a
- 21st February 2010, 00:09
I did try to used dot matrix 8x8 display, niw i can show number on dot matrix
next step i need to make displsy move left/right
How have idea pls help

pls see our file attached

Art
- 21st February 2010, 00:48
You haven't provided a picbasic source file.
A hex file is of no use to anyone trying to help you.

but in short, start printing from an offset to the data you are printing (to move it left and right).

ie. the data (hello world) starts at offset of zero "h".
print from offset 1 ("ello world") and you just moved one step right (display moved left).
Same if you are dealing with graphics.

chai98a
- 21st February 2010, 02:24
hi friend's,I did save in attached file , basic code , proteus sim

chai98a
- 21st February 2010, 07:47
Hi frend here is my code


' FONT OF DOT MATRIX
EEPROM 0,[0,127,32,16,0] ' 1
EEPROM 5,[49,73,73,73,39] ' 2
EEPROM 10,[54,73,73,65,34] ' 3
EEPROM 15,[4,127,36,20,12] '4
EEPROM 20,[70,73,73,73,122] '5
EEPROM 25,[38,73,73,73,62] '6
EEPROM 30,[96,80,72,71,64] ' 7
EEPROM 35,[54,73,73,73,54] ' 8
EEPROM 40,[62,73,73,73,50] '9
EEPROM 45,[62,65,65,65,62] '0

include "modedefs.bas"
' -----[ Program Description ]---------------------------------------------
' 4 Sets of 8 LED's (32 total). Each Dig# able to have an 8 bit number
' assigned to it.

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

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


symbol DOUT = PORTb.0 'line for data input connected to RC5
symbol CLK = PORTb.2 'CLK line connected to pin RC3
symbol Load = PORTb.1
Digit var byte
X Var byte
FONT_N VAR BYTE
VALUE VAR WORD
VALUE_SHOW VAR BYTE
DOT_DATA VAR BYTE
loaddata VAR BYTE
N VAR BYTE
I VAR BYTE

' -----[ Constants ]-------------------------------------------------------
IsLow CON 0
IsHigh CON 1

' -----[ Variables ]-------------------------------------------------------
COUNter var byte
' -----[ EEPROM Data ]-----------------------------------------------------

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

' -----[ Program Code ]----------------------------------------------------
Begin:

GOSUB DecodeMode
GOSUB ShutDownMode
GOSUB ScanLimit
GOSUB Intensity
' gosub displaytest
VALUE = 4513
FOR I = 3 TO 0 STEP -1
N = VALUE Dig I ' Get digit to display
GoSub Display1 ' Display the digit

Continue:
SELECT CASE loaddata
CASE 1
DOT_DATA = 0
CASE 2
DOT_DATA = 5
CASE 3
DOT_DATA = 10
CASE 4
DOT_DATA = 15
CASE 5
DOT_DATA = 20
CASE 6
DOT_DATA = 25
CASE 7
DOT_DATA = 30
CASE 8
DOT_DATA = 35
CASE 9
DOT_DATA = 40
CASE 0
DOT_DATA = 45
CASE ELSE
GOTO Begin
END SELECT

For x = 1 TO 5
READ DOT_DATA, VALUE_SHOW

LOW Load
ShiftOut DOUt,clk,MSBFIRST,[X,VALUE_SHOW]
HIGH Load
PAUSE 10
pause 250
DOT_DATA=DOT_DATA + 1
NEXT X


NEXT I
I = 0
GOTO BEGIN

Display1: ' looup data for 7 seg
LookUp N, [0,1,2,3,4,5,6,7,8,9],loaddata
Return
' Test the display by writting 8's to each digit and scrolling them across
'=========================
'digit = 8
'For x = 1 TO 8

'ShiftOut DOUt,clk,MSBFIRST,[digit,$67] '$67 = p

'PulsOut Load,10
'Pause 500
'ShiftOut DOUt,clk,MSBFIRST,[digit,$00]
'PulsOut Load,10
'digit = digit - 1
'Next


GOTO continue
END
' NEXT


' -----[ Subroutines ]-----------------------------------------------------
DecodeMode:
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[$0900\16]
PulsOut Load,10
'HIGH Load
'PAUSE 20
RETURN
'Set shutdown mode so device is active
ShutDownMode:
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[$0C01\16] ' Reg. C normal operate/Shutdown OFF
PulsOut Load,10

RETURN
'Set scan limit mode for three digits
ScanLimit:
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[$0B07\16] ' 07 = scan 8 digit ,04 scan 4 digit
PulsOut Load,10

RETURN
'Set intensity of LEdDs
Intensity:
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[$0A09\16]
PulsOut Load,10

RETURN
'Set Display Test mode active
DisplayTest:
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[$0F01\16]
PulsOut Load,10

RETURN