Look on a forum fo january 7th that D n T posted (me)
I am using the portC pins to run it.
This is the good bits from it:
( I cut and pasted it to a text file and then from that to here)
ONCE AGIAN THANKS TO HIPPY
I'm playing with Hippys LCD code on a 40x and want to use the portc pins instead of the normal output pins, I believe it will make programming easier.
I don't know how to convert this line to portc...
pulsout EN,1
EN is the symbol for output 3
I need to find out how to do the let pins or the let dirs in a portc situation.
alternately , Hippy how do I do it, please
Fowkc Posted - 7 January 2007 15:44
--------------------------------------------------------------------------------
The manual says it's not possible:
"It is not possible to access the portc pins with any other 'output' type commands (sound, serout, pulsout etc)." (axe001_xparts.pdf)
Perhaps there's a way to do it by poking approprite registers?
Phil75 Posted - 7 January 2007 17:40
--------------------------------------------------------------------------------
you could use
high portc 3
pause 1
low portc 3
Edited by - Phil75 on 07/01/2007 17:44:51
Fowkc Posted - 7 January 2007 17:59
--------------------------------------------------------------------------------
That will cause a 1ms = 1000us pause on the PORTC pin, whereas the PULSOUT command works in 10us units.
You can, however, use PULSOUT to create "dummy" pauses of 10us units. So:
HIGH PORTC 1PULSOUT 1,1 'Dummy pause on normal outputsLOW PORTC 1
will do the job. However, this means you're effectively using two pins instead of one, and there might be issues with the processing time of the HIGH and LOW statements depending on your application.
Phil75 Posted - 7 January 2007 18:36
--------------------------------------------------------------------------------
Yep know it is 1ms but if it's for an occasional clock then might not matter too much. Or this
high portc 3
for b0=0 to n:next
low portc 3
hippy Posted - 7 January 2007 19:6
--------------------------------------------------------------------------------
The 'E' strobe is only 10uS anyway, so there's no need for any delay. A straight-forward ...
High PortC 3 Low PortC 3
should do the job.
kym Posted - 8 January 2007 1:5
--------------------------------------------------------------------------------
DnT Try this,have MODIFIED Hippy's code
; HIPPY'S MODIFIED CODE FOR 28X LCD PORTC
SYMBOL RS = 2 ; 0 = Command 1 = Data
SYMBOL DB4 = 4 ; LCD Data Line 4
SYMBOL DB5 = 5 ; LCD Data Line 5
SYMBOL DB6 = 6 ; LCD Data Line 6
SYMBOL DB7 = 7 ; LCD Data Line 7
SYMBOL RSCMDmask = %00000000 ; Select Command register
SYMBOL RSDATmask = %00000100 ; Select Data register
SYMBOL get = b10
SYMBOL bite = b11
SYMBOL rsbit = b12
let dirsc=%11111100 ' Set PORTC 6 Outputs and 2 Inputs
PowerOnReset:
GOSUB InitialiseLcd
DisplayTopLine:
pause 200
EEPROM 6,("Hello"
FOR get = 6 TO 10
READ get,bite
GOSUB SendDataByte
NEXT
MoveCursorToStartOfSecondLine:
let bite = $C0
GOSUB SendCmdByte
DisplayBottomLine:
EEPROM 11,("World!"
FOR get = 11 TO 16
READ get,bite
GOSUB SendDataByte
NEXT
END
InitialiseLcd:
FOR get = 0 TO 5
READ get,bite
GOSUB SendInitCmdByte
NEXT
' Nibble commands - To initialise 4-bit mode
EEPROM 0,( $33 ) ; %0011---- %0011---- 8-bit / 8-bit
EEPROM 1,( $32 ) ; %0011---- %0010---- 8-bit / 4-bit
' Byte commands - To configure the LCD
EEPROM 2,( $28 ) ; %00101000 %001LNF00 Display Format
EEPROM 3,( $0C ) ; %00001100 %00001DCB Display On
EEPROM 4,( $06 ) ; %00000110 %000001IS Cursor Move
; L : 0 = 4-bit Mode 1 = 8-bit Mode
; N : 0 = 1 Line 1 = 2 Lines
; F : 0 = 5x7 Pixels 1 = N/A
; D : 0 = Display Off 1 = Display On
; C : 0 = Cursor Off 1 = Cursor On
; B : 0 = Cursor Steady 1 = Cursor Flash
; I : 0 = Dec Cursor 1 = Inc Cursor
; S : 0 = Cursor Move 1 = Display Shift
EEPROM 5,( $01 ) ; Clear Screen
RETURN
SendInitCmdByte:
pause 15 ; Delay 15mS
SendCmdByte:
rsbit = RSCMDmask ; Send to Command register
SendDataByte:
let b3=bite & %11110000 | rsbit ; Put MSB out first
pinsc =b3
high portc 3 ; Pulseout on PIN 3
low portc 3
let b3=bite * %00010000 | rsbit ; Put LSB out second
pinsc =b3
high portc 3 ; Pulseouton PIN 3
low portc 3
rsbit = RSDATmask ; Send to Data register next
RETURN
B3 can be any variable , This is needed because this line don,t work on PORTC.
Kym
Edited by - D n T on 30/06/2007 13:18:30