|
некорректность заключается в том, что, что после остановки и включения, начинает гнать левые символы
#define REPL_BUF_LEN 6 BOOL fWaitToReceiveByte(void); void main() TX8_1_Start(TX8_1_PARITY_NONE); str: TxZeroTerminatedRamString(repl_buffer); goto str; BOOL fWaitToReceiveByte(void) /* Wait to receive full byte*/ } // void TxZeroTerminatedRamString( BYTE * pbStrPtr ) }
E-mail:
info@telesys.ru
#include
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
BYTE repl_buffer[REPL_BUF_LEN];
BYTE bRxData;
void TxZeroTerminatedRamString( BYTE * pbStrPtr );
{
RX8_1_Start(RX8_1_PARITY_NONE);
if ( fWaitToReceiveByte() )
{
repl_buffer[0] = bRxData;
}
TX8_1_Stop();
RX8_1_Stop();
}
{
BYTE bRxStatus;
while ( !( bRxStatus=RX8_1_bReadRxStatus() & RX8_1_RX_COMPLETE ) )
{
/* might want to sleep or keep track of time */
}
/* data received, now check for errors */
if (( bRxStatus & RX8_1_RX_NO_ERROR ) == 0 )
{
/* no error detected */
bRxData = RX8_1_bReadRxData();
return( TRUE );
}
else
{
/* error detected */
bRxData = bRxStatus;
return( FALSE );
}
// TX8_1_Start() should be called prior to calling this function.
//
{
/* check for the end condition, before sending the next byte */
while( *pbStrPtr != 0 )
{
/* send the next byte */
TX8_1_SendData( *pbStrPtr );
/* Wait for the data to start transmitting */
while( !( TX8_1_bReadTxStatus() & TX8_1_TX_BUFFER_EMPTY ) );
pbStrPtr++;
}
Ответы