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?
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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
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.
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
No. I tried using the scope on TX pin of SCM but I am not getting anything back
I would agree, that waiting till the transmit queue is ready to accept more data is a bit overkill. Halting the OS a bit to wait is much more efficient, but a bit slower. Coming up with an optimum wait in ms's will require some testing.
This might be a stupid remark but why would you want to learn c programming when you can learn C++..... Isn't C++ better then C ? I'm really not sure so don't attack me
Well, in this case, the target system is a single-board micro-computer, so it is not necessarily a good target for the heavy tools of C++. And the code being discussed here would be marginally different either way - or do you know something that I do not know in the particular project?
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Hello again !!!!
I have a question. If I have to set any GPIO pin of a particular IC without the bridge chip(in this case,without using the W command) how can I do it?