Subject:
|
Serial Communication Please Help!
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Sun, 14 Feb 1999 21:03:13 GMT
|
Original-From:
|
Peter Eacmen <EACMEN@POSTOFFICE.WORLDNET.ATT.NETspamless>
|
Viewed:
|
1214 times
|
| |
| |
Hi,
I am trying to get communication working between two HBs via the RJ11
serial port. I read the FAQ on the HB web site and I have the right cable.
On the trans. HB the power LED blinks which indicates it is transmitting.
Also whenever I turn on the Trans. HB the recieving HB says 255. Below is
the code I am running on both HBs.
Thanks
-Peter
Here's the code I am running the recieving HB:
void disable_pcode_serial() /* disable board handshaking with IC */
/* on the host computer, allowing user */
/* programs to receive serial data */
{
poke(0x3c, 1);
}
int serial_getchar() /* read a serial character. Note: the */
/* program hangs until a character is */
/* received! There is no timeout! */
{
while (!(peek(0x102e) & 0x20)); /* wait until a character arrives
*/
return (peek(0x102f)); /* return it as an int */
}
void main()
{
int x=0;
disable_pcode_serial();
while(1)
{
printf("\n%d",serial_getchar());
}
}
The transmitting HB:
void serial_putchar(int c) /* send a serial character. Note: the */
/* program hangs until the character is */
/* sent! There is no timeout! */
{
while (!(peek(0x102e) & 0x80)); /* wait until it's okay to send */
poke(0x102f, c); /* send the character */
}
void main()
{
int x=0;
while(x < 250)
{
serial_putchar(x);
x++;
}
}
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|