- MultiPlus Wechselrichter Insel und Nulleinspeisung Conrad         
Seite 2 von 2 ErsteErste 12
Ergebnis 11 bis 15 von 15

Thema: C-Control + SD20 Testprogramm !!

  1. #11
    Neuer Benutzer Öfters hier
    Registriert seit
    29.04.2006
    Beiträge
    20
    Anzeige

    LiFePo4 Akku selber bauen - Video
    I don`t understand? This is the original-code?
    but is doesn´t work! Then i have usally change the code with my port numbers.. no success!

    and the i deleted the print function... because the querys of servo number and position were replaced with static number and position!?

    I haven´t any keyboard or Display on the Starter-Board with the C-Control 1 unit!

    The simulator hang on this line:
    if not scl then goto write_byte_i2c_clock_stretch
    mfg

    I use Conrad CControl/CCBasic 2.0 IDE

  2. #12
    Neuer Benutzer Öfters hier
    Registriert seit
    29.04.2006
    Beiträge
    20
    Ohh..

    A big mistake from me... i need a Terminalprogramm to use your code, ahh i understand what you mean! OK!
    Any Servo drive to the Position i set on the terminal.
    It is in function... now i want to set static Servonumbers and positions to automate a Moving-System without a Terminal-Program.

    How are the settings on your program to implement this automatic-moves for the servos?

    thanx

  3. #13
    Benutzer Stammmitglied
    Registriert seit
    28.08.2006
    Beiträge
    48
    Hello,
    If I understand correctly, the software is working.
    Lets try something.
    You will still need the terminal program for this test.
    The test will use servo 1 and servo 3
    Try the code below and let me know what the Servos are doing and if the terminal program displays:
    ********************
    * No ACK from SD20 *
    ********************
    Greetings,
    Drifter2006

    Code:
    '**************** I/O PORTS ****************'
    define sda port[7]
    define scl port[8]
    '*******************************************'
    '**************** A/D PORTS ****************'
    
    '*******************************************'
    '**************** D/A PORTS ****************'
    
    '*******************************************'
    '**************** VARIABLES ****************'
    define control_flags byte[1]
    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 i2c_loop byte[4]
    
    define servo_number byte[5]
    define servo_position byte[6]
    '*******************************************'
    '**************** CONSTANTS ****************'
    define sd20_i2c_address 194
    '*******************************************'
    '****************** SETUP ******************'
    
    '*******************************************'
    '***************** PROGRAM *****************'
    #start
    servo_number = 1
    servo_position = 255
    gosub sd20_servo_driver
    
    servo_number = 3
    servo_position = 255
    gosub sd20_servo_driver
    
    servo_number = 1
    servo_position = 1
    gosub sd20_servo_driver
    
    servo_number = 3
    servo_position = 1
    gosub sd20_servo_driver
    
    goto start
    '*******************************************'
    '*************** SUBROUTINES ***************'
    #sd20_servo_driver
    gosub start_i2c
    i2c_byte = sd20_i2c_address : gosub write_byte_i2c
    i2c_byte = servo_number : gosub write_byte_i2c
    i2c_byte = servo_position : gosub write_byte_i2c
    gosub stop_i2c
    if i2c_nack_count > 9 then goto no_ack_from_sd20
    if i2c_nack then goto sd20_servo_driver
    return
    
    #start_i2c
    sda = 0 : scl = 0
    return
    
    #stop_i2c
    sda = 0 : deact scl : deact sda
    return
    
    #write_byte_i2c
    for i2c_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
    
    #read_byte_i2c
    i2c_last = 0
    #get_i2c_byte
    deact sda
    for i2c_loop = 1 to 8
    deact scl
    #read_byte_i2c_clock_stretch
    if not scl then goto read_byte_i2c_clock_stretch
    i2c_in_bit = sda
    scl = 0
    if i2c_loop < 8 then i2c_byte = i2c_byte shl 1
    next
    if i2c_last then deact sda else sda = 0
    deact scl
    #read_byte_i2c_ack_clock_stretch
    if not scl then goto read_byte_i2c_ack_clock_stretch
    scl = 0
    return
    
    #read_last_byte_i2c
    i2c_last = 1
    goto get_i2c_byte
    '*******************************************'
    '******* INITIALIZATION SUBROUTINES ********'
    
    '*******************************************'
    '********* CALIBRATION SUBROUTINES *********'
    
    '*******************************************'
    '****************** DATA *******************'
    
    '*******************************************'
    '************* ERROR MESSAGES **************'
    #no_ack_from_sd20
    print"********************"
    print"* No ACK from SD20 *"
    print"********************"
    pause 50
    return
    '*******************************************'

  4. #14
    Neuer Benutzer Öfters hier
    Registriert seit
    29.04.2006
    Beiträge
    20
    Hmmm. ..very big surprise... all Servos in function...

    Hmm...i don't know what are the problems on the beginning of this thread.

    I had the same code you send in the last answer, to set static Servo-Number and position, but there were not in function and now.... it works.

    daftly affairs

    Thanx for your very good explanation!

    Borris

  5. #15
    Benutzer Stammmitglied
    Registriert seit
    28.08.2006
    Beiträge
    48
    Hello nighteagle,
    Great to hear its working! \/
    There must have been a loose connection somewhere.
    Success with your project!
    Greetings,
    Drifter2006

Seite 2 von 2 ErsteErste 12

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

Labornetzteil AliExpress