Searching \ for 'problems when running code in RUNMODE with ICEPIC' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'problems when running code in RUNMODE with ICEPIC'.

Truncated match.
PICList Thread
'problems when running code in RUNMODE with ICEPIC'
1997\03\12@092734 by Mario Lopes

flavicon
face
Hello

I've made some on I2C and everithing works rigth when i test it in
animate mode. The problem is that when I try to run in RUN mode nothing
works except START and Stop bit detection.
Could you give some information ?

Thanks
   Mario Lopes -INESC (Portugal)

1997\03\14@071518 by Alan Nickerson

flavicon
face
Mario Lopes wrote:

  Hello

 I've made some on I2C and everithing works rigth when i test it in
 animate mode. The problem is that when I try to run in RUN mode
 nothing
 works except START and Stop bit detection.
 Could you give some information ?

 Thanks
     Mario Lopes -INESC (Portugal)

The I2C device your using may require a delay that the animate routine
is providing.
I am using an I2C LCD controller with an ICEPIC in runmode without any
problems.
I did not write the original I2C code, but there is a delay routine to
allow the PIC to
see the devices ACK.
Below is a code fragment of what I use with my PIC16C57 @ 4Mhz.
This work for me, you may have to make some changes

 I2CDelay    macro
         clrwdt
         nop
         nop
         nop
         nop
         endm

 ; I2C start condition
 I2CStart
         movlw   .4
         tris    Port_B
         bsf     Port_B,B_DDAT    ; data high
         I2CDelay
         bsf     Port_B,B_DCLK    ; clk hi
         I2CDelay
         bcf     Port_B,B_DDAT
         I2CDelay
         bcf     Port_B,B_DCLK    ; clk lo
         retlw   0

 ; I2C stop condition
 I2CStop
         movlw   .4
         tris    Port_B
         bcf     Port_B,B_DDAT    ; data low
         I2CDelay
         bsf     Port_B,B_DCLK    ; clock hi
         I2CDelay
         bsf     Port_B,B_DDAT    ; data hi
         retlw   0

 ; Send Bit codes to I2C bus
 ; Bit Code is in W
 I2CWrite
         movwf   SReg
         movlw   8
         movwf   Count1
 I2CWait
         clrwdt
         btfsc   SReg,7
         movlw   0x40            ; if set, tristate
         btfss   SReg,7
         movlw   0x00            ; Data Bit to Output
         bcf     Port_B,B_DDAT
         tris    Port_B
         I2CDelay
         bsf     Port_B,B_DCLK
         I2CDelay
         bcf     Port_B,B_DCLK
         rlf     SReg,1        ; Rotate TXBUF left
         decfsz  Count1,1         ; 8 bits done?
         goto    I2CWait          ; No.

         movlw   0x40
         tris    Port_B          ; Data Pin to Input
         I2CDelay
         bsf     Port_B,B_DCLK    ; ACK Clock pulse
         I2CDelay
         btfss   Port_B,B_DDAT    ; check for ack pulse
         goto    I2CAckOk

 I2CAckOk
         bcf     Port_B,B_DCLK    ; clock ->0
         retlw   0

--
Alan Nickerson
---------
It seems to me that the best new ideas come from
people who don't know that they "can't".  -- Paul Mathews,
spam_OUToptoengTakeThisOuTspamWHIDBEY.COM

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