Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I have written the code for serially send data transmission between PC-hyper-terminal and PIC16F877A. When I am using MP LAB IDE Hitech C compiler its showing the error like pointer is required and any of you please check the code and register description is correct or not

What I have tried:

C
  #include<pic.h>
  #include<string.h>


void pic_init(void)
{
	TRISC7=1;
	TRISC6=0;
}

void uart_init(void)
{
	TXSTA=0x20;
	RCSTA=0x90;
	SPBRG=15;
}

void tx(unsigned char byte)
{
int i;
TXREG=byte;
while(!TXIF);
for(i=0;i<400;i++);
}

void string_uart(char *q)
{
	while(*q)
	{
	*(*q++);
}
}
unsigned char rx()
{
	while(!RCIF);
	return RCREG;
}



void main()
{

	//char *q;
	pic_init();
	uart_init();
	tx('N');
	rx();
	string_uart("test program");
}
Posted
Updated 15-Apr-19 9:45am
v3

Quote:
void string_uart(char *q)
{
while(*q)
{
*(*q++);
}

Did you actually mean
C
void string_uart(char *q)
{
  while(*q)
  {
    tx((unsigned char) *q);
    ++q;
  }
}

?
 
Share this answer
 
void string_uart(char *q)
{
  while(*q)
  {
    tx(*q++);
  }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900