Sorry but i havn’t done pBASIC in a long time. If you post your code, i will dig our the pBASIC manual and have a look at it when i get home. Also, how do you have things connected.
basic run error means your code is getting stuck.
Sorry but i havn’t done pBASIC in a long time. If you post your code, i will dig our the pBASIC manual and have a look at it when i get home. Also, how do you have things connected.
basic run error means your code is getting stuck.
Here is the BASIC code. I added the SERIN after the one that is already there. I have the dashboard port hooked to the Program port via a null modem cable. I have also tried it with a direct serial. The null gives me basic run err and the direct gives me basic init err.
Thank you,
Jacob Komar
I attached the file. get rid of the .txt to get the bsx.
Trial OI CODE.bsx.txt (23.7 KB)
Trial OI CODE.bsx.txt (23.7 KB)
The problem is that in your second serin, you are reading from the wrong pin (should be 16 not 1/0), at the wrong baud rate.
the line should read
Serin 16, 110, oi_sw…
Pin 16 is connected to the input pin of the program port. You need to use a baud rate of 19,200. 110 instructs a baud of 19,200 (as calculated from the formula in the basic stamp manual). This might not work. The datasheet strongly cautions against using a baud higher that 4800 or the stamp might not be able to keep up.
After changing the code, I still get the Basic Run Err light. I tried disabling the Serin COMA/COMB and it still sees the operator interface and runs without it. I still get the Basic Run Err though. I also tried toning the Baud rate down.
Jacob Komar
Revised Comments:
If I remove ALL of the serin commands, I also get the Basic Run Err. Could this mean that it doesn’t see the serin 16 as a valid command?
You are probably having the problem of trying to receive data faster than the stamp can handle. There is no way around this. I am pretty sure that 16 is right but there is a chance i could be wrong. It has been a long time since i have dealt with the old controllers of basic stamps at all.
BTW: you cannot “tone down” the baud rate or the communication will become totally corrupted. You will be listening at a different rate than data is being sent by the dashboard.
Also it is essentially receiving “BS” data. Data from the dashboard port is not in the format that is expected. This may be causing some later piece of code to screw up.
I removed all of the code afterward, so it’s not hanging up there. Even if the baud rate is wrong, shouldn’t it still try to recieve data? If I unplug the dashboard cable going to the program port, it still gives me the error. Should it do this? Where can I find out about that port 16 thing?
Jacob Komar
the port 16 thing is mentioned in the serin section of the basic stamp manual. 16 is a special number that actually means pin 2 which is the pin used for programming the stamp. This should be the one connected to the “program” port. The manual is vague, but apparently 16 also offers some sort of enhanced hardware support for receiving serial data.
I just obtained a VEX computer, which has a com port adapter and digital I/Os. It can be programmed in C. What C code would I use to interpret the data stream from the dashboard port through the built in com connector thingy?
Jacob Komar
I have never messed with a vex controller and don’t much of anything about them.
-------------- edit ---------------
I downloaded the default VEX code and documentation. The VEX controller looks to be almost identical to the EDU and full size RC. This is a good thing. I will give you some example code sometime tomorrow.
That would be great. I was sucessfully able to download to the computer using the IFI loader, so now its just a matter of writing the code. If you could give me some sample input code, that would be great.
Jacob Komar
I just obtained an old basic stamp that can be programmed using basic stamp. Right now it can obtain data from an old FRC, but just simple stuff. I am expanding it to work with the real FRC.
If you have that C code, that would still be helpful I think.
Thank you,
Jacob Komar
After a day’s work on this, this is how far I got.
The Basic Stamp can see the dashboard port, because it doesn’t get hung on the 255,255. My problem now is capturing the correct packets. Do I need to name the input varibles the same as they are in the specification sheet? Even if they do, the one that I care about, Switches_A, doesn’t pass bit0, which is just p1_trig. Does anyone see any syntax errors?
Just remove the .txt at the end of the file name to get the bs2.
Jacob Komar
innew3.bs2.txt (1.38 KB)
innew3.bs2.txt (1.38 KB)
OK!
I got the stamp to read values from the OI packet, so when I press the trigger, I can make the logic value of a pin high; when I let go, it will go to low. As soon as I move the jumper over to RC next to the dashboard port, and write my code to check the ctrl_a, b and c to suck a certain byte (PWM 1, for instance,) it isn’t reading properly. For some bytes, only the lows will work, but when i try to switch it to a high, i get a 2.7 voltage, and other bytes are just 0 all the time. Any suggestions?
Jacob Komar
glad to hear it’s working… at least a little bit
post the most recent code. I might have an idea about why it might not work
You seem to be on a good track with the BASIC stamp, so i’m not going to bother with the C code.
Here is the latest code. Right now its written to capture the first Packet of the RC code and the 3rd byte, which is PWM 1. When PWM 1 is 0, the output 7 is 0 V, but when it gets above 150 (or whatever it is), it jumps all around.
Remember to remove the .txt
Thanks,
Jacob Komar
incode.bs2.txt (1.61 KB)
incode.bs2.txt (1.61 KB)
Sorry i took so long to respond. In the version you posted above, there is an extra endif on line 76. It shouldn’t even even let you compile that. It won’t let me.
Oh, I’m sorry about that. I had adjusted the code for the OI, and I readjusted it for the RC so I could post it. I must have uncommented too many things. The version that I used yesterday for the RC decoder compiled properly. I tried multiple ways of using if statements to check those control bits, so I had ifs all over the place. I must have uncommented it by accident.
Jacob Komar
I GOT IT!!!
I don’t know how I did it, but I got it. I updated the code, (not much of a difference,) but now it works. I also attached the code I downloaded to the FRC (I did it in easyC so that I knew it wasn’t my crappy C coding that was the problem :o ). YAYAYAYAYAYAYAY!!!
My xilinx board is currently on the truck to my house, so later on I can work on the xilinx code for decoding the stuff that comes out of my stamp.
I’ll keep you guys updated!!!
Jacob Komar
stamptester.ECP.txt (81 Bytes)
stamptester.BDS.txt (4.51 KB)
incode.bs2.txt (1.61 KB)
stamptester.ECP.txt (81 Bytes)
stamptester.BDS.txt (4.51 KB)
incode.bs2.txt (1.61 KB)
I lied. Only PWM 1 works, and only a little bit at that. Sometimes, the light stays solid at 5 Volts, but sometimes it blinks (between 0 and 30 V.) Its very confusing. Any other byte from the packet produces no output. Any assistence is greatly appreciated.
Jacob Komar
As i understand things, you have a Basic stamp connected to the OI. The Basic stamp is also connected to an LED. Is this correct?
How does a ligh blink at 30v? do you mean 30hz? What is it that you wrote in easy C? I thought you were using a Basic Stamp? I’m confused.