20x2 tech questions rev 0

marks

Senior Member
when using the READTEMP on C port
it turns off pins on B port
just wondering why ?
not too bad can turn back on again using LET DIRSB= %11111111


when using HI2CSETUP I2CMASTER
sda scl pins remain in a high or low state when not used
can not control these pins using let pinsb =
HI2CSETUP OFF does not seem to restore control
having to do a RESET
is there a way to restore control without doing a RESET


when using READ WRITE commands
how many operations can be performed
before you can no longer write

Thanks in advance !!!
 

Dippy

Moderator
I can't help with the first two Qus , but re: EEPROM endurance Microchip state a 'Min' E/W of 100K. This refers to Write/Erase to a particular EEPROM 'cell' e.g. if you kept Writing to location 20 (just an example).
Remember though, with a bit of cunning coding you can spread it around and make the thing last longer.
No 'typical' value is given, so safest to base your Write calculations on 100K.
It's all statistical; some may last 100K, other may last 200K or whatever. NO guarantees.

K series PICs are typically 1/10th of non-K types.
I wish a little cautionary 'note' about endurance was included in the Manual.

For this type of info and all nitty-gritty electrical info go to Mirochip's website and download the PIC Data Sheet. It's only 380 pages long so nice easy reading ;)
 

Technical

Technical Support
Staff member
The readtemp issue is a known bug that is fixed in the latest revision (C.1).
If you use pins C.3, C.4, or C.5 the issue will not arise on your older firmware, so try to use your readtemp on one of these 3 pins in portC instead.

It is not normal to 'turn off' i2c when not in use, this could cause issues on your i2c bus. Why do you want to do this?
 

marks

Senior Member
Hi tech,
thanks for the reply
but all pins are affected except c6 which cant be used to readtemp
more info
c0 turns off b0
c1 turns off b0
c2 turns off b1
c3 turns off b4
c4 turns off b3
c5 turns off b2
c6 cant be used
c7 turns off b3
no big deal tho just turn back on after you do a read
hope this is fixed in the new revision too !

with the hi2c pins was only using them to do a read every minute
while using them to drive a 7 segment display also.
to achieve this had to write to memory reset then read
which worked but would probaly eventually wear out
just seems a waste to just dedicate those pins to i2c only
and its conveniant to control the whole port b
 

hippy

Ex-Staff (retired)
I'm not sure why you're having problems with turning off I2C and needing to do a reset to re-use the pins.

The following program works on version C.0 and C.1 and shows control over the SDA (B.5) and SCL (B.7) lines is retained after the I2C is turned off. The LED's ( R to 0V ) flash for about two seconds, then are off whilst SDA and SCL are under I2C control ( open-collector, bi-directional ), and come back to flashing as soon as accessed with TOGGLE. No actual I2C device attached nor pull-ups, just a PICAXE and two LED's, no trickery involved ...

Code:
#Picaxe 20X2
#No_Table
#Terminal 9600

SerTxd( "RESET" )
Do
  For b0 = 1 To 20
    Toggle B.5
    Toggle B.7
    Pause 100
  Next
  HI2cSetup I2CMASTER, $A0, I2CSLOW, I2CBYTE
  Pause 2000
  HI2cSetup OFF
Loop
As Technical says it's not common to turn the signals off or re-use the I2C Bus for other things and can be difficult to do and get right. The I2C device may see a signal it responds to on the bus when it shouldn't, pull the bus lines low and may jam-up or even damage the PICAXE. The recommended practice is not to re-use the bus lines.

Whilst turning I2C off ceases use of those lines for I2C it could be the way your program attempts to restore control over those lines, something missing or incomplete. The above test code works without any RESET required.
 
Last edited:

marks

Senior Member
Hi Hippy!!
I always value your input hope i'm not waisting every1 time lol
i tried your program toggle command works ok
but when i try using pinsb command b5 b7 pins stay high
but thanks to you it did solve my problem
if i use the command let dirsb = %11111111 after HI2cSetup OFF it works YIPPI !!

Code:
main:
let dirsb = %11111111
let dirsc = %00111111
Do
pinsc=%0000111
  For b0 = 1 To 20
     pinsb=255                  'Toggle B.5
    pause 200
     pinsb=0                    'Toggle B.7
    Pause 200
  Next
  HI2cSetup I2CMASTER, %11010000, I2CSLOW, I2CBYTE
  hi2cin 0,(b31,b32,b33)
  Pause 4000
  HI2cSetup OFF
                        ' let dirsb = %11111111   
Loop
p.s. always been impressed wth this 20x2 chip its indestructable !
 
Top