Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

RS232 and LCD PIC16F887

Status
Not open for further replies.

ab.vasanthan

Newbie level 5
Joined
Mar 5, 2012
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,341
Hi everyone,
I am using PIC 16F887 and CCS-C compiler(version 4.093) plugin in MPLAB IDE ... i simulated the design in proteus and .. its working perfectly.. now i am implementing the same design in hardware ... RS232 module is working separately but does not work when LCD is initialised .. in the code i have disabled two lines .. without these lines code is working .. when these codes are made active there is no output in hardware(computer-hyperterminal). LCD connections are in port D rs232 connections use RC6 and RC7.. where is the problem ? why is RS232 not working when LCD is initialised ?
can you please help me ?

Code:
#include <16f887.h>
#device ADC=10
#use delay(clock=16000000)
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use RS232(baud =9600, xmit = PIN_C6, rcv = PIN_C7)
#include <lcd.c>

void main(void)
{
setup_adc(ADC_CLOCK_DIV_8);
while(1)
 {  
 [B][U]       //lcd_init();
        //printf( lcd_putc, "Battery Status\n" );[/U][/B]
        delay_ms(100);	       
**broken link removed**
printf ("Battery discharge monitoring \n\r" );	   
putc('c');
puts("\n\rtemperature measurement");
delay_ms(100);
 }        
}
proteus design.pngView attachment rs232&lcd code.txt
 
Last edited by a moderator:

FoxyRick

Advanced Member level 4
Joined
Jan 8, 2004
Messages
1,249
Helped
321
Reputation
640
Reaction score
277
Trophy points
1,363
Location
England, UK
Activity points
12,978
You have no definitions for your LCD pin connections in that code, so the lcd_initI() does not know what you have connected the LCD to. If you read the manual, or the help file for LCD_init, or check the contents of the lcd.c file, you'll find the information. For example:


Code:
#define LCD_ENABLE_PIN  PIN_E0   
#define LCD_RS_PIN      PIN_E1   
#define LCD_RW_PIN      PIN_E2    
#define LCD_DATA4       PIN_D4   
#define LCD_DATA5       PIN_D5       
#define LCD_DATA6       PIN_D6    
#define LCD_DATA7       PIN_D7
 

cristianp

Full Member level 2
Joined
Jul 4, 2006
Messages
142
Helped
31
Reputation
62
Reaction score
21
Trophy points
1,298
Location
Bucharest, Romania
Activity points
1,909
lcd_init procedure redefines putchar() function needed by printf. You should use different functions for sending data to LCD and RS232 (now you are using printf for both interfaces)
 

FoxyRick

Advanced Member level 4
Joined
Jan 8, 2004
Messages
1,249
Helped
321
Reputation
640
Reaction score
277
Trophy points
1,363
Location
England, UK
Activity points
12,978
Alternatively (for the connections) you can define full port access:

Code:
#define LCD_DATA_PORT getenv("SFR:PORTD")
 

ab.vasanthan

Newbie level 5
Joined
Mar 5, 2012
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,341
Thanks for your support ...its working now :smile:


Thanks and Regards
vasanth
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top