HI-Tech C compiler help for PIC12F675 needed

Status
Not open for further replies.

Henry2011

New Member
I'm using MPLABX with a HI-Tech compiler and a PIC12F675.
I need to see my variables especially those created by the random generator.
I tried the printf () function in different formats and get error
"HI-TechC\lib\doprnt.c": No such file or directory"
or
"c:14: error: conflicting declarations for variable "_printf" (comtest.c:38)"
depending on if I include "#include <stdio.h>" or not.
How can I use the print function?

I also tried to implement serial UART output from the chip to a terminal like I used to in my old BASIC compiler.
But the HI-Tech compiler cannot find the "#include "sw_uart.h"".
Error: ""sw_uart.h": No such file or directory"
and the put and get and write commands fail.
How can I make software UART work on this compiler?

Thanks for any help
 
What version of Hitech are you using? I doubt the printf() would be much use on a pic12675, you only have 128 bytes of ram, doprnt() only gets compiled if there are formatted characters ie.. %d. I haven't got the sw usart either in my build.
 
Here is the code, Printf active, UART commented out (I found the UART code on the internet):


//PIC 12F675

#include <htc.h>
#include <stdio.h>
//#include "sw_uart.h"

/*getcUART
getsUART
OpenUART
putcUART
putsUART
ReadUART
WriteUART
*/

unsigned char A=1;

void main(void){
//unsigned char input;
//OpenUART();
//INTCON=0; // disabling interrupts.
//init_comms(); // set up the USART - settings defined in usart.h
// Output a message to prompt the user for a keypress
//printf("\rPress a key and I will echo it back:\n");

//while(1){
//input = getch(); // read a response from the user
//printf("\rI detected [%c]",input); // echo it back
//}


printf ("A= %c",A); //%hd?, %ld?
}

// :: error: can't open input file "c:\...\C-Compiler\HI-TechC\lib\doprnt.c": No such file or directory



I'm using Hi-Tech v9.82.
 
If you read the manual... Search for doprnt().. It tells you what to do...if you can't find doprnt() in the libs directory paste this in there.
 

Attachments

  • doprnt.c
    30.2 KB · Views: 203
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…