alphaone
09-16-02, 12:05 PM
is it possible to use an optrex 4X20 display with the isopod?
is there a place on the board to connect to? or do I need to go through the serial port.
nmitech
09-16-02, 01:03 PM
You can use the PORTA & PORTB to take care the 4x20 LCD. If portA & portB are not available then use serial LCD.
RMDumse
09-16-02, 11:07 PM
You might want to try this code. Hook up is shown in comments:
( ****************************************************************
( I/O PORTS
(
( I/O Ports Assign Function
( ~~~ ~~~~~ ~~~~~~~~~~~~~~~
( I/O PA0 LCD, DB4
( I/O PA1 LCD, DB5
( I/O PA2 LCD, DB6
( I/O PA3 LCD, DB7
( O PA4 LCD, RS (register select. LOW: command, HIGH: data)
( O PA5 LCD, R/W (READ: signal high, WRITE: signal low)
( O PA6 LCD, E (chip enable, active high)
( ****************************************************************
HEX
( ==== Tools ==== )
: <NIB ( d -- d' ) 2* 2* 2* 2* ;
: NIB> ( d -- d' ) 2/ 2/ 2/ 2/ ;
: DSP4@ ( -- d )
70 FB2 ! ( data in )
PA5 ON ( RD high
PA6 ON ( E high enable chip
FB1 @ 0F AND ( read data bus )
PA6 OFF ( E low disable chip
;
: DSP4! ( d -- )
7F FB2 ! ( data out )
PA5 OFF ( WR low
0F AND FB1 @ F0 AND OR FB1 ! ( output data )
PA6 ON ( E high enable chip
PA6 OFF ( E low disable chip
;
: CMD> ( -- d ) PA4 OFF DSP4@ <NIB DSP4@ OR ;
: LCD> ( -- d ) PA4 ON DSP4@ <NIB DSP4@ OR ;
: WNB ( -- ) BEGIN CMD> 80 AND 0= ?TERMINAL OR UNTIL ;
: >CMD ( d -- ) PA4 OFF DUP NIB> DSP4! WNB PA4 OFF DSP4! WNB ;
: >LCD ( d -- ) PA4 ON DUP NIB> DSP4! WNB PA4 ON DSP4! WNB ;
: DSP-INIT ( -- )
3F FB1 ! ( outputs high for R/W.A5 RS.A4 D7.A3,D6.A2,D5.A1,D4.A0)
( low for E.A6
7F FB2 ! ( DDR outputs for E.A6 R/W.A5 RS.A4 D7.A3,D6.A2,D5.A1,D4.A0)
0 FB3 ! ( release all port A lines from PER )
33 >CMD ( reset sequence for
32 >CMD ( four bit interface
28 >CMD ( 4 bit data length; 2 lines; 5x7 dots
6 >CMD ( entry mode set: increment; no shift
F >CMD ( display on; cursor on; blink on
1 >CMD ( display clear
80 >CMD ( cursor in top left position
;
: CLEAR WNB >CMD ;
: HOME WNB 2 >CMD ;
: CRLF WNB C0 >CMD ;
: MOVE-CURSOR WNB 80 OR >CMD ;
: RIGHT-UPPER-CORNER 27 MOVE-CURSOR ;
: CURSOR? WNB CMD> 7F AND ;
: DSP>L WNB 10 >CMD CURSOR? 27 > IF RIGHT-UPPER-CORNER THEN ;
: DSP>R WNB 14 >CMD CURSOR? 27 > IF HOME THEN ;
: DSP-EMIT WNB >LCD ;
: DSP-SPACE BL DSP-EMIT ;
: DSP-SPACES 0 MAX BEGIN ?DUP WHILE 1- DSP-SPACE REPEAT ;
: DSP-TYPE
BEGIN
DUP 0= NOT
WHILE
1- SWAP DUP C@ DSP-EMIT 1+ SWAP
REPEAT
2DROP
;
: .DSP ( n -- ) DUP ABS 0 <# #S SIGN #> DSP-TYPE ;
vBulletin v3.0.7, Copyright ©2000-2012, Jelsoft Enterprises Ltd.