picaxe to X-SIM interface

xtech007

Senior Member
Hi all!
Picaxe to X-SIM comunication.( Racing/Flight simulator)
I have asked this in the past, but I might had gotten the right answer but I was to new to the electronics and coding.
After abandoned the project for a while,I had decided to give it a go again!

I have build the hardware, frame , seat & used wiper motors for motion.
What is missing?
The controller!!

There are controller designed around Arduino and other commercial companies.

I would like to use Picaxe 28x2!
Just got few last week!!!!
 

xtech007

Senior Member
details

Here are the details:
The interface (28x2)will collect data (serial) from the USO. Then compare it to position of actuators via potentiometer, then do some math then send i2c data to motor controller (MD03). Like a close loop system.
Will elaborate as project move foward.

1st step;
Comunication, serial.
USO comport speed 38400,8,no parity,1stopbit
Data packet: AB~255~~a01~~a02

So, my 28x2 at 64MHz should be
Serin pin,n38400_64,("AB"),b4,b5,b6,b7

Is this correct?
 

inglewoodpete

Senior Member
xtech, it's hard to determine what you're trying to do. When you describe the "Data packet: AB~255~~a01~~a02", do you mean literally? Ie 5 x Tilde (~) characters? From what is in that string, what are you expecting to appear in b4, b5, b6 and b7?
 

hippy

Ex-Staff (retired)
The "AB~255~~a01~~a02~" seems to be the data format definition, telling X-SIM what data should be in the packet output. In this case A, B and ~255~ appear to be literal values and ~a01~ and ~a02~ are replaced by actual x and y axis values. What actually gets sent seems to depend on how the USO is configured -

http://www.x-sim.de/manual/uso.html

If sending at 38400 baud, using 8-bit resolution, and binary output format, with that stated data format specification, it looks to me that your SERIN would be correct.

I don't know if SERIN could keep up with what the USO sends and it might be problematic using a high baud rate if the PC sends back-to-back bytes as it probably will. I would suggest using a slower baud rate and using two stop bits to start with.

The first step I would take would be to set the USO up and then look at the data output on the serial port by looping that back into another serial port on the same or another computer, and using a Terminal program to see all the raw data transmitted. That should give the information as to what the exact format for SERIN should be.

You could skip that step; choose the SERIN format it seems to be then print out what you are getting.

If it works how I think it does, I would change "AB~255~~a01~~a02~" to "S~a01~~a02~U" then the SERIN test loop should I think become ...

Code:
Do
  SerIn PIN, BAUD, ("S"), b0, b1, b2
  If b2 = "U" Then
    SerTxd( "X=", #b0, 9, "Y=", #b1, CR, LF)
  Else
    SerTxd( "Bad packet", CR, LF )
  End If
Loop
 

xtech007

Senior Member
Thanks for the replies!

Hippy you are correct on the USO explanation!
Sometimes I get too excited and it's hard to explain what is been intended.

Decided to use the 64MHz due to the overhead math the 28X2 will be accomplishing to tell the motor in what direction and speed to move.

With that in mind, and taking advantage of the clock speed I figured my baud should be fast too.
But honestly I think 9600_64 is fast enough. don't think I need to transfer 9600 bytes per second anyways!

Your comments are always Welcome.
 
Top