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: RN-Motor an I2C-Bus Kategorie: C-Control I V1.2/2.0 (von Windt H.J. - 1.07.2005 19:48)
 Als Antwort auf RN-Motor an I2C-Bus von Gaston - 1.07.2005 3:05
Hello,
Sorry I am writing this in English.
Would you like to try something?
Connect the sda line from your motor controller to port 4 and the scl line to port 5 of the c-control I v2.0 and load and run the program below.
Please let me know what the lcd displays.
Greetings,
H.J. Windt

'----------------------------------------------------------------------------------------------------'
'*********************************************************************'
'*                         WINDT SYSTEMS                             *'
'* DEVICE SEEK FOR EMULATED I2C BUS v1.2 for CCIUM2.01 with CCIAB2.0 *'
'*                           H.J. WINDT                              *'
'*                             2004                                  *'
'*********************************************************************'
'----------------------------------------------------------------------------------------------------'
'This software, with the C-Control I Unit M2.01 mounted on the C-Control I Application Board 2.0,'
'will search the emulated I2C bus for any I2C devices and display the address on the LCD'
'of any found I2C device.'
'The emulated SDA line is via port 4.'
'The emulated SCL line is via port 5.'
'Feel free to use and share this software!'
'----------------------------------------------------------------------------------------------------'
'*************** INS and OUTS **************'
define sda port[4]
define scl port[5]
define lcd_backlight_off port[16]
'*******************************************'
'**************** VARIABLES ****************'
define i2c_nack bit[1]
define i2c_last bit[2]
define i2c_nack_count byte[2]
define i2c_byte byte[3]
define i2c_out_bit bit[24]
define i2c_in_bit bit[17]
define loop byte[4]

define address byte[5]
'*******************************************'
'**************** CONSTANTS ****************'

'*******************************************'
'****************** SETUP ******************'
print"#ON_CONFIG#"; : put &b1000 : print"#OFF#"; 'activate pullup resistors byteport 1'
lcd_backlight_off = 0
print"#ON_LCD#";:print"#INIT#";:print"#CLR#";
print" WINDT SYSTEMS";
print"#L201#";
print"EI2C DEVICE SEEK";
pause 150
'*******************************************'
'***************** PROGRAM *****************'
#start
print"#CLR#";
for address = 0 to 254 step 2
print"#L101#";
print"EI2C Search ADR=";
print"#L206#";
print "&d";address;
#try_i2c_again
gosub start_i2c
i2c_byte = address : gosub write_byte_i2c
gosub stop_i2c
if i2c_nack_count > 0 and i2c_nack_count < 4 then goto try_i2c_again
if not i2c_nack then gosub print_i2c_device_address
next
print"#CLR#";
print"#L106#";
print"DONE!!";
pause 150
print"#CLR#";
lcd_backlight_off = 1
print"#OFF#";
end
'*******************************************'
'*************** SUBROUTINES ***************'
#print_i2c_device_address
beep 4,2,4: beep 4,2,4
print"#CLR#";
print"#L103#";
print"EI2C Device!";
print"#L201#";
print"Address = &d";
print address;
pause 300
print"#CLR#";
return

#start_i2c
sda = 0 : scl = 0
return

#stop_i2c
sda = 0 : deact scl : deact sda
return

#write_byte_i2c
for loop = 1 to 8
sda = i2c_out_bit
deact scl
#write_byte_i2c_clock_stretch
if not scl then goto write_byte_i2c_clock_stretch
scl = 0
i2c_byte = i2c_byte shl 1
next
deact sda
deact scl
#write_byte_i2c_ack_clock_stretch
if not scl then goto write_byte_i2c_ack_clock_stretch
i2c_nack = sda
scl = 0
if i2c_nack then goto i2c_error
i2c_nack_count = 0
return
#i2c_error
i2c_nack_count = i2c_nack_count + 1
goto stop_i2c
'*******************************************'
'******* INITIALIZATION SUBROUTINES ********'

'*******************************************'
'****************** DATA *******************'

'*******************************************'

>
>
> Hallo,
>
> ich versuche seit Tagen die Schrittmotorsteuerung RN-Motor über den I2C-Bus einer C-Control-1 M-Unit V2.0 anzusteuern und bekomme es einfach nicht hin. Hat vielleicht jemand das Problem schon gelöst und wäre bereit mich vor der Verzweiflung zu retten?
>
> Vielen Dank im Voraus für die Hilfe
>
>

 Antwort schreiben

Bisherige Antworten:

Re: RN-Motor an I2C-Bus (von Gaston - 2.07.2005 10:49)
    Re: RN-Motor an I2C-Bus (von Henrik - 2.07.2005 11:53)
        Re: RN-Motor an I2C-Bus (von Gaston - 3.07.2005 10:38)