Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 10, 2016, 07:26:54 19:26


Login with username, password and session length


Pages: [1]
Print
Author Topic: Calculations in PCWHD PIC Compiler!  (Read 2751 times)
0 Members and 1 Guest are viewing this topic.
engr.humair
Newbie
*
Offline Offline

Posts: 29

Thank You
-Given: 5
-Receive: 2


« on: September 02, 2010, 10:46:03 10:46 »

Dear:

I am newbie for CCS PCWHD PIC compiler.

Need to know about procedure to accept byte or float from RS232 & perform arithematic calculations on it?

Thanks in advance.
Logged
TomJackson69
V.I.P
Active Member
*****
Offline Offline

Posts: 221

Thank You
-Given: 23
-Receive: 63


« Reply #1 on: September 02, 2010, 06:38:07 18:38 »

Go to Drivers Directory in “C:\Program Files\PICC\Drivers” (if use default) and take a look at the file “input.c”. In this driver, it contains a function “void get_string(char* s, unsigned int8 max)”. You can use this function to get the data from RS232. After you call the “get_string()”, the string need to convert to a number; INT or HEX or DEC or FLOAT depends on the data type.

You can use:
atoi()   to convert to int
atof()      to convert to float
strtof()   to convert to float


Other option also available, depend on your mileage.

I am NO expert on the CCS. You should read the example in the EXAMPLES directory to understand and get more information’s.

Regards,

Tom
Logged

Con Rong Chau Tien
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC