![]() |
Re: Visual C++ 2005 Designer
1 Attachment(s)
Quote:
No, not really. To my knowledge there is no real debugging system for the RC other than the printf statements. This program will allow you to watch 10 values(16 bit) at any given time. Each column has a list to choose form. There will be a preset of pwms, analogs, digital I/O, OI port values, etc. But there will also be some extra values, ex. X1, which when programed into the RC allows you watch any variable (16 bit or less). Ex: x_1 = some_count = .......; Then you select the X1 in any column and you start seeing a printf style stream of values. Helpful when you are debugging a whole function. You can assign each variable in your function to a x_1 through x_x and watch all their values simultaneously. The PIC is simulating an RC. (Don't have access to an RC one right now) If I can get around to it(probably won't), the program might actually be able to control the robot using this: (Its not done, not even close...) |
Re: Visual C++ 2005 Designer
Quote:
|
Re: Visual C++ 2005 Designer
Quote:
|
Re: Visual C++ 2005 Designer
Quote:
Can someone explain what it means when such an exception is thrown? Thanks |
Re: Visual C++ 2005 Designer
Quote:
Something isn't initialized and there is a NULL Pointer and you are trying to assign a NULL pointer to a data slot. . Looking in this instance my guess is there isn't Serial Communications between the PIC and the computer, and that serialPort1 is probably NULL ?? My suggestion would be when you get a problem like this is set a breakpoint couple lines before the error and then run till it gets the breakpoint and do System Watches on the important variables and use the Step Over and Step Into to go step by step through the for loop. . . If something is null it normally comes up as something in red text or a value that you know isn't correct in the watch window. |
Re: Visual C++ 2005 Designer
Your problem comes when "child" calls "parent"
In c++ once you have included a file once, you can't do it again without causing build errors. You create a continual loop with including parent and chile again and again. If you want to go into inheritance issues and calling parent functions you can, there is an easier way. Create another file called "parenta" and copy over all of the code from "parent" Then slightly change all of the function and class names to avoid build errors, and your almost done. Change "child" to call "parenta" instead of "parent" and problem solved. "parent" should include "child" which should include "parenta" Hopefully that solves your problem :) |
Re: Visual C++ 2005 Designer
Quote:
Thanks, anyway, but I think I got the original problem one fixed. The dynamic cast thing seems to be working. This program is already taking much longer than excepted...quite frustrating. Again, thanks...I really need to get going on this thing. Ok here is my function in DataView.cpp: Quote:
I don't get it: I am just calling something else form the main after the ReadByte(), but I get an Null exception. Any Ideas? |
Re: Visual C++ 2005 Designer
Do you guys think this is a worthwhile crusade, in terms of usefulness?
Are there any other options? If anyone is interested I will release it...Hopefully the main part will be done by then... |
Re: Visual C++ 2005 Designer
I'm not in front of VC++ right now, but typically there is an Object Browser or that type of thing that allows you to view objects, variables, arrays, pointers, etc when running the program in debugging mode. It might just be part of their debug menu to watch variables, etc. I would watch both the main pointer, and the main MdiParent object itself. You should be able to follow the pointer in the watch menu to see it correctly reference the class's methods, members, etc. Again, since I'm not in front of the IDE I can't give you more specific names to look for.
The idea you've come up with seems pretty useful, the only question will be the overhead on the serial port/quantity of interrupts if your RC is interrupt heavy. It was somewhat difficult to tell from the GUI screen, but how many bytes of data will be sent per "GUI update"? And this will be called every "slow loop" to update or every "fast loop"? |
Re: Visual C++ 2005 Designer
Quote:
The RC has to only read 2 bytes every program loop unless some value has been changed on the GUI. This just to make sure there is a link, otherwise after 20 program loops it will completely stop the robot. If something is touched another 20 bytes have to processed that program loop. The RC is probably going to be sending about 21 to 50 bytes a program loop depending on your needs. No reprogramming required to change the variables watching. I could lower the bytes send by making it even more dynamic but it will put more processor overhead(Checking which values changed so as to send only that one). So its a choice between more processor overhead or more serial port work; in the end it is about the same load on the processor. If you just want the DataView functionality then the RC only has to send about 21-22 bytes(16 bit values and 1 or 2 starter bytes) per loop to fill all 10 columns. About the Problem: It seems to be only happening(returning a null reference) when I call the serialPort1 from the another form Main^ main = dynamic_cast<Main^>(this->MdiParent); main->serialPort1->ReadByte(); If I call it in the main form(where it resides) with just, serialPort1->ReadByte(), it working and reads fine. I have been using the debug features in the Visual Studio and though it has gotten me close, it hasn't exactly helped me pinpoint the source. |
Re: Visual C++ 2005 Designer
Are you still having problems with the SerialPort?
This question has nothing to do with debugging the app, but is this designed to be connected to the RC's serial port or the dashboard port on the OI? |
Re: Visual C++ 2005 Designer
Try adding brackets after your while statement. This is probably your problem because your while statement isn't doing anything right now.
ex: for(){ while(){ arguments } } p.s. The first dashboard is something like what you are trying to develop. Have you taken a look at it? |
Re: Visual C++ 2005 Designer
Quote:
Although on further inspection it might be a good idea to ensure the while loop waits to get 2 bytes instead of just 1, since you end up using 2 bytes of data. That way you don't accidentally skip a byte if you ReadByte() twice before the second byte you assume is there hasn't shown up. Thats the fun of events that are asynchronous :) |
Re: Visual C++ 2005 Designer
1 Attachment(s)
Quote:
The problem is it fails when i call in the other forms from the main: main->...anything!!! (only when the pic is sending some data over the serial port to the computer, otherwise it runs fine. And I think it only happens in this function) comes up with: Object reference not set to an instance of an object I will try to get some more info. Quote:
The dashboard is quite limiting in that you have reprogram your robot if you want to display different values. This should in theory allow you access any previously programed( and not removed) variables on the fly. The RC doesn't flood the program with all the stuff at the same time(wasting its processor time too). Rather when you change something in any column the Application send the RC which new variables to send to the App. |
Re: Visual C++ 2005 Designer
Thanks everyone for all the help.
I have finally gotten it to perform full duplex communications with a Pic. All I have to do is select a variable form the drop down menu and it will instantly change show me what the new variable values are in real time. Never thought I would get it to work. Started in summer...got it working a couple days ago... Thanks again everyone, but I might have more questions... |
| All times are GMT -5. The time now is 20:55. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi