Need Help PIC16F877a programming

Status
Not open for further replies.

yugal0007

Newbie level 6
Joined
Nov 14, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Raipur, INDIA
Activity points
1,413
I have interfaced an LCD and a GPS module to PIC16F877a.
LCD is used in 8-bit mode. GPS is connected to serial port.
I have written code in assembly language for LCD interfacing, but i am facing problem for writing a code for GPS module.
MCU has to continuesly recieve ASCII strings from GPS and display it in LCD (8-bit mode coonected to port D and RS,R/W,E connected to PortE).
Pease someone help me.
Suggest me how to do it. I know just the basics.
or if someone can write code i would be very grateful.
Please reply ASAP.
 

The code is useful. I got only 90% of it.
you wrote
ANSEL=0b00000000;
ANSELH=0b00000000;
I don't get it.
These two are not physical general purpose or specia function registers. than what are this?
please answer.
P.S. you initialized LCD in 4-bit mode, I need it in 8-bit mode. What changes are to be made?
 

ANSEL and ANSELH is for PIC16F887. For PIC16F877A just use ADCON1.

Your LCD connection 8-bit, then program LCD 4-bit is also can running because it will set the D0-D3 to low state.
 

I used ADCON1=0b00000110;
which initializes all the multiplexed analog and digital pins as digital pins.
I used MPLAB IDE (Hi Tech C Compiler). It says error when i replace ANSEL and ANSELH with ADCON1. Here is the error message.

Make: The target "C:\Users\Yugal\CDEEE.obj" is out of date.
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\lite\9.60\bin\picc.exe" -C C:\Users\Yugal\Documents\CDEEE.C -q --chip=16F877A -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Warning [176] C:\Users\Yugal\Documents\CDEEE.C; 206.0 missing newline
Warning [361] C:\Users\Yugal\Documents\CDEEE.C; 72.1 function declared implicit int
Warning [361] C:\Users\Yugal\Documents\CDEEE.C; 172.1 function declared implicit int
Warning [337] C:\Users\Yugal\Documents\CDEEE.C; 205.9 line does not have a newline on the end
Error [800] ; 0. undefined symbol "LVP_OFF"
Error [800] ; 0. undefined symbol "MCLRE_ON"
Error [800] ; 0. undefined symbol "BOREN_OFF"
Error [800] ; 0. undefined symbol "PWRTE_ON"
Error [800] ; 0. undefined symbol "WDTE_OFF"
Error [800] ; 0. undefined symbol "FOSC_HS"

********** Build failed! **********


Which compiler You used??
 




I think you need to do programm the CONFIGURATION WORD (ADDRESS 2007h) ....I think it will solve your program the

These are the correspoding bits of the configuration word register-
CP — DEBUG WRT1 WRT0 CPD LVP BOREN — — PWRTEN WDTEN FOSC1 FOSC0

Good Luck
 

Sorry ....I dont know the assembly much..... but i think you should refer-

https://ww1.microchip.com/downloads/en/DeviceDoc/config.pdf
https://ww1.microchip.com/downloads/en/devicedoc/31027a.pdf


Page No 6 of devicedoc\31027.pdf

have a code like

LIST p = p16C77 ; List Directive,
; Revision History
;
#INCLUDE <P16C77.INC> ; Microchip Device Header File
;
#INCLUDE <MY_STD.MAC> ; File which includes my standard macros
#INCLUDE <APP.MAC> ; File which includes macros specific
; to this application
;
; Specify Device Configuration Bits
;
__CONFIG _XT_OSC & _PWRTE_ON & _BODEN_OFF & _CP_OFF & _WDT_ON
;
org 0x00 ; Start of Program Memory
RESET_ADDR : ; First instruction to execute after a reset
end

hope it will help you out

Good Luck
 
Last edited:
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…