View previous topic :: View next topic |
Author |
Message |
hemnath
Joined: 03 Oct 2012 Posts: 242 Location: chennai
|
float value to PC |
Posted: Thu Sep 27, 2018 11:04 pm |
|
|
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
|
|
Posted: Thu Sep 27, 2018 11:20 pm |
|
|
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
|
|
Posted: Fri Sep 28, 2018 5:06 am |
|
|
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'. |
|
|
|