Hello,
I am having problems in Swordfish using I2C.BAS
My first question is what is the difference between I2C.bas and SI2C.bas (given in the Help menu) ?
Next. I am using I2C.bas and am getting nowhere. I have now gone as far as writing your example code out line for line de la parrot fashion. It always hangs indefinitely on the line "value = I2C.Readbyte". I don't know what's going wrong.
I have written numerous other projects in PBP3 and have no problem at all with multiple I2C devices in the same project.
Have you any suggestions please ?
I2C or not I2C
Moderators: David Barker, Jerry Messina
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
Re: I2C or not I2C
> I2C.bas and SI2C.bas
I2C.bas is hardware I2C, SI2C.bas is software based. Have you got pullups on the SDA and SCL lines?
I2C.bas is hardware I2C, SI2C.bas is software based. Have you got pullups on the SDA and SCL lines?
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: I2C or not I2C
Sometimes the libs take a bit of tweaking for the proper device/pin setup... it might be easier to post the code you have and we can take it from there instead of playing twenty questions. That way we'll know the device, setup, etc.
-
- Posts: 20
- Joined: Wed Jan 22, 2014 9:48 pm
Re: I2C or not I2C
Yes I have pullups on SDA and SCL.
Thanks for sparing the time to look at the code.
I will post it tonight.
Thanks for sparing the time to look at the code.
I will post it tonight.
-
- Posts: 20
- Joined: Wed Jan 22, 2014 9:48 pm
Re: I2C or not I2C
By the way, I found something interesting on your Wiki last night that might (?) help
I will give one more go beefore sending the code.
I will give one more go beefore sending the code.
-
- Posts: 20
- Joined: Wed Jan 22, 2014 9:48 pm
Re: I2C or not I2C
Hello,
First a mega sorry for implying there was anything wrong with Swordfish. That is not the case. I just made a big boob and would like to share the following information for others to see.
I was migrating from PBP to Swordfish, and at the same time from a PIC16F to a PIC18F MCU.
A message to all PICAHOLICS is don’t rush in. Read the datasheet a thousand times first. Despite the fact that quite a few MCU’s map PORTS across pin-to-pin, they don’t always map PORT functions across.
I was migrating from a PIC16F1937 to a PIC18F4550 and although RC3 and RC4 map across, Microchip have moved SCL and SDA to RB0 and RB1 on the PIC18F4550. It was that that threw me.
AND if you are using the PICDEM2 platform remember to use jumpers J23 and J23 otherwise you will be cutting and soldering pcb tracks unnecessarily. (In the PICDEM2 Users Guide, the schematic says RB1 and RB4 but in the datasheet for the PIC18F4550 it says RB0 and RB1. There may be an errata somewhere).
First a mega sorry for implying there was anything wrong with Swordfish. That is not the case. I just made a big boob and would like to share the following information for others to see.
I was migrating from PBP to Swordfish, and at the same time from a PIC16F to a PIC18F MCU.
A message to all PICAHOLICS is don’t rush in. Read the datasheet a thousand times first. Despite the fact that quite a few MCU’s map PORTS across pin-to-pin, they don’t always map PORT functions across.
I was migrating from a PIC16F1937 to a PIC18F4550 and although RC3 and RC4 map across, Microchip have moved SCL and SDA to RB0 and RB1 on the PIC18F4550. It was that that threw me.
AND if you are using the PICDEM2 platform remember to use jumpers J23 and J23 otherwise you will be cutting and soldering pcb tracks unnecessarily. (In the PICDEM2 Users Guide, the schematic says RB1 and RB4 but in the datasheet for the PIC18F4550 it says RB0 and RB1. There may be an errata somewhere).