As the PIC18F97J60 has two serial ports, two i2c/sp ports and the ethernet port, I would like to use all those capabilities in a very small board where there is:
1 - SD/MMC SLOT (on the first i2c/sp port)
1 - Ethernet port
1 - i2c eeprom + RTC (on the second i2c/sp port)
1 - rs232 port (usart2)
1 - USB port (via RS232 converter like ft232-usart1)
Now, by usart lib I can simply access the two rs232, but I'm not able to address/use the second i2c channel (via mikrobasic)...
Is there anyone can help me?
Kind regards
SN
P.S.: when ended i hope to share the project...
how to use the second i2c port in PIC18F97J60 FAM
No code at this time
In this period I'm working to hw setup.
May be I'm not full documented on I2C libraries. I thought that as for usart library, where for example there are commands as this:
usart_write_text2.... to write on usart2
or
usart_write_text1.... to write on usart1
there where commands as I2C_Start2 to send a start sequence to the second I2C port, and so on....
The I2C library in mikrobasic, works only with I2C on C port!!!
does anyone know how I have to solve this problem?
May be I'm not full documented on I2C libraries. I thought that as for usart library, where for example there are commands as this:
usart_write_text2.... to write on usart2
or
usart_write_text1.... to write on usart1
there where commands as I2C_Start2 to send a start sequence to the second I2C port, and so on....
The I2C library in mikrobasic, works only with I2C on C port!!!
does anyone know how I have to solve this problem?
Taken from the Mikrobasic help file:
Note: Certain PICmicros with two I²C modules, such as P18F8722, require you to specify the module you want to use. Simply append the number 1 or 2 to a I2C. For example, I2C2_Wr Also, for the sake of backward compabitility with previous compiler versions and easier code management, MCU's with multiple I2C modules have I²C library which is identical to I2C1 (i.e. you can use I2C_Init instead of I2C1_Init for I²C operations).
Note: Certain PICmicros with two I²C modules, such as P18F8722, require you to specify the module you want to use. Simply append the number 1 or 2 to a I2C. For example, I2C2_Wr Also, for the sake of backward compabitility with previous compiler versions and easier code management, MCU's with multiple I2C modules have I²C library which is identical to I2C1 (i.e. you can use I2C_Init instead of I2C1_Init for I²C operations).
HELP USING MMC/SD
Hi, as I posted in my previous posts, I'm going to use for the first time MMC/SD with a 18F97J60.
I connected MMC to the PORTC (c3-c4-c5) SPI Signals, and connected CS on PORTD.2 both with a 4.7kohm pull up resistor on all signals and either with or without resistor on SDO, but MMC is not detected.
Here is the simple code I used.
May be I'm doing something wrong in connections or may be I need to set up PIC ...
I connected MMC to the PORTC (c3-c4-c5) SPI Signals, and connected CS on PORTD.2 both with a 4.7kohm pull up resistor on all signals and either with or without resistor on SDO, but MMC is not detected.
Here is the simple code I used.
Code: Select all
program MMC_SD_Detect
main:
usart_init1(19200)
USART_WRITE_TEXT1("INIT ")
while true
spi1_Init_Advanced(MASTER_OSC_DIV16, DATA_SAMPLE_MIDDLE, CLK_IDLE_LOW, LOW_2_HIGH)
if Mmc_Init(PORTD, 2) = 0 then
USART_WRITE_TEXT1(" Detected")
else
USART_WRITE_TEXT1("Not Detected")
end if
Delay_ms(1000)
wend
end.