INFO - FAQ - CC2-Forum - CCPro-Forum |
Hello, hard to say what's wrong with THIS program, (I do not have the book [1]), but you can get addittional help and tips, when you check the documentation of M-Unit 2.0, even if you don't have it. It provides a port module (Conrad# 198848) where you can see in the documentation if you use the 8574 properly (pins etc.) Also there are demo programs available for the use of this module, so you could use this demos and replace the print# / i2c start / i2c stop - statements inside by subroutines (gosub) that do the same. So you see if your 8574 Hardware is responding properly. Carsten > Please, who can help me to program a PCF8574. What is wrong in the program given below. I like to turn a stepper connnected to P4-P7 (of the PCF8574) when a switch) connected to P3 is depressed. P0/P3 are connected with a pull-up to 5V . By pressing the switch P3 will be connected with a pull-up to 5 V > > define .......etc > > SDA=on > SCL=on > zaehler=&B00001000 > > #loop > 'reading ON/OFF of P3 > gosub start > datenW=65 > gosub I2C_write > gosub I2C_read > gosub Noack > gosub Stop > if datenR=&B00001111 then gosub motor else goto loop > goto loop > > #motor > zaehler =zaehler shl 1 > gosub start > datenW=64 > gosub I2C_write > datenW=Zaehler > gosub I2C_write > gosub stop > if zaehler=&B10000000 then zaehler=&B00001000 > return > > #start > please refer to [1] > > #stop > please refer to [1] > > #I2C_write > please refer to [1] > read instead of daten : datenW > > #I2C_read > please refer to [1] > read instead of daten: datenR > > #Ack > please refer to [1] > > #Noack > please refer to [1] > > [1] Messen, Steueren, Regeln mit dem C-Control/BASIC System von Kainka (page 163 u.w.) > > thank you very much |
Antwort schreiben |