Hi all,
I am very new to C programming and I need your help.
Can anyone tell me how can I transmit a frame in C programming?
Printable View
Hi all,
I am very new to C programming and I need your help.
Can anyone tell me how can I transmit a frame in C programming?
Transmit to what? What sort of Frame?
What have you tried so far?
--
Mats
I have a frame format which is as follows:
start char 'S'
device address '0x4E'
write command '0xFE'
no of bytes (any no)
actal bytes
stop char 'P'.
How can I combine all this?
So, what type of device is this for (Ethernet, Serial, I2C, proprietary, or ...), and what is the hardware (e.g. PC or some specific single-board computer, perhaps?) and software environment (OS, Compiler, libraries, etc) you are using?
--
Mats
I need to communicate to an I2C using a bridge chip. The controller is XC164CM.
The bridge chip SC18IM700 is like an interface which helps the host to communicate to an I2C. The format which I have sent before is predefined by the bridge chip.
I am usiing ASC1 port for communication. The initial structure has been done using DAvE.
I am using the XC164CM starter kit by infineon technologies
Ok, and how far have you got so far?
--
Mats
The command I have to use to send the 'S' char is ASC1_vSendData ('S');
I have done that, and it works. I am using a scope meter to check the status on the pins of the hardware. This char is being sent but I am not able to receive it.
Secondly, its ok if I cant receive it back. I need to send the frame format i posted earlier.
Initially, I was just sending a character to check if the bridge chip works. I can confirm that it works. The SC18IM700 communicates with the host using MAX 3227E. For the moment, don't consider the I2C. Now, I know that SC18IM700 is receiving data from ASC1 TX but, ASC1 does not receive the data back from SC18IM700.
I have pasted the functions below. Can you tell me how can I read the 'S' char using ASC1_uwGetData function?
Code://****************************************************************************
// @Function void ASC1_vSendData(uword uwData)
//
//----------------------------------------------------------------------------
// @Description This function writes a send data initialization word into
// the transmit buffer register.
//
// Note:
// In a multiprocessor system the master with this function
// has the possibility to send data to the selected slave. To
// achieve this, the 9th bit must set on zero.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters uwData:
// Data to be send
//
//----------------------------------------------------------------------------
// @Date 25/11/2008
//
//****************************************************************************
// USER CODE BEGIN (SendData,1)
void ASC1_send()
{
ASC1_vSendData ('S');
}
void ASC1_vSendData(uword uwData)
{
ASC1_TBIC_IR = 0; // reset transmit buffer interrupt request
ASC1_TBUF = uwData; // load transmit buffer register
while (ASC1_TBIC_IR == 0);//wait till transmission finish
} // End of function ASC1_vSendData
//****************************************************************************
// @Function uword ASC1_uwGetData(void)
//
//----------------------------------------------------------------------------
// @Description This function reads out the content of the receive buffer
// register which contains the received data.
//
//----------------------------------------------------------------------------
// @Returnvalue data that has been received
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 25/11/2008
//
//****************************************************************************
// USER CODE BEGIN (GetData,1)
// USER CODE END
uword ASC1_uwGetData(void)
{
return(ASC1_RBUF); // return receive buffer register
} // End of function ASC1_uwGetData
So, can you, using the scope, observe data being sent from the SCM?
--
Mats
No. I tried using the scope on TX pin of SCM but I am not getting anything back
I guess u r right. Since its a bridge chip, maybe it needs something before sending something. Thats where the frame i mentioned comes in. Its a frame that sends data from host to I2C using the bridge chip. Thats the point where I am stuck up. I logically know what I am supposed to do, but I am not able to write it in C.