Thursday, 30 April 2015

Simple protocol

The protocol between the Raspberry Pi and the Arduino. Each message is 2 bytes, the first one ends with bit-0, the second one ends with bit-1. Using this messages the Pi can change the motor speed and send motor correction. Also there is a message for backlight, as it's set by the Arduino.

0x80 + data7        1 0 0 0  0 0 x 0  | x x x  x x x x  1  - Backlight

--------------------------------------------------------------------------------------------------
        
0x60 + data7        0 1 1 0  0 0 x 0  | x x x  x x x x  1  - RA SPEED  ( 8 bit ) 0 - 256              <- ok
0x60 + data7        0 1 1 0  0 1 x 0  | x x x  x x x x  1  - RA SPEED CORRECTION ( 8 bit ) 0 - 256

0x70 + data2        0 1 1 1  0 0 . 0  | . . .  . . x x  1  - RA/DEC default direction                 <- ok

0x50 + data1        0 1 0 1  0 0 . 0  | . . .  . . . x  1  - start/stop RA    start=1 stop=0          <- ok 

0x40 + data1        0 1 0 0  0 0 . 0  | . . .  . . . x  1  - stop correction  RA=1 DEC=0              <- ok
                                
0x00 + data12       0 0 x x  x x x 0  | x x x  x x x x  1  - steps  ( 0 - 4095 )
                                
--------------------------------------------------------------------------------------------------
                
0xC0 +              1 1 x d  m a a 0  | a x x x x x x 1    - Correction                               <- ok
                        | |  | | |      | 0 0 0 0 0 0      - DO NOW                                   <- ok
                        | |  | | |      | 1 1 1 1 1 1      - wait for steps in 0x00 message
                        | |  | | |      | . . . . . .      - use these steps (6 bit) 0..62            <- ok
                        | |  | | |      | 
                        | |  | --------------------------- - correction (3bit) = 0..7
                        | |  ----------------------------- - micro correction  micro=1, normal=0      <- ok
                        | -------------------------------- - direction 1,0                            <- ok
                        ---------------------------------- - RA=1 DEC=0                               <- ok

No comments:

Post a Comment