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 Henrik, Homepage - 2.07.2005 11:53)
 Als Antwort auf Re: RN-Motor an I2C-Bus von Gaston - 2.07.2005 10:49
Henrik nutzt:  CC1-M-Unit V1.2/2.0, Micro

> Hello,
>
> thank you for your answer.
> Unfortunately I have no application board and no lcd display.
>
> Greetings
> Gaston


Hello again,

well - this should not be a hindrance. Important are only the I2C routines wich take care
of clock stretching. Its worth a try and as far as I can see by theorie, it should work, as long
as no other tricky features are used with the RN-Motor (I mentioned that in a former post).
Below I shortended the code to make the essentials clearer. What's missing are I2C read
routines, but the fundamental functions of the RN-Motor can be accessed by writing only.

So ein Mist --- jetzt hab ich das auf Englisch getippt und bin zu faul nochmal zu
übersetzen. Hoffe es ist auch so verständlich.

Grüße
Henrik
 



> > '*************** 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]
> > '*******************************************'
> >
... Hier steht Dein Programm
...
...
...

> > '*************** SUBROUTINES ***************'
> >
> > #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


Meine Homepage: http://www.henrik-reimers.de/control/

 Antwort schreiben

Bisherige Antworten:

Re: RN-Motor an I2C-Bus (von Gaston - 3.07.2005 10:38)