CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

float value to PC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hemnath



Joined: 03 Oct 2012
Posts: 242
Location: chennai

View user's profile Send private message

float value to PC
PostPosted: Thu Sep 27, 2018 11:04 pm     Reply with quote

I want to transfer float value to PC.
Compiler Version: V4.114

Sample code:
Code:

#include "18F2520.h"
#fuses HS
#use delay(clock=4000000)

#include "ieeefloat.c"

float f;
int32 PCval;
int8 *p;

void main()
{
   while(1)
   {
      f = 0.0123;
      PCval=f_PICtoIEEE(f);
      p = &PCval;  // pointer p points to the first byte of f
      
      putc(p[0]);  // use p as an array Send the first byte
      putc(p[1]);  // Send the second byte
      putc(p[2]);  // Send the third byte
      putc(p[3]);  // Send the fourth byte
   }
}


I get the following errors:
*** Error 12 "main.c" Line 19(5,6): Undefined identifier -- putchar
*** Error 12 "main.c" Line 20(5,6): Undefined identifier -- putchar
*** Error 12 "main.c" Line 21(5,6): Undefined identifier -- putchar
*** Error 12 "main.c" Line 22(5,6): Undefined identifier -- putchar
hemnath



Joined: 03 Oct 2012
Posts: 242
Location: chennai

View user's profile Send private message

PostPosted: Thu Sep 27, 2018 11:20 pm     Reply with quote

Added the line.

#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

Now it compiles successfully.
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Sep 28, 2018 5:06 am     Reply with quote

Be sure to add 'ERRORS' to the #USE RS232(...options...) ! While it does nothing on sending data when you have the PIC RECEIVE data, it'll keep the PIC from 'locking up'.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group