Searching \ for 'Some questions !!' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=questions
Search entire site for: 'Some questions !!'.

Truncated match.
PICList Thread
'Some questions !!'
1998\12\08@124523 by Goovaerts

flavicon
face
Hello, here are a few things I need to know :

1. I want to use bits 3 and 4 of PORTC for SCL and SDA when working with
   the I2C bus. I'm single master of this bus. My question is how to
initialise
   this I2C-bus ?? I wrote some code. Does this code make any sense and
  didn't I forget something ?

   The declaration of the variables looks like this :

#DEFINE SCL             PORTC,3         ;SCL PIN
#DEFINE SDA             PORTC,4         ;SDA PIN

INIT_I2C

     BCF           STATUS , RP0
     CLRF         PORTC
     BSF           STATUS , RP0
     MOVLW    B'11100111'
     MOVWF   TRISC

     RELEASEBUS                         ; Don't know what this is and what
it does ?
                                                         ; Think it's a
macro. Think it makes SDA and
                                                         ; SCL high.
     CLRF        BUS_STATUS       ; Signalisation FLAG !!
     RETURN

Is it so that you have to make SDA and SCL high to release the bus ??

--------------------------------------

2. The following code that I found is a delay for 4.7 us :

Delay47uSec
      movlw ((_47uS_Delay-8)/3 + 1)
DlyK
       movwf DelayCount
       decfsz DelayCount
       goto $-1
       return

How does it work ?
What is _47uS_Delay ? It's probably defined somewhere else !!

goto $-1 --> a loop ??

--------------------------------------

3. Slaves are allowed : Clock stretching ??

But when you have fast slaves, you don't have to implement this
in your software. How do I know I have to implement it or not ?
The I2C bus I'm working with is one inside a SONY TV. They
told me that the I2C it uses, is not the fast on (400k ??)

---------------------------------------

4. I have a program where each operand is preceded by  an underscore _
   Why's that ?


So that will do it for now !!

All comments or advice are very welcome !!

Greetings,

Glenn Goovaerts

1998\12\08@165649 by Marc

flavicon
face
> 3. Slaves are allowed : Clock stretching ??
>
> But when you have fast slaves, you don't have to implement this
> in your software. How do I know I have to implement it or not ?
> The I2C bus I'm working with is one inside a SONY TV. They
> told me that the I2C it uses, is not the fast on (400k ??)

You better stick to the standard if you're accessing a bus with unknown
devices on it.

> 4. I have a program where each operand is preceded by  an underscore _
>     Why's that ?

Usually those are linked with a C program.

1998\12\08@184441 by Stig Brautaset

flavicon
face
Hello Govaerts...

> All comments or advice are very welcome !!
>

Please use informative subjectlines, such as 'how to initialize i2c bus' or
something like that. More people will read your request, because a lot of
people just deletes the messages that does not clearly say what is the
problem in the subject line. BTW, naging about replys for your postings
works about the same way as pressing the elevator button 50 times in a very
fast sequence.

Now, to your problem, I can't help you. ( But I will at last! :-))


{Quote hidden}

1998\12\08@194258 by Goovaerts

flavicon
face
You better stick to the standard if you're accessing a bus with unknown
devices on it.

So what's the standard ??

Do you have the answers to the other questions ??

CIAO

1998\12\09@094745 by Ivan Cenov

flavicon
face
-----Original Message-----
From: Goovaerts <spam_OUTgoofy1TakeThisOuTspamGLO.BE>
To: .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU <PICLISTspamKILLspamMITVMA.MIT.EDU>
Date: 08 €ŒŒ“‰Ý 1998 ‹., ‰˜”Ý’ 19:42
Subject: Some questions !!


{Quote hidden}

   yes, this is a macro and SCL and SDA have to be high to release bus
by making SCL and SDA pins inputs (TRISCx=1)

{Quote hidden}

   _47uS_Delay is constant defined somewhere with #define

>--------------------------------------
>
>3. Slaves are allowed : Clock stretching ??
>
>But when you have fast slaves, you don't have to implement this
>in your software. How do I know I have to implement it or not ?
>The I2C bus I'm working with is one inside a SONY TV. They
>told me that the I2C it uses, is not the fast on (400k ??)

If you implement it and have fast slaves - don't worry,
but if you do not implement it and have fast slaves - you may have a
problems

ivan cenov

1998\12\09@102236 by keithh

flavicon
face
Goovaerts,

read the I2C spec, and understand what needs to be done before
attempting to implement it.

If you do that, you'll be able to work out how
other people's I2C code works.

>       RELEASEBUS

its not an instruction, it is a macro to release the bus.

The I2C spec requires 4.7 us between signal events.
This is so short you can make do with
       goto    $+1     ; 2us nop!
       goto    $+1     ; 2us nop!
on a 4MHz PIC.

> Clock stretching

Is in the spec. Thus obligatory.
It's not hard to do, so why deliberately make your code non-spec.
Do it properly, and you'll never worry about whether
doing it wrong is causing your bug.

I already posted you some working commented code snippets.
If that didn't get you working, what will?

1998\12\09@131854 by Marc

flavicon
face
> You better stick to the standard if you're accessing a bus with unknown
> devices on it.
>
> So what's the standard ??

The inventors of I2C, Phillips, have a pdf document about I2C on their web page.

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...