; ; Initialize and print to 3 LCDs ; Tom 4/12/07 ; note: mod refers to the LCD modules constants [[ADCON $fc1][modrs $01][mod1 $02][mod2 $04][mod3 $08]] global [mod-sel] to powerup write ADCON 0 ;make porta digital write porta-ddr 0 ;make porta outputs write portb-ddr 0 ;make portb outputs setmod-sel mod1 init-mod ;set module-select for 1 and initialize it setmod-sel mod2 init-mod ;set module-select for 2 and initialize it setmod-sel mod3 init-mod ;set module-select for 3 and initialize it end to startup setmod-sel mod1 cc 1 dd 32 dd 32 dd 32 ;3spaces dd 72 dd 101 dd 108 dd 108 dd 111 ;Hello setmod-sel mod2 cc 1 dd 32 dd 32 dd 32 ;3spaces dd 72 dd 97 dd 112 dd 112 dd 121 ;Happy setmod-sel mod3 cc 1 dd 32 dd 32 dd 32 ;3spaces dd 87 dd 111 dd 114 dd 108 dd 100 ;World end to init-mod cc $1C cc $14 cc $28 cc $4f cc $60 ;Initialize the LCD cc 1 ;clear the screen end to cc :xx ;send a command data byte write porta 0 ;clear RS pin to write commands write portb :xx write porta mod-sel ;clock the module enable pin mwait 1 write porta 0 wait 2 end to dd :xx ;send character data byte write porta modrs ;clear RS pin to write commands write portb :xx write porta (mod-sel + modrs) ;clock the module enable pin mwait 1 write porta modrs ;clock the module enable pin end