Discussion:
LIN API with C++ in MFC Application
(too old to reply)
Chirayu
2007-11-06 15:11:09 UTC
Permalink
Hi
 
I am using the LIN API library nicanmsc.lib and Nican.h file to work with the MFC application that I am writing in Visual C++ 6.0.
 
The problem i am encounter with one the API of Nican.h  called  "ncWrite(NCTYPE_OBJH          ObjHandle,                           NCTYPE_UINT32        SizeofData,                           NCTYPE_ANY_P         Data)"
 
As this API is used to configure the LIN Interface Slave task to configure or subscribe the data.To do that you have to have frame type is response Entry frame and  one of Data Type called "Is Remote " value equal to 16. Now I am doing exactly same things to achieve configure response entry frame to send data from slave based on the ID from master. As I am able to run this API from my application and its executing correctly and sending correct information that I want to send to Master but the problem I am seeing is that when you execute any of this API it comes with STATUS  back of the execution part went correctly on not based on the value that it returns. In my case eventhough the command looks to me executed correctly as sending the correct data but the STATUS comes with negative value which means it has something wrong in it. I can't figure out the problem in here.
 
Let me know if you any body encounter this kind of problem before. I described you the best way i can describe the problem but if any body has more question feel free to ask it.
 
Thanks
 
Chirayu
DirkW
2007-11-06 17:10:08 UTC
Permalink
What is the negative number you mentioned? Did you translate this number to an error message?
Whenever the api gives you a negative number, this means that an error occured. Please post this error and the function name where the error occured first.
DirkW
Chirayu
2007-11-06 17:40:13 UTC
Permalink
Well,
Function name As I described you first is "ncWrite".I have to check what is negative value and will let u know.But looks to me function is behaving correctly because what ever data i am trying to send as by configurig the LIN as slave devices is happening correctly.
So I have no idea why it is giving me error message.And This is only happening in my Application which is written in MFC C++.I have example program which is pure C and in that it returns no negative status. So that make confusion bigger.
I will let you know the code as soon as I find out.
Thanks
Chirayu
Chirayu
2007-11-07 02:10:08 UTC
Permalink
OK attached is the Error code and Message that it will print if we print the status information in String form.Its .jpeg  file.let me know if you have any trouble to open the file.
 
Thanks
 
Chirayu


Error_LIN.jpg:
Loading Image...
DirkW
2007-11-09 15:40:07 UTC
Permalink
Hi,
 
There must be something wrong with your frame type. Is the frame type (IsRemote) really dezimal 16. Perhaps you configured it in hex 16 and then it translates to d22?
Could you perhaps enable Error Logging to receive an Error frame with detailed error information?
 
DirkW
Chirayu
2007-11-09 18:10:07 UTC
Permalink
Hi,
Thanks for your reply..
Well, I am using decimal 16.It is sending the frame data as well as check sum correctly as I can verify that but Status coming back is negative because of some reason.I had a Error logging also enable.So the message i think its detailed  message that its coming with.
Let me know if you any idea that I can try else.
Thanks
Chirayu
Chirayu
2007-11-12 20:10:05 UTC
Permalink
Hi,
 
Well Error is generated by "ncWrite" Command all other command works fine. In this application the Master is generating the Header and ID and the Slave is reponding with response frame based on the ID. ID value is 16. Ya header has same id because i can debug through and as soon as ncwrite executed it adds the data to the whole frame.The Data is 100% correct but and the same slave can read with read command that frame but ncwrite comes with negative status error messag.
 
Let me know if you have any thing I can try or you think might creat the problem
 
Thanks
 
Chirayu

Loading...