Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LCD Template Code For PIC16F84A (Help)

Status
Not open for further replies.
Nigel Goodwin said:
Is it just me? - you post tutorials on the net, with proven working code and hardware, in use by large numbers of people all over the world. Then someone connects it up differently, blindly bodges about with the code, and wonders why it doesn't work.

This is the LCD equates from the tutorial code, to move it to PortB all you need to do is alter PORTA to PORTB, and TRISA to TRISB - it's that simple. Connect it as shown in the tutorials, alter those two letters - and it works on PortB. Why connect it differently?, if you want it different then write your own code!.

Code:
LCD_PORT	Equ	PORTA
LCD_TRIS	Equ	TRISA
LCD_RS		Equ	0x04			;LCD handshake lines
LCD_RW		Equ	0x06
LCD_E		Equ	0x07

Nigel,

Im sorry if this has upset you.. changing your code and all.. I should have asked you first.

Thanks for bringing up the include. file .. I had forgot about them from the MPLAB tutorial.

Its all good and dandy on PortB now ..if it means anything

Good Deal

PW:rolleyes:
 
I haven't looked too very closely at your code so I apologize ahead of time if I'm off base here.

I'm just wondering if one of your lookup tables may be causing problems by straddling a 256 byte boundary since you're only manipulating PCL and not PCLATH?

Also, speaking of tables, may I show you a very tight and simple alternative for your LCD_HEX routine (from Myke Predko) that doesn't use a lookup table?

Code:
;
LCD_HEX movwf   tmp1            ; save temporarily
        swap    tmp1,W          ; hi nybble in b3..b0
        call    HEX2ASC         ; 
        movf    tmp1,W          ; lo nybble in b3..b0
HEX2ASC andlw   h'0F'           ; 
        addlw   h'36'           ;
        btfsc   STATUS,DC       ;
        addlw   h'07'           ;
        addlw   0-6             ; ($FA)
        goto    LCD_Char        ; print ASCII nybble
There are also much better ways to manage, store, and print strings to your LCD but we'll save those suggestions until after you get past your current problems.

Good luck. Mike
 
Peter_wadley said:
Im sorry if this has upset you.. changing your code and all.. I should have asked you first.

No problem, and I'm not upset, the code is there for anyone to use and change as they require - just that you changed known working code, and then wonder why it doesn't work?.
 
:D All systems GO :D
 

Attachments

  • PC060008.JPG
    PC060008.JPG
    362.2 KB · Views: 171
  • PC060010.JPG
    PC060010.JPG
    354.9 KB · Views: 136
  • PC060011.JPG
    PC060011.JPG
    359.3 KB · Views: 147
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top