News:

Let's find out together what makes a PIC Tick!

Main Menu

PIC 18F47Q10 Read Eeprom!

Started by bjkrs, Mar 22, 2022, 02:57 PM

Previous topic - Next topic

bjkrs

hi,

my device is = PIC 18F47Q10

I select

I2C SCL pin = portb.7
I2C SDA pin = portb.6

but I can't read Eeprom, does anyone read eeprom with PIC 18F47Q10? What I miss? Thanks.. 

RGV250

#1
Hi,
I cannot help but I don't think you will get a lot of replies if you don't post any code you have tried.
Have you looked at I2Cin in the manual?

Bob 

Dompie

SCL and SDA are the I2C bus connections of the PIC and have nothing to do with the internal EEPROM of that PIC.
For EEPROM see the manual pages 375 onwards.

Johan

bjkrs

Quote from: RGV250 on Mar 22, 2022, 03:57 PMHi,
I cannot help but I don't think you will get a lot of replies if you don't post any code you have tried.
Have you looked at I2Cin in the manual?

Bob 
i will checkt it, thanks

bjkrs

Quote from: Dompie on Mar 22, 2022, 04:18 PMSCL and SDA are the I2C bus connections of the PIC and have nothing to do with the internal EEPROM of that PIC.
For EEPROM see the manual pages 375 onwards.

Johan
hi Johan, thanks for answer, i am asking about external eeprom, not internal eeprom

Yasin

#5
Have you used pullups resistors? Did you check that DAC1CON0.4=0, ASELB7=0 and ANSELB6=0?

top204

See the Bus sections of the compiler's manual. It has example code and a circuit diagram of a typical I2C EEPROM.

Certain EEPROM's require an 8-bit address, while others require a 16-bit address, and some of teh newert types require a 24-bit address, or a more obscure address based upon the combination of the slave address as well as the cell address. However, standard I2C EEPROMs work with the same principle of... Send Slave Address with read or write bit set or clear. Send the address to read from or write too, then read the value, or write the value.


bjkrs

Quote from: Yasin on Mar 22, 2022, 06:22 PMHave you used pullups resistors? Did you check that DAC1CON0.4=0, ASELB7=0 and ANSELB6=0?
hi, actually my code works with PIC 18F46K22 but when I select PIC 18F47Q10 I cant read data from my 24LC1025 external eeprom.

bjkrs

Quote from: top204 on Mar 22, 2022, 09:18 PMSee the Bus sections of the compiler's manual. It has example code and a circuit diagram of a typical I2C EEPROM.

Certain EEPROM's require an 8-bit address, while others require a 16-bit address, and some of teh newert types require a 24-bit address, or a more obscure address based upon the combination of the slave address as well as the cell address. However, standard I2C EEPROMs work with the same principle of... Send Slave Address with read or write bit set or clear. Send the address to read from or write too, then read the value, or write the value.



my code works with PIC 18F46K22, When I use PIC 18F47Q10, I cant read data from my 24LC1025 external eeprom.

RGV250

Hi,
Post a small working code example with only the eeprom routine and configs etc as nobody can help if you don't.
It is most likely to be a config setting, have you added the suggestions Yasin made in post 5.

Bob

JonW

 I have had some issues with I/O on early Q devices before and ended up scrapping the parts and getting the latest devices, check the errata or the pps to ensure the I/O is not blocked by another peripheral. 

Here is a bit bashed routine for a 24LC512 you can use that sorts out the paging etc

https://protoncompiler.com/index.php/topic,823.0.html

bjkrs

Quote from: RGV250 on Mar 23, 2022, 09:17 AMHi,
Post a small working code example with only the eeprom routine and configs etc as nobody can help if you don't.
It is most likely to be a config setting, have you added the suggestions Yasin made in post 5.

Bob

Hi, thanks for aswer, this is my example code;

Device = 18F47Q10 '(this code works with PIC 18F4685 and PIC 18F46K22)
 Declare Xtal = 10
 ANSELA = %00001101                  ' RA0, RA1, RA3 analog, other PORTA digital
 ANSELB = %00000000                  ' PORTB digital
 ANSELC = %00000000                  ' PORTC digital
 ANSELD = %00000000                  ' PORTD digital
 ANSELE = %000                       ' PORTE digital
 Declare LCD_Type = Toshiba          ' Use a Toshiba 240x128 graphic LCD
 Declare LCD_DTPort = PORTD          ' LCD's Data port
 Declare LCD_CDPin  = PORTA.4         
 Declare LCD_WRPin  = PORTE.1
 Declare LCD_RDPin  = PORTE.2             
 Declare LCD_X_Res = 240             ' LCD's X Resolution
 Declare LCD_Y_Res = 128             ' LCD's Y Resolution
 Declare LCD_Font_Width = 8
 Declare LCD_RAM_Size = 32768        ' Amount of RAM the LCD contains
 Declare LCD_Text_Home_Address = 0
 All_Digital = True
 Symbol SCL = PORTB.7                'scl line
 Symbol SDA = PORTB.6                'sda line     
 DelayMS 100
 '-----------------------------------------------------------------------------
    Dim yab As Byte 
    Dim page As Byte
    Dim ssb As Byte
    Dim lcd_Data[32] As Byte
    Dim lcd_Adres As  Word
    page = 0                   'MY logo in 24lc512
    goto main

