Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I2C questions

Status
Not open for further replies.

imlost

New Member
Is any one familiar with the I2C? Specifically the SAA1064 IC.

I bought a device that will count then display on LED using the IC chip. I found out that i have to program this IC chip using a micro-controller.

They gave some sample code in visual basic but I'm using a PIC32. The PIC32 uses C code and i haven't figured out how to do anything because I don't know where to start.

Any suggestions?

The device in question is here:
https://www.electro-tech-online.com/custompdfs/2011/02/I2C-7SEG-Manual.pdf

and the IC is here:
https://www.electro-tech-online.com/custompdfs/2011/02/SAA1064.pdf
 
**broken link removed**

That should get you started. On serial EEPROMs you have to get the microcontroller to write and read on the I2C bus, while for and LED you only have to get it to write.

There is an I2C module on some of the PIC24F series, so I guess there is one on the PIC32 series.

BTW, the PIC32 is programmed in assembled code. The C code that you write gets compiled by a PC, and so the C code itself does not get to the PIC.
 
I'd breakdown the sample code into specific operations: start, stop, write data, write command, read status etc. Then break each op into its' sequence of steps. Now see how to do the same ops/sequences on yours.

I2C can be handled directly by controlling the 2 lines. In assembler, it's a lot of bit-set & bit-clear according to the protocols' timing diagram, using shifts of a register to sequence the byte to bit conversions. I had to write one on a Freescale 908 that didn't have a module for it. A tedious process, but satisfying once working. Good Hunting... <<<)))

Also, high level code (C, VisualBasic etc) is complied, resulting in assembler code. Assembler code is assembled, resulting in machine code. Machine code is a binary number string, and absolutely unreadable by people. Assembler is the lowest level readable and machine code must be disassembled to get there. Otherwise you need the source code in assembler. Small distinctions, but can be important in debugging.
 
Last edited:
I understand the start/stop part. The part i keep getting caught up on is, do i need to specify a string of bits in order to display the number on the LED?

for instance.. (really rough pseudo code)

digit1 = 0b0000
digit2 = 0b0001
digit3 = 0b0010
digit4 = 0b0011

write(digit1, digit2, digit3, digit4)

then just write some loop to increment each digit to how fast i want it to increment?
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top