PRABAKARDEVA
Full Member level 2
- Joined
- Sep 16, 2013
- Messages
- 127
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,298
- Location
- Chennai
- Activity points
- 2,168
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 #include<pic.h> #include<htc.h> __CONFIG(HS & WDTDIS & LVPDIS & UNPROTECT & PWRTDIS BORDIS); #define _XTAL_FREQ 16000000 #define RS RE1 #define EN RE2 //#define D0 RD0 //#define D1 RD1 //#define D2 RD2 //#define D3 RD3 //#define D4 RD4 //#define D5 RD5 //#define D6 RD6 //#define D7 RD7 void lcd_init(void); void lcd_command(unsigned int); void lcd_data(unsigned int); void lcd_print(unsigned char*); void main() { lcd_init(); lcd_print((unsigned char *)"HELLO"); __delay_ms(1000); lcd_print((unsigned char *)"world"); __delay_ms(1000); } void lcd_print(unsigned char array[]) { unsigned char i; for(i=0;array[i]!='\0';i++) lcd_data(array[i]); } void lcd_init(void) { PORTD=0; TRISD=0; TRISE1=0; TRISE2=0; lcd_command(0x01); lcd_command(0X80); lcd_command(0X06); } void lcd_command(unsigned int command) { RS=0; PORTD=command; EN=1; __delay_ms(1000); EN=0; __delay_ms(1000); } void lcd_data(unsigned int data) { RS=1; PORTD=data; EN=1; __delay_ms(1000); EN=0; __delay_ms(1000); }
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 #include <pic.h> #include <htc.h> __CONFIG(HS & WDTDIS & LVPDIS & UNPROTECT & PWRTDIS BORDIS); #define _XTAL_FREQ 16000000 #define RS RE1 #define EN RE2 void lcd_init(void); void lcd_command(unsigned char); void lcd_data(unsigned char); void lcd_print(unsigned char*); void main() { lcd_init(); lcd_print("HELLO"); __delay_ms(1000); lcd_print("world"); __delay_ms(1000); while(1){ ; } } void lcd_print(unsigned char *myStr) { while(*myStr) lcd_data(*myStr++); } void lcd_init(void) { TRISD = 0x00; PORTD = 0x00; TRISE1 = 0; TRISE2 = 0; lcd_command(0x01); lcd_command(0X80); lcd_command(0X06); } void lcd_command(unsigned char command) { RS = 0; PORTD = command; EN=1; __delay_ms(10); EN = 0; __delay_ms(10); } void lcd_data(unsigned char data) { RS = 1; PORTD = data; EN = 1; __delay_ms(10); EN = 0; __delay_ms(10); }
Code C - [expand] 1 2 #define RS RE1 #define EN RE2
Code C - [expand] 1 2 #define RS PORTEbits.RE1 #define EN PORTEbits.RE2
Code C - [expand] 1 __CONFIG(HS & WDTDIS & LVPDIS & UNPROTECT & PWRTDIS BORDIS);
Code C - [expand] 1PORTEbits.RE1
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 #include <pic.h> #include <htc.h> __CONFIG(FOSC_HS & WDTE_OFF & PWRTE_OFF & CP_OFF & BOREN_ON & LVP_OFF & CPD_OFF & DEBUG_OFF); #define _XTAL_FREQ 16000000 #define RS RE1 #define EN RE2 void lcd_init(void); void lcd_command(unsigned char); void lcd_data(unsigned char); void lcd_print(unsigned char*); void main() { lcd_init(); lcd_print("HELLO"); __delay_ms(1000); lcd_print("world"); __delay_ms(1000); while(1){ ; } } void lcd_print(unsigned char *myStr) { while(*myStr) lcd_data(*myStr++); } void lcd_init(void) { TRISD = 0x00; PORTD = 0x00; TRISE1 = 0; TRISE2 = 0; lcd_command(0x01); lcd_command(0X80); lcd_command(0X06); } void lcd_command(unsigned char command) { RS = 0; PORTD = command; EN=1; __delay_ms(10); EN = 0; __delay_ms(10); } void lcd_data(unsigned char data) { RS = 1; PORTD = data; EN = 1; __delay_ms(10); EN = 0; __delay_ms(10); }
__CONFIG(WDTE_OFF & PWRTE_ON & BOREN_ON & LVP_OFF & CPD_OFF & CP_OFF & CPD_OFF & DEBUG_OFF);
__CONFIG(0x3F3A)
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" -otest.cof -mtest.map --summary=default --output=default edab.p1 --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"
HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83
Copyright (C) 2011 Microchip Technology Inc.
(1273) Omniscient Code Generation not available in Lite mode (warning)
Memory Summary:
Program space used DDh ( 221) of 2000h words ( 2.7%)
Data space used Eh ( 14) of 170h bytes ( 3.8%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
Configuration bits used 1h ( 1) of 1h word (100.0%)
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)
Running this compiler in PRO mode, with Omniscient Code Generation enabled,
produces code which is typically 40% smaller than in Lite mode.
See http://microchip.htsoft.com/portal/pic_pro for more information.
Loaded C:\Users\Ananthashayana\Desktop\test.cof.
********** Build successful! **********
This can be found in the .inc file for your device which is 16F877A, you can see this in the HiTech install directory
#include<pic.h>
#include<htc.h>
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?