View Single Post
  #12   Spotlight this post!  
Unread 07-04-2004, 21:17
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Using an FRC with the RCX?

Quote:
Originally Posted by Texan
You said the prog port earlier, but how do we access that? Or, rather, can we get enough control to do what we want? You can send text, but I haven't studied the printf() access of the port. Maybe that port will work or maybe something else is necessary. Correct me if you know the way.
Ok. The text is transmitted as bytes (I assumed ASCII, but I'm not sure). So basically, you replace the text with bytes. A string is an array of bytes terminated by a null characcter (0x00).

I looked in printf_lib.c I traced the flow of execution from printf(), and ended up at Write_Byte_To_Uart(). Which is:
Code:
/*********************************************************
* SUBROUTINE NAME: Write_Byte_To_Uart
* PURPOSE:       Writes a byte to the UART.
*     Argument       Type           IO   Description
*     --------       -----------    --   -----------
*         data       int            I    data to transmit to the UART
* RETURNS:       void
*********************************************************/

static void Write_Byte_To_Uart(int data)
{
  TXREG = data;  /* a carriage return */
  Wait4TXEmpty();
}
I simplified it to the macro:
Code:
#define SendByte(Byte) {TXREG = Byte; Wait4TXEmpty();}
(And I don't actually know how to write macros!)

You call this repeatedly to write the whole packet.

Of course, You can't recieve: the LIRT only remains active for 3 seconds after you transmit something.
Also: this whole setup is unusual, so if it doesn't work, don't worry. We just may end up buying a pair of UART DTEs and making a double box!