Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

I2C PCF8574T

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Unsupported versions
View previous topic :: View next topic  
Author Message
Dead_Banzay

Bascom Member



Joined: 26 Dec 2016
Posts: 1

russia.gif
PostPosted: Mon Dec 26, 2016 5:28 pm    Post subject: I2C PCF8574T Reply with quote

Help please, run the LCD 16 * 2.
I can not understand what I'm doing wrong ((

_________________
Beard does not make you a philosopher
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1534
Location: Basel, Switzerland

switzerland.gif
PostPosted: Mon Dec 26, 2016 6:32 pm    Post subject: Reply with quote

Hi,

Try an i2cdelay of 10, thats 100KHz bus Speed.
Your missing i2cinit in you code.

Regards
Ian Dobson

_________________
Home of AVRTimer, the Bascom timer value calculator.
http://www.planet-ian.com

Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Dec 26, 2016 11:01 pm    Post subject: Check address Reply with quote

PCF8474 has I2c address &h40
Try the i2c scanner for the correct address

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1534
Location: Basel, Switzerland

switzerland.gif
PostPosted: Tue Dec 27, 2016 8:31 am    Post subject: Reply with quote

Hi,

See if your i2c bus is actually working, with a i2c scanner. Something like this:


Code:

    Dim Adress_loop As Byte                                
    Print  "i2c  ";
    For Adress_loop = 2 To 254 Step 2                        'Scan every even address
       I2cstart                                              'setup i2c bus
       I2cwbyte Adress_loop                                  'get result
       If Err = 0 Then                                       'err=hw problem
          Print Adress_loop ; "," ;                     'no error so device
       End If                                                'exits
       I2cstop                                               'stop bus
    Next Adress_loop                                         'loop through each sensor
    Print  ""
 


Bascom uses 8 bit addresses so Ben is correct, you should try &H40.

Regards
Ian Dobson

_________________
Home of AVRTimer, the Bascom timer value calculator.
http://www.planet-ian.com

Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile Visit poster's website
DJ7DA

Bascom Member



Joined: 03 May 2006
Posts: 83
Location: Bavaria

germany.gif
PostPosted: Sat Apr 14, 2018 8:02 pm    Post subject: Port assignement ?? Reply with quote

... a little late, but still valid:

PORTC.5 = SCL
PORTC.4 = SDA

(not the other way around)
Regards

DJ7DA
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Unsupported versions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum