Das Open-Control-Projekt - Die Alternative zur C-Control-I


Das Forum zur C-Control-1
Welche C-Control-Varianten existieren?
Übersicht - Suchen - Neueste 50 Beiträge - Neuer Beitrag - Login - Registrieren
INFO - FAQ - CC2-Forum - CCPro-Forum 

 Re: CMPS03 16 bit bearing read v1.0 for CCIMU1.1 with CCISB Kategorie: C-Control I V1.1 (von sl - 10.12.2004 22:12)
 Als Antwort auf CMPS03 16 bit bearing read v1.0 for CCIMU1.1 with CCISB von Windt H.J. - 10.12.2004 21:25
Okay
i interpretate your penetrant posting of your program as:
"you want to have some reaction on posting your program"

here it is:

where can the sensor be bought?
how much will it cost?
can you translate it into german?

sl

> '----------------------------------------------------------------------------------------------------'
> '***********************************************************************'
> '*                         WINDT SYSTEMS                               *'
> '*      CMPS03 16 bit bearing read v1.0 for CCIMU1.1 with CCISB        *'
> '*                           H.J. WINDT                                *'
> '*                             2004                                    *'
> '***********************************************************************'
> '----------------------------------------------------------------------------------------------------'
> 'This software, with the C-Control Main Unit 1.1 mounted on the C-Control starterboard,'
> 'will read the 16 bit bearing from the compass CMPS03 and display the bearing on a terminal program.'
> 'Port 15 will be used as the sda port for I2C communication.'
> 'Port 16 will be used as the scl port for I2C Communication.'
> 'For demonstration purpose use a terminal program like the one I found >>'
> 'RS232 TERMINAL at www.b-kainka.de/pcmessfaq.htm'
> 'Feel free to use and share this software.'
> '----------------------------------------------------------------------------------------------------'
> '*************** INS and OUTS **************'
> define sda port[15]
> define scl port[16]
> '*******************************************'
> '**************** VARIABLES ****************'
> define i2c_byte byte[1]
> define d7 bit[8]
> define d0 bit[1]
> define i2c_error bit[9]
>
> define i2c_high_byte byte[3]
> define i2c_low_byte byte[4]
> define i2c_word word[2]
> define loop byte[5]
> '*******************************************'
> '**************** CONSTANTS ****************'
>
> '*******************************************'
> '****************** SETUP ******************'
>
> '*******************************************'
> '***************** PROGRAM *****************'
> #start
> gosub get_cmps03_bearing_word
> print"Bearing = ";i2c_word
> goto start
> '*******************************************'
> '*************** SUBROUTINES ***************'
> #get_cmps03_bearing_word
> i2c_error = 0
>
> gosub start_i2c
>  
> i2c_byte = &b11000000 'CMPS03 ADDRESS + WRITE'
> for loop = 1 to 8
> sda = d7
> gosub scl_pulse
> i2c_byte = i2c_byte shl 1
> next
> gosub ack_i2c
>
> i2c_byte = 2 'CMPS03 REGISTER'
> for loop = 1 to 8
> sda = d7
> gosub scl_pulse
> i2c_byte = i2c_byte shl 1
> next
> gosub ack_i2c
>
> gosub restart_i2c
>
> i2c_byte = &b11000001 'CMPS03 ADDRESS + READ'
> for loop = 1 to 8
> sda = d7
> gosub scl_pulse
> i2c_byte = i2c_byte shl 1
> next
> gosub ack_i2c
>
> for loop = 1 to 8 'CMPS03 16 BIT BEARING HIGH BYTE'
> d0 = sda
> gosub scl_pulse
> if loop < 8 then i2c_byte = i2c_byte shl 1
> next
> i2c_high_byte = i2c_byte
> deact sda
> sda = 0
> gosub scl_pulse
> deact sda
>
> for loop = 1 to 8 'CMPS03 16 BIT BEARING LOW BYTE'
> d0 = sda
> gosub scl_pulse
> if loop < 8 then i2c_byte = i2c_byte shl 1
> next
> i2c_low_byte = i2c_byte
> deact sda
> sda = 0
> gosub scl_pulse
>
> gosub stop_i2c
> if i2c_error then goto get_cmps03_bearing_word
> if i2c_word < 0 or i2c_word > 3599 then goto get_cmps03_bearing_word
> return
>
> #start_i2c
> sda = 0
> scl = 0
> return
>
> #restart_i2c
> deact sda
> deact scl
> sda = 0
> scl = 0
> return
>
> #stop_i2c
> deact scl
> deact sda
> return
>
> #scl_pulse
> deact scl
> #wait
> if scl = 0 then goto wait
> deact scl
> scl = 0
> return
>
> #ack_i2c
> deact sda
> if sda <> 0 then i2c_error = 1
> goto scl_pulse
> '*******************************************'
> '****************** DATA *******************'
>
> '*******************************************'
>
>
>

 Antwort schreiben

Bisherige Antworten:

Re: CMPS03 16 bit bearing read v1.0 for CCIMU1.1 with CCISB (von Windt H.J. - 11.12.2004 19:46)
Re: CMPS03 16 bit bearing read v1.0 for CCIMU1.1 with CCISB (von Stefan Tappertzhofen - 10.12.2004 22:25)
    Re: CMPS03 16 bit bearing read v1.0 for CCIMU1.1 with CCISB (von Achim - 11.12.2004 1:49)
        Re: CMPS03 16 bit bearing read v1.0 for CCIMU1.1 with CCISB (von Stefan Tappertzhofen - 11.12.2004 11:52)