This following code is using the program MikroC on the PIC16F877A. PIC16F877A interface potentiometer using MikroC for PIC code. 0% to 100% rotation display on LCD. How do I modify this code to use on the PIC16F1829 on MPLABX?   // Lcd pinout settings sbit LCD_RS at RC0_bit; sbit LCD_EN at RC1_bit; sbit LCD_D7 at RD1_bit; sbit LCD_D6 at RD0_bit; sbit LCD_D5 at RC3_bit; sbit LCD_D4 at RC2_bit; // Pin direction sbit LCD_RS_Direction at TRISC0_bit; sbit LCD_EN_Direction at TRISC1_bit; sbit LCD_D7_Direction at TRISD1_bit; sbit LCD_D6_Direction at TRISD0_bit; sbit LCD_D5_Direction at TRISC3_bit; sbit LCD_D4_Direction at TRISC2_bit; float pot; char  pot1[4]; void main() { LCD_init(); Delay_ms(1000); ADC_init(); Delay_ms(1000); Lcd_Cmd(_LCD_CURSOR_OFF); Delay_ms(100); Lcd_Cmd(_LCD_CLEAR); Delay_ms(100); while(1) {  pot = ADC_Read(0);  Delay_ms(100);  if(( potGT0 ) && ( potLT50 ))  {  LCD_OUT(1,1,"0  %");  Delay_ms(100);  }  else if(( potGT50 ) && ( potLT100 ))  {  LCD_OUT(1,1,"10 %");  Delay_ms(100);  }    else if(( potGT100 ) && ( potLT200 ))  {  LCD_OUT(1,1,"20 %");  Delay_ms(100);  }    else if(( potGT200 ) && ( potLT300 ))  {  LCD_OUT(1,1,"30 %");  Delay_ms(100);  }    else if(( potGT300 ) && ( potLT400 ))  {  LCD_OUT(1,1,"40 %");  Delay_ms(100);  }    else if(( potGT400 ) && ( potLT500 ))  {  LCD_OUT(1,1,"50 %");  Delay_ms(100);  }    else if(( potGT500 ) && ( potLT600 ))  {  LCD_OUT(1,1,"60 %");  Delay_ms(100);  }     else if(( potGT600 ) && ( potLT700 ))  {  LCD_OUT(1,1,"70 %");  Delay_ms(100);  }     else if(( potGT700 ) && ( potLT800 ))  {  LCD_OUT(1,1,"80 %");  Delay_ms(100);  }     else if(( potGT800 ) && ( potLT900 ))  {  LCD_OUT(1,1,"90 %");  Delay_ms(100);  }     else if( potGT900 )  {  LCD_OUT(1,1,"100%");  Delay_ms(100);  }    } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This following code is using the program MikroC on the PIC16F877A. PIC16F877A interface potentiometer using MikroC for PIC code. 0% to 100% rotation display on LCD. How do I modify this code to use on the PIC16F1829 on MPLABX?

 

// Lcd pinout settings
sbit LCD_RS at RC0_bit;
sbit LCD_EN at RC1_bit;
sbit LCD_D7 at RD1_bit;
sbit LCD_D6 at RD0_bit;
sbit LCD_D5 at RC3_bit;
sbit LCD_D4 at RC2_bit;

// Pin direction
sbit LCD_RS_Direction at TRISC0_bit;
sbit LCD_EN_Direction at TRISC1_bit;
sbit LCD_D7_Direction at TRISD1_bit;
sbit LCD_D6_Direction at TRISD0_bit;
sbit LCD_D5_Direction at TRISC3_bit;
sbit LCD_D4_Direction at TRISC2_bit;
float pot;
char  pot1[4];
void main() {
LCD_init();
Delay_ms(1000);

ADC_init();
Delay_ms(1000);

Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Delay_ms(100);

while(1)
{
 pot = ADC_Read(0);
 Delay_ms(100);
 if(( potGT0 ) && ( potLT50 ))
 {
 LCD_OUT(1,1,"0  %");
 Delay_ms(100);
 }

 else if(( potGT50 ) && ( potLT100 ))
 {
 LCD_OUT(1,1,"10 %");
 Delay_ms(100);
 }
 
 else if(( potGT100 ) && ( potLT200 ))
 {
 LCD_OUT(1,1,"20 %");
 Delay_ms(100);
 }
 
 else if(( potGT200 ) && ( potLT300 ))
 {
 LCD_OUT(1,1,"30 %");
 Delay_ms(100);
 }
 
 else if(( potGT300 ) && ( potLT400 ))
 {
 LCD_OUT(1,1,"40 %");
 Delay_ms(100);
 }
 
 else if(( potGT400 ) && ( potLT500 ))
 {
 LCD_OUT(1,1,"50 %");
 Delay_ms(100);
 }
 
 else if(( potGT500 ) && ( potLT600 ))
 {
 LCD_OUT(1,1,"60 %");
 Delay_ms(100);
 }
 
  else if(( potGT600 ) && ( potLT700 ))
 {
 LCD_OUT(1,1,"70 %");
 Delay_ms(100);
 }
 
  else if(( potGT700 ) && ( potLT800 ))
 {
 LCD_OUT(1,1,"80 %");
 Delay_ms(100);
 }
 
  else if(( potGT800 ) && ( potLT900 ))
 {
 LCD_OUT(1,1,"90 %");
 Delay_ms(100);
 }
 
  else if( potGT900 )
 {
 LCD_OUT(1,1,"100%");
 Delay_ms(100);
 }
 
 }
}

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Types of input and output devices
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education