'Declerations of IIC.DLL-functions Declare Function StartCon Lib "Iic.dll" (ByVal Port_Address As Integer) As Integer Declare Function RepStartCon Lib "Iic.dll" (ByVal Port_Address As Integer) As Integer Declare Function StopCon Lib "Iic.dll" (ByVal Port_Address As Integer) As Integer Declare Function Transmit Lib "Iic.dll" (ByVal Port_Address As Integer, ByVal Transmit_Byte As Integer) As Integer Declare Function Receive Lib "Iic.dll" (ByVal Port_Address As Integer, Receive_Byte As Integer, ByVal Ackknowledge As Integer) As Integer Declare Function TestFree Lib "Iic.dll" (ByVal Port_Address As Integer) As Integer Declare Function TestConnected Lib "Iic.dll" (ByVal Port_Address As Integer) As Integer Sub ChipAdr_Change () ChipAdress = Val(ChipAdr.Text) 'on changing the (hardware)-chipadress read the new value from this textbox If ChipAdress < 0 Then ChipAdress = 0 'max. 7 If ChipAdress > 7 Then ChipAdress = 7 'min. 0 End Sub Sub ChipAdr_LostFocus () ChipAdr.Text = Str$(ChipAdress) 'if value in ChipAdr.Text < 0 oder > 7 then set ChipAdr.Text to 0 or 7 End Sub Sub Form_Load () ChipAdress = Val(ChipAdr.Text) 'read TDA8444-hardwareadress (0-7; = jumperposition) from this textbox If ChipAdress < 0 Then ChipAdress = 0 'exclude adresse < 0 If ChipAdress > 7 Then ChipAdress = 7 'or > 7 Lpt = Lpt2 'set LPT 2 as standart parallel-printerport Statustext.Text = " LPT-portadress = " + Lpt + " (dec.)" ' print LPT adress to status-textbox ErrorMsg = TestConnected(Lpt) 'IIC.dll - error-test-routine 'print errormessage of the IIC.dll-routine (for further information see Elektor 3/99, X-11) 'at programmstart into error-textbox If ErrorMsg = 0 Then Errortext.Text = " No errors" If ErrorMsg = 1 Then Errortext.Text = " IIC-bus is not free" If ErrorMsg = 4 Then Errortext.Text = " IIC-bus has no power supply" If ErrorMsg = 5 Then Errortext.Text = " IIC-Interface has not been connected" If ErrorMsg = 6 Then Errortext.Text = " Some undefined error occurred" End Sub Sub Parallel1_Click (Index As Integer) Lpt = Lpt1 'set LPT to LPT1 Parallel1(1).Checked = True 'check LPT1 in the parallel-printerport-menu Parallel2(1).Checked = False 'uncheck LPT2 in the menu Statustext.Text = " LPT-portadress = " + Lpt + " (dec.)" 'print LPT-adress to statustext End Sub Sub Parallel2_Click (Index As Integer) Lpt = Lpt2 'set LPT to LPT2 Parallel1(1).Checked = False 'check LPT2 in the parallel-printerport-menu Parallel2(1).Checked = True 'and uncheck LPT1 Statustext.Text = " LPT-portadress = " + Lpt + " (dec.)" ' print LPT-adress to the status-textbox End Sub Sub ServoScroll1_Change () DacAdress = 0 'adress/number (0-7) of the 6-bit DAC in the TDA8444 DacValue = ServoScroll1.Value 'value to be converted (0-63) 'endposition of scrollbar = 63 as scrollbar-property MAX = 63 A1 = 64 + (ChipAdress * 2) 'calculating the 1.databyte for the TDA8444 A2 = 240 + DacAdress 'calculating the 2.databyte for dhe TDA8444 A3 = DacValue 'calculating the 3.databyte for the TDA8444 'for composition of the 'datatelegramm' look at TDA8444-datasheet ' or the description in Elektor ErrorMsg = StartCon(Lpt) 'generating a I2C-startcondition and sending it to the chosen parallelprinterport ' Er1 = ErrorMsg 'if an error occured store the errornumber in the variable Er1 ' ErrorMsg = Transmit(Lpt, A1) 'sending the 1.databyte to the chosen parallelprinterport ( and so to the I2C-interface) ' Er2 = ErrorMsg 'if an error occured store the errornumber in the variable Er2 ' ErrorMsg = Transmit(Lpt, A2) 'sending the 2.databyte to the chosen parallelprinterport ( and so to the I2C-interface) ' Er3 = ErrorMsg 'if an error occured store the errornumber in the variable Er3 ' ErrorMsg = Transmit(Lpt, A3) 'sending the 3. databyte to the chosen parallelprinterport ( and so to the I2C-interface) ' Er4 = ErrorMsg 'if an error occured store the errornumber in the variable Er4 ' ErrorMsg = StopCon(Lpt) 'generating a I2C-stopcondition (end of transmission) to the chosen parallel-printerport ' Er5 = ErrorMsg 'if an error occured store the errornumber in the variable Er5 ' ErrorCap$ = " DAC 1: Errors = " + Str$(Er1) + Str$(Er2) + Str$(Er3) + Str$(Er4) + Str$(Er5) + " = " 'print errornumber of the IIC.dll ZS$ = Chr$(13) + Chr$(10) 'carriage return and line feed for new line (multiline-Text) If Er1 = 0 Then ErT1$ = " startcond .: No errors" 'full text of start condition error If Er1 = 1 Then ErT1$ = " startcond .: IIC-bus is not free" If Er1 = 2 Then ErT1$ = " startcond .: No acknowledge (ACK) received" If Er1 = 3 Then ErT1$ = " startcond .: Could not generate a stop-condition" If Er1 = 4 Then ErT1$ = " startcond .: IIC-bus has no power supply" If Er1 = 5 Then ErT1$ = " startcond .: IIC-bus has not been connected" If Er1 = 6 Then ErT1$ = " startcond .: Some undefined error occurred" If Er2 = 0 Then ErT2$ = " databyte 1: No errors" 'full text of 1. databyte sending error If Er2 = 1 Then ErT2$ = " databyte 1: IIC-bus is not free" If Er2 = 2 Then ErT2$ = " databyte 1: No acknowledge (ACK) received" If Er2 = 3 Then ErT2$ = " databyte 1: Could not generate a stop-condition" If Er2 = 4 Then ErT2$ = " databyte 1: IIC-bus has no power supply" If Er2 = 5 Then ErT2$ = " databyte 1: IIC-bus has not been connected" If Er2 = 6 Then ErT2$ = " databyte 1: Some undefined error occurred" If Er3 = 0 Then ErT3$ = " databyte 2: No errors" 'full text of 2. databyte sending error If Er3 = 1 Then ErT3$ = " databyte 2: IIC-bus is not free" If Er3 = 2 Then ErT3$ = " databyte 2: No acknowledge (ACK) received" If Er3 = 3 Then ErT3$ = " databyte 2: Could not generate a stop-condition" If Er3 = 4 Then ErT3$ = " databyte 2: IIC-bus has no power supply" If Er3 = 5 Then ErT3$ = " databyte 2: IIC-bus has not been connected" If Er3 = 6 Then ErT3$ = " databyte 2: Some undefined error occurred" If Er4 = 0 Then ErT4$ = " databyte 3: No errors" 'full text of 3. databyte sending error If Er4 = 1 Then ErT4$ = " databyte 3: IIC-bus is not free" If Er4 = 2 Then ErT4$ = " databyte 3: No acknowledge (ACK) received" If Er4 = 3 Then ErT4$ = " databyte 3: Could not generate a stop-condition" If Er4 = 4 Then ErT4$ = " databyte 3: IIC-bus has no power supply" If Er4 = 5 Then ErT4$ = " databyte 3: IIC-bus has not been connected" If Er4 = 6 Then ErT4$ = " databyte 3: Some undefined error occurred" If Er5 = 0 Then ErT5$ = " stopcond.: No errors" 'full text of stop condition error If Er5 = 1 Then ErT5$ = " stopcond.: IIC-bus is not free" If Er5 = 2 Then ErT5$ = " stopcond.: No acknowledge (ACK) received" If Er5 = 3 Then ErT5$ = " stopcond.: Could not generate a stop-condition" If Er5 = 4 Then ErT5$ = " stopcond.: IIC-bus has no power supply" If Er5 = 5 Then ErT5$ = " stopcond.: IIC-bus has not been connected" If Er5 = 6 Then ErT5$ = " stopcond.: Some undefined error occurred" Statustext.Text = " Transmitted values = " + Str$(A1) + Str$(A2) + Str$(A3) 'print values of the 3 databytes to the status-textbox Errortext.Text = ErrorCap$ + ZS$ + ErT1$ + ZS$ + ErT2$ + ZS$ + ErT3$ + ZS$ + ErT4$ + ZS$ + ErT5$ 'print errornumbers and errortext to the error-textbox End Sub Sub ServoScroll2_Change () DacAdress = 1 'the same for the 2. DAC in the TDA8444 'look at ServoScroll1 DacValue = ServoScroll2.Value A1 = 64 + (ChipAdress * 2) A2 = 240 + DacAdress A3 = DacValue ErrorMsg = StartCon(Lpt) Er1 = ErrorMsg ErrorMsg = Transmit(Lpt, A1) Er2 = ErrorMsg ErrorMsg = Transmit(Lpt, A2) Er3 = ErrorMsg ErrorMsg = Transmit(Lpt, A3) Er4 = ErrorMsg ErrorMsg = StopCon(Lpt) Er5 = ErrorMsg ErrorCap$ = " DAC 2: Errors = " + Str$(Er1) + Str$(Er2) + Str$(Er3) + Str$(Er4) + Str$(Er5) + " = " ZS$ = Chr$(13) + Chr$(10) If Er1 = 0 Then ErT1$ = " startcond .: No errors" If Er1 = 1 Then ErT1$ = " startcond .: IIC-bus is not free" If Er1 = 2 Then ErT1$ = " startcond .: No acknowledge (ACK) received" If Er1 = 3 Then ErT1$ = " startcond .: Could not generate a stop-condition" If Er1 = 4 Then ErT1$ = " startcond .: IIC-bus has no power supply" If Er1 = 5 Then ErT1$ = " startcond .: IIC-bus has not been connected" If Er1 = 6 Then ErT1$ = " startcond .: Some undefined error occurred" If Er2 = 0 Then ErT2$ = " databyte 1: No errors" If Er2 = 1 Then ErT2$ = " databyte 1: IIC-bus is not free" If Er2 = 2 Then ErT2$ = " databyte 1: No acknowledge (ACK) received" If Er2 = 3 Then ErT2$ = " databyte 1: Could not generate a stop-condition" If Er2 = 4 Then ErT2$ = " databyte 1: IIC-bus has no power supply" If Er2 = 5 Then ErT2$ = " databyte 1: IIC-bus has not been connected" If Er2 = 6 Then ErT2$ = " databyte 1: Some undefined error occurred" If Er3 = 0 Then ErT3$ = " databyte 2: No errors" If Er3 = 1 Then ErT3$ = " databyte 2: IIC-bus is not free" If Er3 = 2 Then ErT3$ = " databyte 2: No acknowledge (ACK) received" If Er3 = 3 Then ErT3$ = " databyte 2: Could not generate a stop-condition" If Er3 = 4 Then ErT3$ = " databyte 2: IIC-bus has no power supply" If Er3 = 5 Then ErT3$ = " databyte 2: IIC-bus has not been connected" If Er3 = 6 Then ErT3$ = " databyte 2: Some undefined error occurred" If Er4 = 0 Then ErT4$ = " databyte 3: No errors" If Er4 = 1 Then ErT4$ = " databyte 3: IIC-bus is not free" If Er4 = 2 Then ErT4$ = " databyte 3: No acknowledge (ACK) received" If Er4 = 3 Then ErT4$ = " databyte 3: Could not generate a stop-condition" If Er4 = 4 Then ErT4$ = " databyte 3: IIC-bus has no power supply" If Er4 = 5 Then ErT4$ = " databyte 3: IIC-bus has not been connected" If Er4 = 6 Then ErT4$ = " databyte 3: Some undefined error occurred" If Er5 = 0 Then ErT5$ = " stopcond.: No errors" If Er5 = 1 Then ErT5$ = " stopcond.: IIC-bus is not free" If Er5 = 2 Then ErT5$ = " stopcond.: No acknowledge (ACK) received" If Er5 = 3 Then ErT5$ = " stopcond.: Could not generate a stop-condition" If Er5 = 4 Then ErT5$ = " stopcond.: IIC-bus has no power supply" If Er5 = 5 Then ErT5$ = " stopcond.: IIC-bus has not been connected" If Er5 = 6 Then ErT5$ = " stopcond.: Some undefined error occurred" Statustext.Text = " Transmitted values = " + Str$(A1) + Str$(A2) + Str$(A3) Errortext.Text = ErrorCap$ + ZS$ + ErT1$ + ZS$ + ErT2$ + ZS$ + ErT3$ + ZS$ + ErT4$ + ZS$ + ErT5$ End Sub Sub ServoScroll3_Change () DacAdress = 2 'the same for the 3. DAC in the TDA8444 'look at ServoScroll1 DacValue = ServoScroll3.Value A1 = 64 + (ChipAdress * 2) A2 = 240 + DacAdress A3 = DacValue ErrorMsg = StartCon(Lpt) Er1 = ErrorMsg ErrorMsg = Transmit(Lpt, A1) Er2 = ErrorMsg ErrorMsg = Transmit(Lpt, A2) Er3 = ErrorMsg ErrorMsg = Transmit(Lpt, A3) Er4 = ErrorMsg ErrorMsg = StopCon(Lpt) Er5 = ErrorMsg ErrorCap$ = " DAC 3: Errors = " + Str$(Er1) + Str$(Er2) + Str$(Er3) + Str$(Er4) + Str$(Er5) + " = " ZS$ = Chr$(13) + Chr$(10) If Er1 = 0 Then ErT1$ = " startcond .: No errors" If Er1 = 1 Then ErT1$ = " startcond .: IIC-bus is not free" If Er1 = 2 Then ErT1$ = " startcond .: No acknowledge (ACK) received" If Er1 = 3 Then ErT1$ = " startcond .: Could not generate a stop-condition" If Er1 = 4 Then ErT1$ = " startcond .: IIC-bus has no power supply" If Er1 = 5 Then ErT1$ = " startcond .: IIC-bus has not been connected" If Er1 = 6 Then ErT1$ = " startcond .: Some undefined error occurred" If Er2 = 0 Then ErT2$ = " databyte 1: No errors" If Er2 = 1 Then ErT2$ = " databyte 1: IIC-bus is not free" If Er2 = 2 Then ErT2$ = " databyte 1: No acknowledge (ACK) received" If Er2 = 3 Then ErT2$ = " databyte 1: Could not generate a stop-condition" If Er2 = 4 Then ErT2$ = " databyte 1: IIC-bus has no power supply" If Er2 = 5 Then ErT2$ = " databyte 1: IIC-bus has not been connected" If Er2 = 6 Then ErT2$ = " databyte 1: Some undefined error occurred" If Er3 = 0 Then ErT3$ = " databyte 2: No errors" If Er3 = 1 Then ErT3$ = " databyte 2: IIC-bus is not free" If Er3 = 2 Then ErT3$ = " databyte 2: No acknowledge (ACK) received" If Er3 = 3 Then ErT3$ = " databyte 2: Could not generate a stop-condition" If Er3 = 4 Then ErT3$ = " databyte 2: IIC-bus has no power supply" If Er3 = 5 Then ErT3$ = " databyte 2: IIC-bus has not been connected" If Er3 = 6 Then ErT3$ = " databyte 2: Some undefined error occurred" If Er4 = 0 Then ErT4$ = " databyte 3: No errors" If Er4 = 1 Then ErT4$ = " databyte 3: IIC-bus is not free" If Er4 = 2 Then ErT4$ = " databyte 3: No acknowledge (ACK) received" If Er4 = 3 Then ErT4$ = " databyte 3: Could not generate a stop-condition" If Er4 = 4 Then ErT4$ = " databyte 3: IIC-bus has no power supply" If Er4 = 5 Then ErT4$ = " databyte 3: IIC-bus has not been connected" If Er4 = 6 Then ErT4$ = " databyte 3: Some undefined error occurred" If Er5 = 0 Then ErT5$ = " stopcond.: No errors" If Er5 = 1 Then ErT5$ = " stopcond.: IIC-bus is not free" If Er5 = 2 Then ErT5$ = " stopcond.: No acknowledge (ACK) received" If Er5 = 3 Then ErT5$ = " stopcond.: Could not generate a stop-condition" If Er5 = 4 Then ErT5$ = " stopcond.: IIC-bus has no power supply" If Er5 = 5 Then ErT5$ = " stopcond.: IIC-bus has not been connected" If Er5 = 6 Then ErT5$ = " stopcond.: Some undefined error occurred" Statustext.Text = " Transmitted values = " + Str$(A1) + Str$(A2) + Str$(A3) Errortext.Text = ErrorCap$ + ZS$ + ErT1$ + ZS$ + ErT2$ + ZS$ + ErT3$ + ZS$ + ErT4$ + ZS$ + ErT5$ End Sub Sub ServoScroll4_Change () DacAdress = 3 'the same for the 4. DAC in the TDA8444 'look at ServoScroll1 DacValue = ServoScroll4.Value A1 = 64 + (ChipAdress * 2) A2 = 240 + DacAdress A3 = DacValue ErrorMsg = StartCon(Lpt) Er1 = ErrorMsg ErrorMsg = Transmit(Lpt, A1) Er2 = ErrorMsg ErrorMsg = Transmit(Lpt, A2) Er3 = ErrorMsg ErrorMsg = Transmit(Lpt, A3) Er4 = ErrorMsg ErrorMsg = StopCon(Lpt) Er5 = ErrorMsg ErrorCap$ = " DAC 4: Errors = " + Str$(Er1) + Str$(Er2) + Str$(Er3) + Str$(Er4) + Str$(Er5) + " = " ZS$ = Chr$(13) + Chr$(10) If Er1 = 0 Then ErT1$ = " startcond .: No errors" If Er1 = 1 Then ErT1$ = " startcond .: IIC-bus is not free" If Er1 = 2 Then ErT1$ = " startcond .: No acknowledge (ACK) received" If Er1 = 3 Then ErT1$ = " startcond .: Could not generate a stop-condition" If Er1 = 4 Then ErT1$ = " startcond .: IIC-bus has no power supply" If Er1 = 5 Then ErT1$ = " startcond .: IIC-bus has not been connected" If Er1 = 6 Then ErT1$ = " startcond .: Some undefined error occurred" If Er2 = 0 Then ErT2$ = " databyte 1: No errors" If Er2 = 1 Then ErT2$ = " databyte 1: IIC-bus is not free" If Er2 = 2 Then ErT2$ = " databyte 1: No acknowledge (ACK) received" If Er2 = 3 Then ErT2$ = " databyte 1: Could not generate a stop-condition" If Er2 = 4 Then ErT2$ = " databyte 1: IIC-bus has no power supply" If Er2 = 5 Then ErT2$ = " databyte 1: IIC-bus has not been connected" If Er2 = 6 Then ErT2$ = " databyte 1: Some undefined error occurred" If Er3 = 0 Then ErT3$ = " databyte 2: No errors" If Er3 = 1 Then ErT3$ = " databyte 2: IIC-bus is not free" If Er3 = 2 Then ErT3$ = " databyte 2: No acknowledge (ACK) received" If Er3 = 3 Then ErT3$ = " databyte 2: Could not generate a stop-condition" If Er3 = 4 Then ErT3$ = " databyte 2: IIC-bus has no power supply" If Er3 = 5 Then ErT3$ = " databyte 2: IIC-bus has not been connected" If Er3 = 6 Then ErT3$ = " databyte 2: Some undefined error occurred" If Er4 = 0 Then ErT4$ = " databyte 3: No errors" If Er4 = 1 Then ErT4$ = " databyte 3: IIC-bus is not free" If Er4 = 2 Then ErT4$ = " databyte 3: No acknowledge (ACK) received" If Er4 = 3 Then ErT4$ = " databyte 3: Could not generate a stop-condition" If Er4 = 4 Then ErT4$ = " databyte 3: IIC-bus has no power supply" If Er4 = 5 Then ErT4$ = " databyte 3: IIC-bus has not been connected" If Er4 = 6 Then ErT4$ = " databyte 3: Some undefined error occurred" If Er5 = 0 Then ErT5$ = " stopcond.: No errors" If Er5 = 1 Then ErT5$ = " stopcond.: IIC-bus is not free" If Er5 = 2 Then ErT5$ = " stopcond.: No acknowledge (ACK) received" If Er5 = 3 Then ErT5$ = " stopcond.: Could not generate a stop-condition" If Er5 = 4 Then ErT5$ = " stopcond.: IIC-bus has no power supply" If Er5 = 5 Then ErT5$ = " stopcond.: IIC-bus has not been connected" If Er5 = 6 Then ErT5$ = " stopcond.: Some undefined error occurred" Statustext.Text = " Transmitted values = " + Str$(A1) + Str$(A2) + Str$(A3) Errortext.Text = ErrorCap$ + ZS$ + ErT1$ + ZS$ + ErT2$ + ZS$ + ErT3$ + ZS$ + ErT4$ + ZS$ + ErT5$ End Sub Sub ServoScroll5_Change () DacAdress = 4 'the same for the 5. DAC in the TDA8444 'look at ServoScroll1 DacValue = ServoScroll5.Value A1 = 64 + (ChipAdress * 2) A2 = 240 + DacAdress A3 = DacValue ErrorMsg = StartCon(Lpt) Er1 = ErrorMsg ErrorMsg = Transmit(Lpt, A1) Er2 = ErrorMsg ErrorMsg = Transmit(Lpt, A2) Er3 = ErrorMsg ErrorMsg = Transmit(Lpt, A3) Er4 = ErrorMsg ErrorMsg = StopCon(Lpt) Er5 = ErrorMsg ErrorCap$ = " DAC 5: Errors = " + Str$(Er1) + Str$(Er2) + Str$(Er3) + Str$(Er4) + Str$(Er5) + " = " ZS$ = Chr$(13) + Chr$(10) If Er1 = 0 Then ErT1$ = " startcond .: No errors" If Er1 = 1 Then ErT1$ = " startcond .: IIC-bus is not free" If Er1 = 2 Then ErT1$ = " startcond .: No acknowledge (ACK) received" If Er1 = 3 Then ErT1$ = " startcond .: Could not generate a stop-condition" If Er1 = 4 Then ErT1$ = " startcond .: IIC-bus has no power supply" If Er1 = 5 Then ErT1$ = " startcond .: IIC-bus has not been connected" If Er1 = 6 Then ErT1$ = " startcond .: Some undefined error occurred" If Er2 = 0 Then ErT2$ = " databyte 1: No errors" If Er2 = 1 Then ErT2$ = " databyte 1: IIC-bus is not free" If Er2 = 2 Then ErT2$ = " databyte 1: No acknowledge (ACK) received" If Er2 = 3 Then ErT2$ = " databyte 1: Could not generate a stop-condition" If Er2 = 4 Then ErT2$ = " databyte 1: IIC-bus has no power supply" If Er2 = 5 Then ErT2$ = " databyte 1: IIC-bus has not been connected" If Er2 = 6 Then ErT2$ = " databyte 1: Some undefined error occurred" If Er3 = 0 Then ErT3$ = " databyte 2: No errors" If Er3 = 1 Then ErT3$ = " databyte 2: IIC-bus is not free" If Er3 = 2 Then ErT3$ = " databyte 2: No acknowledge (ACK) received" If Er3 = 3 Then ErT3$ = " databyte 2: Could not generate a stop-condition" If Er3 = 4 Then ErT3$ = " databyte 2: IIC-bus has no power supply" If Er3 = 5 Then ErT3$ = " databyte 2: IIC-bus has not been connected" If Er3 = 6 Then ErT3$ = " databyte 2: Some undefined error occurred" If Er4 = 0 Then ErT4$ = " databyte 3: No errors" If Er4 = 1 Then ErT4$ = " databyte 3: IIC-bus is not free" If Er4 = 2 Then ErT4$ = " databyte 3: No acknowledge (ACK) received" If Er4 = 3 Then ErT4$ = " databyte 3: Could not generate a stop-condition" If Er4 = 4 Then ErT4$ = " databyte 3: IIC-bus has no power supply" If Er4 = 5 Then ErT4$ = " databyte 3: IIC-bus has not been connected" If Er4 = 6 Then ErT4$ = " databyte 3: Some undefined error occurred" If Er5 = 0 Then ErT5$ = " stopcond.: No errors" If Er5 = 1 Then ErT5$ = " stopcond.: IIC-bus is not free" If Er5 = 2 Then ErT5$ = " stopcond.: No acknowledge (ACK) received" If Er5 = 3 Then ErT5$ = " stopcond.: Could not generate a stop-condition" If Er5 = 4 Then ErT5$ = " stopcond.: IIC-bus has no power supply" If Er5 = 5 Then ErT5$ = " stopcond.: IIC-bus has not been connected" If Er5 = 6 Then ErT5$ = " stopcond.: Some undefined error occurred" Statustext.Text = " Transmitted values = " + Str$(A1) + Str$(A2) + Str$(A3) Errortext.Text = ErrorCap$ + ZS$ + ErT1$ + ZS$ + ErT2$ + ZS$ + ErT3$ + ZS$ + ErT4$ + ZS$ + ErT5$ End Sub Sub ServoScroll6_Change () DacAdress = 5 'the same for the 6. DAC in the TDA8444 'look at ServoScroll DacValue = ServoScroll6.Value A1 = 64 + (ChipAdress * 2) A2 = 240 + DacAdress A3 = DacValue ErrorMsg = StartCon(Lpt) Er1 = ErrorMsg ErrorMsg = Transmit(Lpt, A1) Er2 = ErrorMsg ErrorMsg = Transmit(Lpt, A2) Er3 = ErrorMsg ErrorMsg = Transmit(Lpt, A3) Er4 = ErrorMsg ErrorMsg = StopCon(Lpt) Er5 = ErrorMsg ErrorCap$ = " DAC 6: Errors = " + Str$(Er1) + Str$(Er2) + Str$(Er3) + Str$(Er4) + Str$(Er5) + " = " ZS$ = Chr$(13) + Chr$(10) If Er1 = 0 Then ErT1$ = " startcond .: No errors" If Er1 = 1 Then ErT1$ = " startcond .: IIC-bus is not free" If Er1 = 2 Then ErT1$ = " startcond .: No acknowledge (ACK) received" If Er1 = 3 Then ErT1$ = " startcond .: Could not generate a stop-condition" If Er1 = 4 Then ErT1$ = " startcond .: IIC-bus has no power supply" If Er1 = 5 Then ErT1$ = " startcond .: IIC-bus has not been connected" If Er1 = 6 Then ErT1$ = " startcond .: Some undefined error occurred" If Er2 = 0 Then ErT2$ = " databyte 1: No errors" If Er2 = 1 Then ErT2$ = " databyte 1: IIC-bus is not free" If Er2 = 2 Then ErT2$ = " databyte 1: No acknowledge (ACK) received" If Er2 = 3 Then ErT2$ = " databyte 1: Could not generate a stop-condition" If Er2 = 4 Then ErT2$ = " databyte 1: IIC-bus has no power supply" If Er2 = 5 Then ErT2$ = " databyte 1: IIC-bus has not been connected" If Er2 = 6 Then ErT2$ = " databyte 1: Some undefined error occurred" If Er3 = 0 Then ErT3$ = " databyte 2: No errors" If Er3 = 1 Then ErT3$ = " databyte 2: IIC-bus is not free" If Er3 = 2 Then ErT3$ = " databyte 2: No acknowledge (ACK) received" If Er3 = 3 Then ErT3$ = " databyte 2: Could not generate a stop-condition" If Er3 = 4 Then ErT3$ = " databyte 2: IIC-bus has no power supply" If Er3 = 5 Then ErT3$ = " databyte 2: IIC-bus has not been connected" If Er3 = 6 Then ErT3$ = " databyte 2: Some undefined error occurred" If Er4 = 0 Then ErT4$ = " databyte 3: No errors" If Er4 = 1 Then ErT4$ = " databyte 3: IIC-bus is not free" If Er4 = 2 Then ErT4$ = " databyte 3: No acknowledge (ACK) received" If Er4 = 3 Then ErT4$ = " databyte 3: Could not generate a stop-condition" If Er4 = 4 Then ErT4$ = " databyte 3: IIC-bus has no power supply" If Er4 = 5 Then ErT4$ = " databyte 3: IIC-bus has not been connected" If Er4 = 6 Then ErT4$ = " databyte 3: Some undefined error occurred" If Er5 = 0 Then ErT5$ = " stopcond.: No errors" If Er5 = 1 Then ErT5$ = " stopcond.: IIC-bus is not free" If Er5 = 2 Then ErT5$ = " stopcond.: No acknowledge (ACK) received" If Er5 = 3 Then ErT5$ = " stopcond.: Could not generate a stop-condition" If Er5 = 4 Then ErT5$ = " stopcond.: IIC-bus has no power supply" If Er5 = 5 Then ErT5$ = " stopcond.: IIC-bus has not been connected" If Er5 = 6 Then ErT5$ = " stopcond.: Some undefined error occurred" Statustext.Text = " Transmitted values = " + Str$(A1) + Str$(A2) + Str$(A3) Errortext.Text = ErrorCap$ + ZS$ + ErT1$ + ZS$ + ErT2$ + ZS$ + ErT3$ + ZS$ + ErT4$ + ZS$ + ErT5$ End Sub Sub ServoScroll7_Change () DacAdress = 6 'the same for the 7. DAC in the TDA8444 'look at ServoScroll1 DacValue = ServoScroll7.Value A1 = 64 + (ChipAdress * 2) A2 = 240 + DacAdress A3 = DacValue ErrorMsg = StartCon(Lpt) Er1 = ErrorMsg ErrorMsg = Transmit(Lpt, A1) Er2 = ErrorMsg ErrorMsg = Transmit(Lpt, A2) Er3 = ErrorMsg ErrorMsg = Transmit(Lpt, A3) Er4 = ErrorMsg ErrorMsg = StopCon(Lpt) Er5 = ErrorMsg ErrorCap$ = " DAC 7: Errors = " + Str$(Er1) + Str$(Er2) + Str$(Er3) + Str$(Er4) + Str$(Er5) + " = " ZS$ = Chr$(13) + Chr$(10) If Er1 = 0 Then ErT1$ = " startcond .: No errors" If Er1 = 1 Then ErT1$ = " startcond .: IIC-bus is not free" If Er1 = 2 Then ErT1$ = " startcond .: No acknowledge (ACK) received" If Er1 = 3 Then ErT1$ = " startcond .: Could not generate a stop-condition" If Er1 = 4 Then ErT1$ = " startcond .: IIC-bus has no power supply" If Er1 = 5 Then ErT1$ = " startcond .: IIC-bus has not been connected" If Er1 = 6 Then ErT1$ = " startcond .: Some undefined error occurred" If Er2 = 0 Then ErT2$ = " databyte 1: No errors" If Er2 = 1 Then ErT2$ = " databyte 1: IIC-bus is not free" If Er2 = 2 Then ErT2$ = " databyte 1: No acknowledge (ACK) received" If Er2 = 3 Then ErT2$ = " databyte 1: Could not generate a stop-condition" If Er2 = 4 Then ErT2$ = " databyte 1: IIC-bus has no power supply" If Er2 = 5 Then ErT2$ = " databyte 1: IIC-bus has not been connected" If Er2 = 6 Then ErT2$ = " databyte 1: Some undefined error occurred" If Er3 = 0 Then ErT3$ = " databyte 2: No errors" If Er3 = 1 Then ErT3$ = " databyte 2: IIC-bus is not free" If Er3 = 2 Then ErT3$ = " databyte 2: No acknowledge (ACK) received" If Er3 = 3 Then ErT3$ = " databyte 2: Could not generate a stop-condition" If Er3 = 4 Then ErT3$ = " databyte 2: IIC-bus has no power supply" If Er3 = 5 Then ErT3$ = " databyte 2: IIC-bus has not been connected" If Er3 = 6 Then ErT3$ = " databyte 2: Some undefined error occurred" If Er4 = 0 Then ErT4$ = " databyte 3: No errors" If Er4 = 1 Then ErT4$ = " databyte 3: IIC-bus is not free" If Er4 = 2 Then ErT4$ = " databyte 3: No acknowledge (ACK) received" If Er4 = 3 Then ErT4$ = " databyte 3: Could not generate a stop-condition" If Er4 = 4 Then ErT4$ = " databyte 3: IIC-bus has no power supply" If Er4 = 5 Then ErT4$ = " databyte 3: IIC-bus has not been connected" If Er4 = 6 Then ErT4$ = " databyte 3: Some undefined error occurred" If Er5 = 0 Then ErT5$ = " stopcond.: No errors" If Er5 = 1 Then ErT5$ = " stopcond.: IIC-bus is not free" If Er5 = 2 Then ErT5$ = " stopcond.: No acknowledge (ACK) received" If Er5 = 3 Then ErT5$ = " stopcond.: Could not generate a stop-condition" If Er5 = 4 Then ErT5$ = " stopcond.: IIC-bus has no power supply" If Er5 = 5 Then ErT5$ = " stopcond.: IIC-bus has not been connected" If Er5 = 6 Then ErT5$ = " stopcond.: Some undefined error occurred" Statustext.Text = " Transmitted values = " + Str$(A1) + Str$(A2) + Str$(A3) Errortext.Text = ErrorCap$ + ZS$ + ErT1$ + ZS$ + ErT2$ + ZS$ + ErT3$ + ZS$ + ErT4$ + ZS$ + ErT5$ End Sub Sub ServoScroll8_Change () DacAdress = 7 'the same for the 8. DAC in the TDA8444 'look at ServoScroll1 DacValue = ServoScroll8.Value A1 = 64 + (ChipAdress * 2) A2 = 240 + DacAdress A3 = DacValue ErrorMsg = StartCon(Lpt) Er1 = ErrorMsg ErrorMsg = Transmit(Lpt, A1) Er2 = ErrorMsg ErrorMsg = Transmit(Lpt, A2) Er3 = ErrorMsg ErrorMsg = Transmit(Lpt, A3) Er4 = ErrorMsg ErrorMsg = StopCon(Lpt) Er5 = ErrorMsg ErrorCap$ = " DAC 8: Errors = " + Str$(Er1) + Str$(Er2) + Str$(Er3) + Str$(Er4) + Str$(Er5) + " = " ZS$ = Chr$(13) + Chr$(10) If Er1 = 0 Then ErT1$ = " startcond .: No errors" If Er1 = 1 Then ErT1$ = " startcond .: IIC-bus is not free" If Er1 = 2 Then ErT1$ = " startcond .: No acknowledge (ACK) received" If Er1 = 3 Then ErT1$ = " startcond .: Could not generate a stop-condition" If Er1 = 4 Then ErT1$ = " startcond .: IIC-bus has no power supply" If Er1 = 5 Then ErT1$ = " startcond .: IIC-bus has not been connected" If Er1 = 6 Then ErT1$ = " startcond .: Some undefined error occurred" If Er2 = 0 Then ErT2$ = " databyte 1: No errors" If Er2 = 1 Then ErT2$ = " databyte 1: IIC-bus is not free" If Er2 = 2 Then ErT2$ = " databyte 1: No acknowledge (ACK) received" If Er2 = 3 Then ErT2$ = " databyte 1: Could not generate a stop-condition" If Er2 = 4 Then ErT2$ = " databyte 1: IIC-bus has no power supply" If Er2 = 5 Then ErT2$ = " databyte 1: IIC-bus has not been connected" If Er2 = 6 Then ErT2$ = " databyte 1: Some undefined error occurred" If Er3 = 0 Then ErT3$ = " databyte 2: No errors" If Er3 = 1 Then ErT3$ = " databyte 2: IIC-bus is not free" If Er3 = 2 Then ErT3$ = " databyte 2: No acknowledge (ACK) received" If Er3 = 3 Then ErT3$ = " databyte 2: Could not generate a stop-condition" If Er3 = 4 Then ErT3$ = " databyte 2: IIC-bus has no power supply" If Er3 = 5 Then ErT3$ = " databyte 2: IIC-bus has not been connected" If Er3 = 6 Then ErT3$ = " databyte 2: Some undefined error occurred" If Er4 = 0 Then ErT4$ = " databyte 3: No errors" If Er4 = 1 Then ErT4$ = " databyte 3: IIC-bus is not free" If Er4 = 2 Then ErT4$ = " databyte 3: No acknowledge (ACK) received" If Er4 = 3 Then ErT4$ = " databyte 3: Could not generate a stop-condition" If Er4 = 4 Then ErT4$ = " databyte 3: IIC-bus has no power supply" If Er4 = 5 Then ErT4$ = " databyte 3: IIC-bus has not been connected" If Er4 = 6 Then ErT4$ = " databyte 3: Some undefined error occurred" If Er5 = 0 Then ErT5$ = " stopcond.: No errors" If Er5 = 1 Then ErT5$ = " stopcond.: IIC-bus is not free" If Er5 = 2 Then ErT5$ = " stopcond.: No acknowledge (ACK) received" If Er5 = 3 Then ErT5$ = " stopcond.: Could not generate a stop-condition" If Er5 = 4 Then ErT5$ = " stopcond.: IIC-bus has no power supply" If Er5 = 5 Then ErT5$ = " stopcond.: IIC-bus has not been connected" If Er5 = 6 Then ErT5$ = " stopcond.: Some undefined error occurred" Statustext.Text = " Transmitted values = " + Str$(A1) + Str$(A2) + Str$(A3) Errortext.Text = ErrorCap$ + ZS$ + ErT1$ + ZS$ + ErT2$ + ZS$ + ErT3$ + ZS$ + ErT4$ + ZS$ + ErT5$ End Sub