Serial port with hi tech picc compiler

Status
Not open for further replies.

fernandomierhicks

New Member
Hi:

I am having problems interfacing a 16f690 with the PC. I am using the sci.h and sci.c source files provided in the samples directory of the compiler.

The problem is that i cant send the ninth bit while in nine bit transmission mode. My code looks like this

while(1){
sci_Init(9600,SCI_EIGHT);
sci_PutByte(0x25);
delay(1000);
}

That works fine but when I change it to

while(1){
sci_Init(9600,SCI_NINE);
sci_PutNinth(0x00); /* ninth bit is zero */
sci_PutByte(0xff); /* and data is 0xff */
}

the compiler throws me the following error:

(499)undefined symbol: _sci_PutNinth

None of the source files have been modified, so I don't know whats the bug.
Also i would like to know what this means:
#define sci_PutNinth(bitnine) (TX9D = bitnine?1:0; )

unsigned char
sci_GetNinth(void)
{
while(!RCIF)
continue;

return RX9D; /* RCIF is not cleared until RCREG is read */
}

that's the code for the putninth function inside the source file.

Last edited:

Pommie

Well-Known Member
Is _sciPutNinth a typo and you meant sci_PutNinth? What happens if you double click the error, does it take you to the error line.

Can you post a compilerable (new word?) file? Preferably with code tags around it.

Mike.

fernandomierhicks

New Member
If i double click the error the program takes me to main.obj that has all these weird symbols, the compilable code is like this:

#include "init.h" // included by C-Wiz
#include "sci.h"
#include <htc.h>
void
main(void)
{
init();

while (1){

sci_Init(19200,SCI_NINE);
sci_PutNinth(0x00); /* ninth bit is zero */
sci_PutByte(0xff); /* and data is 0xff */

}
}

Pommie

Well-Known Member
I've not used the HiTech compiler and so am unsure how you are supposed to include standard functions. I did have a quick play and managed to get it to compile by including sci.c
Code:
#include "init.h" // included by C-Wiz
#include <htc.h>
#include "sci.h"
#include "sci.c"

void main(void){
init();
while (1){
sci_Init(19200,SCI_NINE);
//sci_PutNinth(0x00); /* ninth bit is zero */
TX9D=0;
sci_PutByte(0xff); /* and data is 0xff */
}
}
This caused a rather strange error to do with the sci_PutNinth line and so I changed it to write direct.

You should try asking on the HiTech forum to find out the correct way to do this. Or maybe someone here who does use the compiler can throw some light on it.

Mike.

Status
Not open for further replies.

Replies
2
Views
2K
Replies
25
Views
2K
Replies
5
Views
456
Replies
3
Views
421
Replies
12
Views
1K