Lcd programing help

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
lcdhelp
 
Posts: 2
Joined: Wed Nov 06, 2013 11:42 am

Lcd programing help

Post by lcdhelp »

im new to all this
I am looking for some help with my programming. i am new to all this so was wondering if any one would be able to look at my code below and just let me know if there is a problem with it and where im going wrong. i am using hp-488-00-3 development board and i'm using pic16f84.
using a 16x2 line lcd screen. using mp lab with programming

Code: Select all

#DEFINE PAGE0 BCF STATUS,5
#DEFINE PAGE1 BSF STATUS,5

STATUS = 0x03
trisb = 0x06
portb = 0x06

w = 0
f = 1
c = 0
z = 2


     org 4
     org 5
     CLRF portb
     PAGE1
     CLRF trisb
     PAGE0


    
     movlw 0x02    ;MSB     ;Function Set
     movwf portb
     BSF portb,5    ;set B5 high
     BCF portb,5    ;set b5 low
     movlw b'00000000'     
     movwf portb  
nop
 
       movlw 0x08    ;LSB
       movwf portb
      BSF portb,5    ;set b5 high
      BCF portb,5    ;set b5 low
    nop
    nop

       movlw 0x00    ;MSB      ;Display Controller
       movwf portb
      BSF portb,5    ;set b5 high
      BCF portb,5    ;set b5 low
       movlw b'00000000'     
     movwf portb  
     nop

       movlw b'00001111'   ;LSB
       movwf portb
      BSF portb,5     ;set b5 high
      BCF portb,5     ;set b5 low
    nop
    nop


       movlw b'00000000'    ;MSB       ;Clear Display
       movwf portb
      BSF portb,5           ;set b5 high
      BCF portb,5           ;set b5 low
     movlw b'00000000'     
     movwf portb
nop     
     
       movlw b'00000001'    ;LSB
       movwf portb
      BSF portb,5   ;set b5 high
      BCF portb,5   ;set b5 low
    nop
    nop
   
   

   movlw b'00001110'      ; n with scribble
   movwf portb
   BSF portb,5
   BCF portb,5
     movlw b'00000000'     
     movwf portb  
nop

   movlw b'00001110'
   movwf portb
   BSF portb,5
   BCF portb,5
nop
nop

end
Last edited by adafruit_support_bill on Wed Nov 06, 2013 11:52 am, edited 1 time in total.
Reason: Fixed code tags

waltr
 
Posts: 306
Joined: Wed Jun 12, 2013 5:01 pm

Re: Lcd programing help

Post by waltr »

You might get more info here:
http://www.microchip.com/forums/search. ... 20PIC16F84

Start by reading through the threads on 2 line LCDs and 16F PICs (all 16Fs are very similar).

lcdhelp
 
Posts: 2
Joined: Wed Nov 06, 2013 11:42 am

Re: Lcd programing help

Post by lcdhelp »

waltr wrote:You might get more info here:
http://www.microchip.com/forums/search. ... 20PIC16F84

Start by reading through the threads on 2 line LCDs and 16F PICs (all 16Fs are very similar).



your link inst working properly and couldn't find anything that helped, i just need to see one working code and what it meant to do so i can work from that.

waltr
 
Posts: 306
Joined: Wed Jun 12, 2013 5:01 pm

Re: Lcd programing help

Post by waltr »

Oh drat...the link is bad for the Microchip forum search.
But you could just click on 'forum' near the top of that page and do your own search.
Also go check the Microchip App Notes for LCD.

I am assuming that you do have the this LCD from Adafruit:
http://www.adafruit.com/products/181
This uses the very common HD44780 LCD chip. So Google for "HD44780 LCD PIC code" to find lots of projects and code examples. And remember that most of the PIC16Fxx chips are very nearly the same and have very little differences in their code. So do not restrict a search and reading to only the 16F84.
Also, do use the MPLAB Simulator to step through any example code you explore to learn how it works. The MPLAB Simulator is a very good tool for debugging code as well as learning how code works.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”