Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top