main:
    lcd_Adres = page * 4096
    For yab = 0 To 127
    I2CIn SDA,SCL,$A1,lcd_Adres + 32 * yab,[str lcd_Data\32] '(I think "I2Cın" command not working with PIC 18F47Q10)
    For ssb = 0 To 31                                 
    LCDWrite yab,ssb,[lcd_Data[ssb]]
    Next ssb
    Next yab
    delayms 100
    goto main

    end

bjkrs

Quote from: JONW on Mar 23, 2022, 11:27 AMI have had some issues with I/O on early Q devices before and ended up scrapping the parts and getting the latest devices, check the errata or the pps to ensure the I/O is not blocked by another peripheral. 

Here is a bit bashed routine for a 24LC512 you can use that sorts out the paging etc

https://protoncompiler.com/index.php/topic,823.0.html


Hi jonw, thanks for answer. I tried your examples but it is not working with PIC 18F47Q10.

JonW

#13
You must have some IO conflict as the code 100 percent works, have you tried toggling the I/O pins individually on the pins to check for a I/O conflict and ensure you have pullups on?. 

Also page is a protected word, what version of the compiler are you using?

Jon

bjkrs

Quote from: JONW on Mar 23, 2022, 06:36 PMYou must have some IO conflict as the code 100 percent works, have you tried toggling the I/O pins individually on the pins to check for a I/O conflict and ensure you have pullups on?. 

Also page is a protected word, what version of the compiler are you using?

Jon
yes I tried the change I/O pins, I am using pullups on. I am using Proton Basic Compiler 3.7.5.5

Yasin

There is a mistake I made before. Maybe this is your problem. The XINST Extended Instruction Set Enable bit compiler does not support this. Check the configuration. There is no configuration in your code. You are probably using a bootloader. You checked this detail.

tumbleweed

If you don't specify any config settings for the 18F47Q10 you get these defaults:
    config FEXTOSC = HS
    config WDTE = off
    config RSTOSC = EXTOSC
    config CLKOUTEN = off
    config CSWEN = off
    config FCMEN = off
    config MCLRE = EXTMCLR
    config PWRTE = off
    config LPBOREN = off
    config BOREN = off
    config ZCD = off
    config PPS1WAY = off
    config STVREN = off
    config XINST = off
    config WDTCCS = SC
    config WRT0 = off
    config WRT1 = off
    config WRT2 = off
    config WRT3 = off
    config WRTC = off
    config WRTB = off
    config WRTD = off
    config SCANE = off
    config LVP = off
    config CP = off
    config CPD = off
    config EBTR0 = off
    config EBTR1 = off
    config EBTR2 = off
    config EBTR3 = off
    config EBTRB = off

bjkrs

Quote from: Yasin on Mar 23, 2022, 07:23 PMThere is a mistake I made before. Maybe this is your problem. The XINST Extended Instruction Set Enable bit compiler does not support this. Check the configuration. There is no configuration in your code. You are probably using a bootloader. You checked this detail.

I forget add my config setting to forum but I have config settings in my original code. if you work with PIC 18F47Q10 before, can you share your config settings. maybe my config settings are wrong.

bjkrs

Quote from: tumbleweed on Mar 24, 2022, 12:11 AMIf you don't specify any config settings for the 18F47Q10 you get these defaults:
    config FEXTOSC = HS
    config WDTE = off
    config RSTOSC = EXTOSC
    config CLKOUTEN = off
    config CSWEN = off
    config FCMEN = off
    config MCLRE = EXTMCLR
    config PWRTE = off
    config LPBOREN = off
    config BOREN = off
    config ZCD = off
    config PPS1WAY = off
    config STVREN = off
    config XINST = off
    config WDTCCS = SC
    config WRT0 = off
    config WRT1 = off
    config WRT2 = off
    config WRT3 = off
    config WRTC = off
    config WRTB = off
    config WRTD = off
    config SCANE = off
    config LVP = off
    config CP = off
    config CPD = off
    config EBTR0 = off
    config EBTR1 = off
    config EBTR2 = off
    config EBTR3 = off
    config EBTRB = off

hi, thanks for answer, I tried this configs, they not working too