Jump to content

Recommended Posts

Tone,

 

Thanks for that Dave, but it still won't work.

 

sending ("\x0F\x1A\x04")

 

recieving 5C 78 30 46 5C 78 31 41 5C 78 30 34 ie the ascii string.

Please supply a code fragment that demonstrates the issue.

I don't see any problem.

 

Regards

Dave

Link to post
Share on other sites
Tone,

 

Thanks for that Dave, but it still won't work.

 

sending ("\x0F\x1A\x04")

 

recieving 5C 78 30 46 5C 78 31 41 5C 78 30 34 ie the ascii string.

Please supply a code fragment that demonstrates the issue.

I don't see any problem.

 

Regards

Dave

 

 

void sendString(const char * string);

 

void sendString(const char* string)

{

char i;

for (i = 0 ;i < 3; i++)

{

while((txsta & 1 <<TRMT) ==0);

txreg = string;

}

}

 

void main()

{

sendString ("\x0F\x1A\x04");

}

Link to post
Share on other sites

Tone,

 

char txreg;
void sendString(const char * string);

void sendString(const char* string)
{
char i;
for (i = 0;i < 3; i++) 
{
	// while((txsta & 1 <<TRMT) ==0);
	txreg = string[i];
}
}

void main()
{
sendString ("\x0F\x1A\x04");
}

 

This code works for me (target 16F876A).

txreg is assigned values 15,26,04.

 

I wonder why you are seeing a problem

 

Regards

Dave

Link to post
Share on other sites
Tone,

 

char txreg;
void sendString(const char * string);

void sendString(const char* string)
{
   char i;
   for (i = 0;i < 3; i++) 
   {
       // while((txsta & 1 <<TRMT) ==0);
       txreg = string[i];
   }
}

void main()
{
   sendString ("\x0F\x1A\x04");
}

 

This code works for me (target 16F876A).

txreg is assigned values 15,26,04.

 

I wonder why you are seeing a problem

 

Regards

Dave

 

Thanks for the help Dave,

Since it wasn't a code error I updated the compiler to version 6.33 and now it works

 

Tone

Edited by Tone
Link to post
Share on other sites
  • 2 weeks later...
Tone,

 

char txreg;
void sendString(const char * string);

void sendString(const char* string)
{
   char i;
   for (i = 0;i < 3; i++) 
   {
       // while((txsta & 1 <<TRMT) ==0);
       txreg = string[i];
   }
}

void main()
{
   sendString ("\x0F\x1A\x04");
}

 

This code works for me (target 16F876A).

txreg is assigned values 15,26,04.

 

I wonder why you are seeing a problem

 

Regards

Dave

 

Thanks for the help Dave,

Since it wasn't a code error I updated the compiler to version 6.33 and now it works

 

Tone

 

 

Dave,

 

do you have an idea, why the given code does not work with version 6.33 for 16F876A? What´s about the headerfile "rs232_driver.h"? The needed definitions and variables are in the file "SimpleSend.h".

 

What can be the reason for this problem ?

 

 

Regards

 

Turhan

 

#include <system.h>
#include "SimpleSend.h"

// char txreg;
void sendString(const char * string);

void sendString(const char* string)
{
  char i;
  for (i = 0;i < 3; i++)
  {
      while((txsta & 1 <<TRMT) ==0)
        portb.0 ^= 1;
      txreg = string[i];
  }
}

void main()
{
 trisb = 0;
 
 while(1)
 {
   sendString ("ABC\x0D\x0A");
 }
}

Link to post
Share on other sites

Turhan ,

 

Dave,

 

do you have an idea, why the given code does not work with version 6.33 for 16F876A?  What´s about the headerfile "rs232_driver.h"?  The needed definitions and variables are in the file "SimpleSend.h".

 

What can be the reason for this problem ?

 

 

Regards

 

Turhan 

 

#include <system.h>
#include "SimpleSend.h"

// char txreg;
void sendString(const char * string);

void sendString(const char* string)
{
  char i;
  for (i = 0;i < 3; i++)
  {
      while((txsta & 1 <<TRMT) ==0)
        portb.0 ^= 1;
      txreg = string[i];
  }
}

void main()
{
 trisb = 0;
 
 while(1)
 {
   sendString ("ABC\x0D\x0A");
 }
}

This program is not complete, this is why it doesn't work.

It was just to get to the bottom of a problem.

 

Regards

Dave

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...