Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

Discussion Groups | BasicX | I2C and PCF8574 - ShiftOut

Discussion forum for the BasicX family of microcontroller chips.

I2C and PCF8574 - ShiftOut - andrewflys - Sep 21 0:48:00 2002

Hi all,

I had seen some earlier emails saying that folks had successfully
migrated Pete A's i2c routines to use shiftout instead of putpin in
a loop. I substituted it for the existing code and had little
luck...

eg:

Public Sub I2C_WorksFine (ByVal O_byte As Byte)

DIM N as Byte For N = 1 TO 8 Step 1
If (O_byte >= 128) then ' most sig bit is a one
Call I2C_high_sda()
' Call PutB(1) ' used for debugging
Else
Call I2C_low_sda() ' set SDA and then clock
' Call PutB(0) ' used for debugging
End If

Call I2C_high_scl()
Call I2C_low_scl()

O_byte = O_byte * 2 ' shift left

Next
' Call NewLine() ' used for debugging
End Sub

Sub I2C_ShouldWorkButDoesnt (byval I2cData As Byte)
'debug.print CStr(I2cData)
Call ShiftOut(SDA_PIN, SCL_PIN, 8, I2cData) ' shift data
out
Call PutPin(SDA_PIN, bxInputTristate) ' turn SDA around
Call PutPin(SCL_PIN, bxOutputHigh) ' and clock in the
ack' bit
Call PutPin(SCL_PIN, bxOutputLow)
End Sub
Anyone had any luck using shiftout with the Phillips PCF5874 I/O
expander?

Thanks,

Andrew




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )