Change Lcd RS to B port?

ac21

Member
I have a lcd running in 4bit mode successfully on a 20m2 with int setup like so

Code:
      symbol E = c.7
      symbol RS = c.5
int:
let dirsC = %10011111
I tried this with RS on b.6 but failed
Code:
int:
let dirsC = %10001111
let dirsb = %00000010
Is it possible to change RS to the B port side? I need to free up a interrupt pin(c.0 to c.5)
 

lbenson

Senior Member
Post enough code so that we can see all of what you're doing with the LCD. Yes, it is possible to use RS on b.6, but with some possible loss of speed (which might or might not be noticeable).

Note that your statement, "let dirsb = %00000010", sets b.1 as an output and all the rest as inputs. The "0" to the immediate right of the "%" represents b.7, and the other bits count down from there.

Note also that according to "let dirsc = %10001111", c.5 is an input, so can be used for your interrupt.
 

ac21

Member
:eek: typo
let dirsb = %01000000 is what i ment, i also tried "output b.6"

Code:
#picaxe 20m2
#no_data

      symbol E = c.7
      symbol RS = c.4
	symbol key = c.5
	symbol prime = b.1
	symbol start = b.0
	symbol grun = c.6
	SYMBOL Ds18b20       = b.4
      symbol LCD1 = b0
      symbol LCD2 = b1
      symbol loopcounter   = b16
      SYMBOL character1    = b2
	SYMBOL character2    = b3  
	SYMBOL character3    = B4  
	SYMBOL character4    = B5  
	SYMBOL character5    = B6  
	SYMBOL character6    = B7
	SYMBOL hours         = B8
      SYMBOL mins          = B9
	SYMBOL secs          = B10
	SYMBOL day           = B11 
	SYMBOL date          = B12  
	SYMBOL month         = B13
	SYMBOL year          = B14
	SYMBOL PM_AM         = B15 
      symbol Switch_Duration = b18
	symbol genstat       = b19  ; 1 = gen started
	symbol attempts            = b20  ; attempts to start
	symbol xsecs          =b21
	symbol xmins          =b22
	symbol xhours          =b23
	
	
      setint %00100000,%00100000
  
  

	gosub init  		' initialise LCD
	PAUSE 500
Code:
init:

	let pinsC = 0     	      	
      let dirsC = %10001111	
	pause 200         	'
	let pinsC = %00000011   
	pulsout E,1 		
	pause 10 
	setfreq m32       	
	pulsout E,1 		
	pulsout E,1 		
	let pinsC = %00000010   
	pulsout E,1 		
	pulsout E,1 		
	let pinsC = %00001000   
	pulsout E,1 
	let LCD1 = %00001100          
      gosub wrins
	return
c.5 is being used by a switch now for a interrupt in another part of the code
 
Last edited:

nick12ab

Senior Member
What pins are you using for the 4-bit data bus? If you're already using B.6 as part of this 4-bit data bus, then you will need to choose a different pin for RS.
 
Top