Created
June 1, 2017 06:41
-
-
Save prasant1010/44639ed9dfe2015b82704eaa3f6df7d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Glcd module connections | |
char GLCD_DataPort at PORTD; | |
sbit GLCD_CS1 at RC0_bit; | |
sbit GLCD_CS2 at RC1_bit; | |
sbit GLCD_RS at RB3_bit; | |
sbit GLCD_RW at RB4_bit; | |
sbit GLCD_EN at RB5_bit; | |
sbit GLCD_RST at RE2_bit; | |
sbit GLCD_CS1_Direction at TRISC0_bit; | |
sbit GLCD_CS2_Direction at TRISC1_bit; | |
sbit GLCD_RS_Direction at TRISB3_bit; | |
sbit GLCD_RW_Direction at TRISB4_bit; | |
sbit GLCD_EN_Direction at TRISB5_bit; | |
sbit GLCD_RST_Direction at TRISE2_bit; | |
// End Glcd module connections | |
char txt[4]; | |
unsigned tmp; | |
void main() { | |
Glcd_Init(); | |
Glcd_Fill(0); | |
ADC_Init(); | |
while(1){ | |
tmp = ADC_Read(0); | |
tmp = tmp/2.05; | |
ByteToStr(tmp, txt); | |
Glcd_Write_Text("o", 60,0, 1); | |
Glcd_Write_Text(txt, 35,1, 1); | |
Glcd_Write_Text("TEMP =", 0,1, 1); | |
Glcd_Write_Text("C ", 70,1, 1); | |
if (tmp>20) {Glcd_Box(10, 50, 20, 70, 1); } | |
if (tmp<20) {Glcd_Box(10,50, 20, 70, 0); } | |
if (tmp>40) {Glcd_Box(20, 45, 30, 70, 1); } | |
if (tmp<40) {Glcd_Box(20, 45, 30, 70, 0); } | |
if (tmp>60) {Glcd_Box(30, 40, 40, 70, 1); } | |
if (tmp<60) {Glcd_Box(30, 40, 40, 70, 0); } | |
if (tmp>80) {Glcd_Box(40, 35, 50, 70, 1); } | |
if (tmp<80) {Glcd_Box(40, 35, 50, 70, 0); } | |
if (tmp>100) {Glcd_Box(50, 30, 60, 70, 1); } | |
if (tmp<100) {Glcd_Box(50, 30, 60, 70, 0); } | |
if (tmp>115) {Glcd_Box(60, 25, 70, 70, 1); } | |
if (tmp<115) {Glcd_Box(60, 25, 70, 70, 0); } | |
if (tmp>130) {Glcd_Box(70, 20, 80, 70, 1); } | |
if (tmp<130) {Glcd_Box(70, 20, 80, 70, 0); } | |
if (tmp>140) {Glcd_Box(80, 15, 90, 70, 1); } | |
if (tmp<140) {Glcd_Box(80, 15, 90, 70, 0); } | |
if (tmp>145) {Glcd_Box(90, 10, 100, 70, 1); } | |
if (tmp<145) {Glcd_Box(90, 10, 100, 70, 0); } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment