16,023,224 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by shafiq2eng (Top 1 by date)
shafiq2eng
31-Jan-14 12:16pm
View
i mad Voltage meter Using PIC MikroC successfully and now i want to send this analogue data on serial port to show voltage on Visual Studio Form, Pleas help me....
My codes are below
sbit LCD_RS at RC0_bit;
sbit LCD_EN at RC1_bit;
sbit LCD_D4 at RC2_bit;
sbit LCD_D5 at RC3_bit;
sbit LCD_D6 at RC4_bit;
sbit LCD_D7 at RC5_bit;
sbit LCD_RS_Direction at TRISC0_bit;
sbit LCD_EN_Direction at TRISC1_bit;
sbit LCD_D4_Direction at TRISC2_bit;
sbit LCD_D5_Direction at TRISC3_bit;
sbit LCD_D6_Direction at TRISC4_bit;
sbit LCD_D7_Direction at TRISC5_bit;
//************************************************//
void main() {
char ch;
int adc_read_val;
long tlong;
ANSEL = 0b00000001; // Configure AN pins as digital I/O
/*ADCON0= 0b10000011;
ADCON1=0b00000000;*/
vcfg_bit=0;
// CM0_bit=0;CM1_bit=0;CM2_bit=0;
TRISA=1;
PORTA=0;
Lcd_Init();
Lcd_Cmd(_Lcd_clear);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_out(1,1,"VOLT METER");
Delay_ms(1000);
//************************************************//
while(1){//start of while
adc_read_val=adc_read(0);
tlong=(long)adc_read_val*5000;
tlong=tlong/1023;
ch=tlong/1000;
Lcd_Chr(2,3,ch+48);
lcd_chr_cp('.');
ch=(tlong/100)%10;
lcd_chr_cp(48+ch);
ch=(tlong/10)%10;
lcd_chr_cp(48+ch);
ch=tlong%10;
lcd_chr_cp(48+ch);
lcd_chr_cp('V');
}//end of while
}