I need to now the byteslength in ncRead
I use nationals PCI CAN and had created a Read and Write Frame API in Visual c++. When I read the Can bus I got the hole message and everything is fine. The problem is that the can bus I read from send message with different byte lengths and I need to now how many bytes there is in every message? I now that this information is in the messages Frame but I can´t get it. Please help me!
//Olssoninc
Here is my CAN read/write function!
void CCaNREADERView::ReadCAN(unsigned char *byte,char *cReadId,char *cWriteId)
char csCANStdWrite[14]="CAN1:TD";
strcat_s(csCANStdWrite,14,cWriteId);
char csCANStdRead[14]="CAN1:TD";
strcat_s(csCANStdRead,14,cReadId);
NCTYPE_STATUS Status;
NCTYPE_STATE State;
NCTYPE_CAN_DATA Transmit;
NCTYPE_CAN_STRUCT Receive;
NCTYPE_ATTRID AttrIdList[8];
NCTYPE_UINT32 AttrValueList[8];
AttrIdList[0] = NC_ATTR_BAUD_RATE;
AttrValueList[0] = 50000;
AttrIdList[1] = NC_ATTR_START_ON_OPEN;
AttrValueList[1] = NC_TRUE;
AttrIdList[2] = NC_ATTR_READ_Q_LEN;
AttrValueList[2] = 0;
AttrIdList[3] = NC_ATTR_WRITE_Q_LEN;
AttrValueList[3] = 0;
AttrIdList[4] = NC_ATTR_CAN_COMP_STD;
AttrValueList[4] = NC_CAN_ARBID_NONE;
AttrIdList[5] = NC_ATTR_CAN_MASK_STD;
AttrValueList[5] = NC_CAN_MASK_STD_DONTCARE;
AttrIdList[6] = NC_ATTR_CAN_COMP_XTD;
AttrValueList[6] = NC_CAN_ARBID_NONE;
AttrIdList[7] = NC_ATTR_CAN_MASK_XTD;
AttrValueList[7] = NC_CAN_MASK_XTD_DONTCARE;
Status = ncConfig("CAN0", 8, AttrIdList, AttrValueList);
PrintStat(Status, "ncConfig CAN0");
Status = ncConfig("CAN1", 8, AttrIdList, AttrValueList);
PrintStat(Status, "ncConfig CAN1");
AttrIdList[0] = NC_ATTR_COMM_TYPE;
AttrValueList[0] = NC_CAN_COMM_RX_PERIODIC;//NC_CAN_COMM_RX_UNSOL;
AttrIdList[1] = NC_ATTR_PERIOD;
AttrValueList[1] = NC_DURATION_10SEC;
AttrIdList[2] = NC_ATTR_CAN_DATA_LENGTH;
AttrValueList[2] = 3;
AttrIdList[3] = NC_ATTR_CAN_TX_RESPONSE;
AttrValueList[3] = NC_FALSE;
AttrIdList[4] = NC_ATTR_RX_CHANGES_ONLY;
AttrValueList[4] = NC_FALSE;
AttrIdList[5] = NC_ATTR_READ_Q_LEN;
AttrValueList[5] = 0;
AttrIdList[6] = NC_ATTR_WRITE_Q_LEN;
AttrValueList[6] = 0;
Status = ncConfig(csCANStdRead, 7, AttrIdList, AttrValueList);
PrintStat(Status, "ncConfig CAN0::1224 (receiving)");
AttrIdList[0] = NC_ATTR_COMM_TYPE;
AttrValueList[0] = NC_CAN_COMM_TX_PERIODIC;
AttrIdList[1] = NC_ATTR_BKD_PERIOD;
AttrValueList[1] = NC_DURATION_1SEC;
AttrIdList[2] = NC_ATTR_CAN_DATA_LENGTH;
AttrValueList[2] = 7; //Length of Transmitting mes
AttrIdList[3] = NC_ATTR_CAN_TX_RESPONSE;
AttrValueList[3] = NC_FALSE;
AttrIdList[4] = NC_ATTR_RX_CHANGES_ONLY;
AttrValueList[4] = NC_FALSE;
AttrIdList[5] = NC_ATTR_READ_Q_LEN;
AttrValueList[5] = 0;
AttrIdList[6] = NC_ATTR_WRITE_Q_LEN;
AttrValueList[6] = 0;
Status = ncConfig(csCANStdWrite, 7, AttrIdList, AttrValueList);
PrintStat(Status, "ncConfig CAN1::1224 (transmitting)");
Status = ncOpenObject(csCANStdRead, &RxHandle);
PrintStat(Status, "ncOpenObject CAN0::1224 (receiving)");
Status = ncOpenObject(csCANStdWrite, &TxHandle);
PrintStat(Status, "ncOpenObject CAN1:TD1224 (transmitting)");
Transmit.Data[0] = 0x00;
Transmit.Data[1] = 0x00;
Transmit.Data[2] = 0x00;
Transmit.Data[3] = 0x00;
Transmit.Data[4] = 0x00;
Transmit.Data[5] = 0x00;
Transmit.Data[6] = 0x00;
Transmit.Data[7] = 0x00;
Status= ncWrite(TxHandle, sizeof(Transmit), &Transmit);
PrintStat(Status, "ncWrite");
Status = ncWaitForState(RxHandle,
(NC_ST_READ_AVAIL | NC_ST_ERROR),
(NC_DURATION_10SEC * 2), &State);
PrintStat(Status, "ncWaitForState");
Status= ncRead(RxHandle, sizeof(Receive), &Receive);
for(int i=0;i<8;i++)
byte[i]=Receive.Data[i];
Status = ncCloseObject(TxHandle);
PrintStat(Status, "ncCloseObject CAN1:TD5 (transmitting object)");
Status = ncCloseObject(RxHandle);
PrintStat(Status, "ncCloseObject CAN0:TD5 (receiving object)");
Similar Messages
-
Hi - My daughter was using her Apple TV until recently when she got a Smart TV. Now the Apple TV is not needed so she passed it on to me. How do I get her Home Sharing account transferred over to mine so that I can use it with my PC? Thanks!
As Winston Churchill wrote, however you might want to do a factory reset on the Apple TV.
This way all information pertaining to your daughter will be removed from the device. Specifically if see was sign into any of the streaming service, Netflix, Hulu, etc. her credentials will still be associated with this Apple TV, doing a factory reset will remove all that and make it as if you purchased the device and just plugged it in.
regards -
I have recently upgraded my iMac Intel G5 iSight (iMac5,1) to OS 10.6.8 and now the internal mic does not work with skype or facebook. I can here static when playing back clips. Do I need to update firmware or reload old system parts. I have zapped PRAM. The blue indicator in system audio panel will appear for a second as I slide the bar for internal mic but then it disappears. Is there a fix?
The sound seems very faint but can here static on playback.
-
I updated the latest version of iOS software on my Macbook Pro and now when I try to open up iPhoto it says that I need to update the latest version. But when I go to update on iTunes, it says the latest version is unavailable to the U.S. I wouldn't mind leaving it be but I can't access any of my photos. What do I do?
stuckoncc wrote:
I updated the latest version of iOS software on my Macbook Pro
iOS is on iPhones and iPads.
Are you using an iPhone or iPad? -
I currently had two apple ID's and I deleted the other on a whim a while back. Now whenever I need to update the iphoto or iMovie, it says to sign in into my deleted account, but I don't remember my old account's password nor the security questions. Any Help Please?
Check the AppleCare number for your country here:
http://support.apple.com/kb/HE57
Call them up, and let them know you would like to be transferred to the Account Security Team. -
I setup two iphones on "Find My Iphone App" Using the same apple id on each phone. Now the app finds only the phone I setup first. Do I need to use two different apple ids? If your answer is yes then how do I errase the setup in the second phone and assign a new id?
As TJBUSMC1973 states, and as I said earlier, the Find My iPhone app has nothing to do with your use of Find My iPhone. The app is just used if necessary to locate another iOS device from that particular iOS device. To see if both of your devices are being located in Find My iPhone, log into www.icloud.com and select Find My iPhone. Both of the devices should appear. If they do not, then go into whichever of the devices does not appear and make sure that Find My iPhone is activated. It has to be activated through iCloud, and for both to show on the same map, they both have to have the same iCloud ID.
-
I have forgotten my password for iPod Touch 4G and it is now disabled. I tried connecting to iTunes but i haven't synced before and i need to enter the password before i can back it up so i can restore it. I don't want to lose pictures so please HELP!
Disabled
Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased. That is how it works
iOS: Forgot passcode or device disabled
If recovery mode does not work try DFU mode.
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
For how to restore:
iTunes: Restoring iOS software
To restore from backup see:
iOS: Back up and restore your iOS device with iCloud or iTunes
If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
You can redownload most iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store
If problem what happens or does not happen and when in the instructions? When you successfully get the iPod in recovery mode and connect to computer iTunes should say it found an iPod in recovery mode. -
I recently replaced my Airport Express (11g) to one running 11n. My iMac running 10.4.11 uded to work fine with 11g but now cannot connect to the 11n Airport Express. I can see the network listed and it asks for a WAP2 password, but when I supply the password it fails to connect.
Do I need to upgrade the airport software on the iMac, and to which version.
Bill PrattTesserax,
Thank you for the suggestions. I tried first setting the radio mode to 802.11b/g compatible using the Option key hint that you supplied, but I got the same error message when I tried to join the network from my older Mac. (I apologize for saying in error that it was running 10.5.8, it was actually running 10.4.11--the last version that still supported Classic--and is a G4 PPC machine.)
The attempt to login to the network from the PPC machine gave me the standard log-in prompt, but I noticed that it asked for the WAP password, and my two other machines--both Intel MacBooks--get asked for the WAP2 password. The first time I noticed this I was still thinking the "error in trying to join the network" was a function of the 802.11n setup.
When your first suggestion didn't work, I reset the base station back to the original 802.11n (b & g compatible) but got the same error message--asking for a WAP password--so I went back into the setup, and selected the WAP/WAP2 Personal menu selection, restarted the base station, and was able to successfully join the network!
Your tip led me to the right place to fix my problem, Thank You,
Bill Pratt -
I have a new iphone and went into Itunes and it said my new iphone needed a software update. I let it do this and now the apps that I put on won't work and when pressed just flash on then off the screen. I paid £20 for one of them so any help would be appreciated.
Memory Map: http://www.memory-map.co.uk/iphone/
0870: http://www.simonmaddox.com/
Viber: http://support.viber.com/home
VoucherCloud: http://questions.vouchercloud.com/ -
I deleted my old email account and when i went to change everything on my iphone it still shows the old email even though i created a new apple id. I also can't remember the password and now can't access icloud. Do i need to reset the phone?
If you are unable to remember your password, security questions, don’t have access to your rescue address or are unable to reset your password for whatever reason, your only option is to contact AppleCare(or Apple ID Support), upon speaking to an operator you should explain that your problem is related to your Apple ID, this way you will not be charged for assistance, even if you don’t have an AppleCare plan.
The operator will take you through some steps you may have already tried, however they need to be sure they have exhausted all usual approaches before trying to reset your account, so you should try to be helpful and show patience with the procedure.
The operator will need to verify they are speaking to the account holder and may ask you some questions that only the account holder could know, and you will need to answer them if the process is to proceed.
Once the operator has verified your identity they will send a message through to your device which contains an alpha numeric code, which you will need to read back to them.
Once this has been completed they will send an email to your iCloud email address after a period of 24 hours, so you should check that mail is enabled in your devices iCloud settings.
Upon receipt of the email, use the reset link provided to reset your password, after which you should be able to make the adjustments to iCloud that you wish to do. -
I saved photos from my Macbook Pro onto my Iphone (using itunes, 4 years ago). My macbook is now dead and I need to get the photos I saved off of my iphone 3GS transferred to a pc. Any help... From my PC I can only access "internal storage"
The iphone is not a storage/backup device. The picture sycn is one way - computer to iphone. The photos are also reduced in size when synced to iphone so they are not of the original quality
It has always been very basic to always maintain a backup of your computer.
Have you failed to do this?
If so, not good at all, you can e-mail the pics to yourself - keep in mind they will never be of the original quality -
I bought this MAC from a family member. Did everything need to change items to my apple id. Today I did the update for IOS Yosemite now the app store is auto filling with someone else id?? But they seem to be my apps??
If you didn’t erase the drive and install using you AppleID, then the OS and the purchased apps are still registered to the other AppleID. You cannot change that by logging into iCloud. Apps are forever tied to the AppleID used to purchase/download them.
You have to erase the drive and download/install the Apps using your AppleID. -
hello. So I have used my iPod touch 4g for 2 years now and need to change the battery. My question is: will I lose everything I have on my iPod like my music,pictures and apps if I change the battery on my iPod touch 4g?
Thanks for answerIf you go to Apple, they will not replace your battery, but exchange your iPod for a refurbished iPod of the same model with a new battery. Therefore you will lose everything that is not backed up. If you change it yourself or have a third party change it, you will most likely not lose anything (but still best to make a backup as lllaass suggested).
-
I have a G5 mac using ver 10.4.11 and a newer mac using ver 10.8.4 these are networked. using the new mac i looked up my my photo on the old mac. It then said you need to upgrade your library which it did. Now the old mac can not open the photos and say that I need to upgrade my I photo to a newer version. The old mac has no more support from apple in software update so I am not sure where I should go from here. can I use new soft ware with the old mac
The other part of the upgrade message was a warning that once you upgraded you would no longer be able to open the library with the old version which is exaclty what you did and what happened when you choose to continue
The iphoto library needs to be upgraded to work with this version of iPhoto. Your photo library will not be readable by previous versions of iphoto after the upgrade. The upgrade process may take several minutes depending on the number of photos in the library. Cancel or upgrade.
So now your choices are to not use iPhoto with the previous version using it onky with the newer version, restore your backup from before you did this upgrade or purchase iPhoto Library Manager and use it to rebuild the library using the older version of iPhoto (instructions are on their web site) thereby downgrading it (without projects)
LN -
Today I deleted an email services I no longer need. Now when I go to the notes app I no longer have any notes. Is there any way to get my notes back. I have the first iPad running iOS 5.1.1
Ah, well, then the notes are probably gone. Did you save any of the email from that account on your computer? The notes might be there if you did.
Maybe you are looking for
-
I tried to buy on itunes and it said" your apple id has been disabled".Do you know why and how do I fix it?
-
I can't make an editable template in dreamweaver CS5 help!
Here is my problem. I insert an editable region, and that works just fine. However, when trying to create a page from this template, I can't edit the CSS. Normally, I click the area of the CSS I want to edit, and go to modify>templates>make attribute
-
My movie is not downloading but the movie extras are, how do i get the movie back without repurchasing it? I've tried searching through my available downloads but only the extras showed up not the movie. All my other movies are there including the ex
-
How to create an image banner that slides left to right with mouseover?
I need to create a web banner like the one on the following site: www.gracelandbaptist.org. I have been unabe to find anything on how to create such a banner. I believe it was created in flash but am not sure. I want my banner to work in the same
-
Hi Gurus, I have requirement like , Non SAP System ( VB.Net ) need to call the SAP sytem through a particular DLL and get the result from the SAP. As of now that DLL calls a stored procedure and get connects to other system. Please let me know what w