I2C  programming ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello ,

I need help to understand I2C programming for psoc 4. I don't have enough knowledge about I2C communication. I looked some project sample But Its not clear for me

   

how to write basic sample code for  I2C communication. ?

   

1.start I2C

   

2.               Writes data over I2C

   

3.stop I2C

   

4. start I2C

   

5.               Reads data from I2C

0 Likes
36 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You will need a second device that will function as I2C slave. Have you got one? So first you will have to decide who is I2C-master and who is I2C-slave.

   

Only the master can read and write to/from the slave. There are master/slave examples which you should understand first.

   

Electrically, the two I2C-lines clock and data need pullup resistors for the interface to function properly.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Although this video is for PSOC 1 the basic principles the same -

   

 

   

    

   

          https://www.youtube.com/watch?v=CCwiJcVDl8c

   

 

   

Also search youtube for I2C, there are other videos there as well.

   

 

   

In Creator there are examples, on Creator start page link "Find Example projects"

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hello

   

actully I want to display  data to LCD via i2c communication. 

   

I need to develope algorithms.  what I have to Do ?

   

1.  start  I2C

   

2.  LCD_Start()   

   

2.   send data to LCD

   

3. LCD_DisplayOn()

   

4. LCD _PrintString()

   

5. LCD_Stop()

   

6.  Stop I2c 

   

I am trying to make program on psoc creator 3.0.  In my next post I will try to write compelete program

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

No need to stop the I2C, let it run as long as there is power applied.

   

Give us a link to the LCD datasheet with I2C interface that you want to connect to your PSoC board.

   

Which board are you using? Give us Cypress part no. or link.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

The basic protocol is a start/stop -

   

 

   

Protocol

   

Communication via I2C is more complex than with a UART or SPI solution. The signalling must adhere to a certain protocol for the devices on the bus to recognize it as valid I2C communications. Fortunately, most devices take care of all the fiddly details for you, allowing you to concentrate on the data you wish to exchange.

   

Basics

   

Standard 7-bit address transfer message.

   

Messages are broken up into two types of frame: an address frame, where the master indicates the slave to which the message is being sent, and one or more data frames, which are 8-bit data messages passed from master to slave or vice versa. Data is placed on the SDA line after SCL goes low, and is sampled after the SCL line goes high. The time between clock edge and data read/write is defined by the devices on the bus and will vary from chip to chip.

   

Start Condition

   

To initiate the address frame, the master device leaves SCL high and pulls SDA low. This puts all slave devices on notice that a transmission is about to start. If two master devices wish to take ownership of the bus at one time, whichever device pulls SDA low first wins the race and gains control of the bus. It is possible to issue repeated starts, initiating a new communication sequence without relinquishing control of the bus to other masters; we’ll talk about that later.

   

Address Frame

   

The address frame is always first in any new communication sequence. For a 7-bit address, the address is clocked out most significant bit (MSB) first, followed by a R/W bit indicating whether this is a read (1) or write (0) operation.

   

The 9th bit of the frame is the NACK/ACK bit. This is the case for all frames (data or address). Once the first 8 bits of the frame are sent, the receiving device is given control over SDA. If the receiving device does not pull the SDA line low before the 9th clock pulse, it can be inferred that the receiving device either did not receive the data or did not know how to parse the message. In that case, the exchange halts, and it’s up to the master of the system to decide how to proceed.

   

Data Frames

   

After the address frame has been sent, data can begin being transmitted. The master will simply continue generating clock pulses at a regular interval, and the data will be placed on SDA by either the master or the slave, depending on whether the R/W bit indicated a read or write operation. The number of data frames is arbitrary, and most slave devices will auto-increment the internal register, meaning that subsequent reads or writes will come from the next register in line.

   

Stop condition

   

Once all the data frames have been sent, the master will generate a stop condition. Stop conditions are defined by a 0->1 (low to high) transition on SDA after a 0->1 transition on SCL, with SCL remaining high. During normal data writing operation, the value on SDA should not change when SCL is high, to avoid false stop conditions.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

If your LCD is 44780 compatible controller just use Character LCD. It connects

   

via 4 pins for data, 3 pins for control.

   

 

   

If the LCD has a I2C interface, then select Character LCD with I2C interface and

   

place an I2C master component.

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello

   

I am using Jhd 16 2A LCD. I am attaching project without Program

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Your selected LCD Jhd 16 2A uses an 8-bit wide databus and some control-signals. There is no component to directly connect the LCD to your PSoC, so you will have to program everything yourself which is not an easy job.

   

What is your I2C interface for? Do you want to build an LCD-module with an I2C interface? What will be the Master??

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Your Jhd 16 2A has a 44780 compatible controller in it, so

   

use Character LCD for the module. It does not have an I2C

   

interface. It takes 4 bits + 3 control lines to connect to PSOC.

   

In its component datasheet are the instructions (APIs) to

   

control it.

   

 

   

The above componnet uses one contiguous port to connect. If you

   

need to spread across multiple ports the connections see Kees

   

component. www.cypress.com/

   

 

   

Regards, Dana.

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Vead:  I sent you a working program that writes to a character LCD a few days ago.  LCD_Arduino.bundel01. this program is working and does not need an I2C interface.  Why have you not used this program and converted it to the Cy8CKIT-049-4200 that you have?  When I researched the data sheet for your display I am not sure that it will work with a 44780 type display but you should try it anyway. It it works fine if it fails then get a 44780 compatable display and you will be in business with a working display!!

   

Bobgoar

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello

   

 I Have done Projects based on LCD.  LCD Display is not Problem. I want to use I2C communication. that's why I am trying to interface LCD with I2C 

   

Look at following project sample. I did small change.   I placed I2C component. 

   

1. start I2C

   

2 stop I2C

   

3. send

   

4 receive

   

how to send data on LCD  via I2C communication ?

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Get an example I2C program from the example programs in Psoc 4 M page and then transfer the I2C data from the example to your program.  You can not use the current display on I2C just the data you receive from the I2C device.  here is the address http://www.cypress.com/?rID=108008. or this is a good manual for all Psoc types and how to use I2C http://www.cypress.com/?docID=52704. There is a good example in 100 projects in 100 days http://www.element14.com/community/thread/25071/l/psoc-4-pioneer-kit-community-project035-uart-i2c-a... But you need a RTC chip to make this app work.  If you want to use the I2C to talk to an LCD you need to replace your LCD with another one or use one of these

   

i2c / SPI character LCD backpack you feed in I2C signal on 2 wires  and it provides the drive signals for the LCD.  You can find thes backpacks on the internet at various vendors and the are about $10.00 US.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Any data you write to the display can also be written out

   

over the I2C link. The I2C does not have a clue if it is sending

   

LCD data or swamp monster counts, data is data.

   

 

   

The I2C slave receiving the data has to be addressed by the

   

master and then data is sent to it. Examples of this are used in

   

several of these projects -

   

 

   

     

   

 PSOC 4 element14.com

                                           
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

S No

Date

Project Title

1

01-May-2013

Simple Blinking LED

2

02-May-2013

CapSense Slider Example

3

03-May-2013

PSoC 4 Pioneer Kit Annotation Library

4

06-May-2013

USB-UART utility

5

07-May-2013

USB-I2C Utility

6

08-May-2013

Danger Shield with Light Sensor Control

7

09-May-2013

Danger Shield with 7-segment display

8

10-May-2013

Danger Shield Buzzer of Doom

9

13-May-2013

Graphics LCD Display

10

14-May-2013

LCD - Rotating Cube Demo

11

15-May-2013

GLCD Paddle Game

12

16-May-2013

Pioneer Board Oscilloscope

13

17-May-2013

CapSense Button & LED Control with Bridge Control Panel

14

20-May-2013

What was the value? - LED Memory Example

15

21-May-2013

CapSense Proximity Detection

16

22-May-2013

Proximity Theremin

17

23-May-2013

2-Channel OScope with GraphicsLCD

18

24-May-2013

'Catch the Shells' Game with ColorLCD Shield

19

28-May-2013

LED Memory! Part Deux. Just Deux it!

20

29-May-2013

Starter Designs

21

30-May-2013

Fractional Frequency Synthesizer

22

31-May-2013

“Kill The Ghost” Game

23

03-Jun-2013

tinyprintf Example

24

04-Jun-2013

XBee Router Loopback Example

25

05-Jun-2013

XBee Direct IO

26

06-Jun-2013

XBee API RxTx Example

27

07-Jun-2013

XBee RGB CapSense Control

28

10-Jun-2013

“WiFi? Why Not!” Arduino WiFi Shield Example

29

11-Jun-2013

Bluetooth Home Automation System

30

12-Jun-2013

Bluetooth with GLCD

31

13-Jun-2013

Ethernet Shield

32

14-Jun-2013

More Relay!

33

17-Jun-2013

Sweet Music Everywhere! MIDI Shield

34

18-Jun-2013

Resistive Touch Example

35

19-Jun-2013

UART, I2C, and SPI Joystick Example

36

20-Jun-2013

What? I can use the PSoC 5LP too?

37

21-Jun-2013

PSoC With Friends! Word Scramble Game

38

24-Jun-2013

Ultrasonic Distance Measurement

39

25-Jun-2013

Two PWMs for the price of one

40

26-Jun-2013

Pioneer PnP Sensors

41

27-Jun-2013

Thermistor Example

42

28-Jun-2013

Hangman Game

43

01-Jul-2013

Rise of the Machines (Rolling Robot)

44

02-Jul-2013

Run Away Run Away! (Proximity Robot)

45

03-Jul-2013

Stepper Motor Example

46

05-Jul-2013

“Paint The Night” Accelerometer Example

47

08-Jul-2013

Obstacle Avoider Robot

48

09-Jul-2013

Walk The Line! Robot Example

49

11-Jul-2013

Android Device Controlled Robot

50

12-Jul-2013

SD Card Example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

S No

Date

Project Title

51

15-Jul-2013

Music Player

52

16-Jul-2013

Strike A Pose! Digital Camera

53

17-Jul-2013

PSoC Eye

54

18-Jul-2013

Custom Component 4x4 Keypad

55

19-Jul-2013

Parallel to Serial UDB Component

56

22-Jul-2013

Accelerometer Level

57

23-Jul-2013

Digital Audio From A Single Pin

58

24-Jul-2013

An Introduction to Processing

59

25-Jul-2013

But Wait There’s More! Single PWM with 3 Outputs

60

26-Jul-2013

PSoC 4 Mini-Billboard

61

29-Jul-2013

Nokia 5110 LCD Interface

62

30-Jul-2013

Ready…Set…GO! PSoC Stopwatch

63

31-Jul-2013

Some Like it Hot! PSoC Thermostat

64

01-Aug-2013

Workspace Organization using PSoC Theromostat

65

02-Aug-2013

New to PSoC or the Pioneer Kit? START HERE!

66

05-Aug-2013

LED Blinky Revisited

67

06-Aug-2013

PSoC 4 Getting Started Lab 1 (LED Blinky)

68

07-Aug-2013

PSoC 4 Getting Started Lab 2 (PWM LED)

69

08-Aug-2013

PSoC 4 Getting Started Lab 3 (CapSense UART)

70

09-Aug-2013

PSoC 4 Getting Started Lab 4 (ADC)

71

12-Aug-2013

Get Your Motor Runnin’!

72

13-Aug-2013

TFT Touchscreen Shield

73

14-Aug-2013

TFT Touchscreen Tic-Tac-Toe Game

74

15-Aug-2013

PSoC Creator Training 110

75

16-Aug-2013

PSoC Creator Training 111                                          

76

19-Aug-2013

PSoC Creator Training 112

77

20-Aug-2013

PSoC Creator Training 113

78

21-Aug-2013

PSoC Creator Training 210

79

22-Aug-2013

PSoC Creator Training 211

80

23-Aug-2013

PSoC Creator Training 212/213/214

81

26-Aug-2013

NFC/RFID Shield

82

27-Aug-2013

RFID Reader and Writer Project #2

83

28-Aug-2013

Raspberry Pi Integration

84

29-Aug-2013

State Machines in PSoC 4

85

30-Aug-2013

UART Bootloader in PSoC 4

86

03-Sep-2013

GPS Algorithm

87

04-Sep-2013

Gas Sensor Example

88

05-Sep-2013

Simulation of Gas Sensor Example

89

06-Sep-2013

GPS Example

90

09-Sep-2013

Comparator Example

91

10-Sep-2013

Infrared Remote Control

92

11-Sep-2013

Serial Communications Examples

93

12-Sep-2013

4 Channel Multiplexed Comparator

94

13-Sep-2013

Opamp Dynamic Gain

95

16-Sep-2013

Hibernate and Stop Power Modes

96

17-Sep-2013

P4 Light Sensor Project Design

97

18-Sep-2013

Rice Cooker

98

19-Sep-2013

Thermal Printer

99

20-Sep-2013

I2C Pass Though 'Smart Wire'

100

23-Sep-2013

PSoC 4 Time Square Billboard

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

As long as you mapped the LCD pins to the correct port

   

pin ordering you are OK. Rename the PSOC port pins to

   

correspond to the LCD pin name, makes it easy to keep

   

track of.

   

 

   

   

 

   

Also you have to connect LCD power and ground. And connect contrast pin on LCD to a pot.

   

Nominally set it to Vdd / 2 then adjust for best display appearance.

   

 

   

0 Likes
Anonymous
Not applicable

first I opend psoc creator than I opened sample project for LCD. after that I opend  CharLCD_Custom font  project. I have done this program successfuly. I can see text on LCD 

   

Now I want to use same Project but at this time I want to display text on LCD via i2c. so I added I2C component , I think main problem is program. I did not wrote any function for I2c  I have to make program that send data on LCD

   

I  want to ask where I am making mistake in program or design?

   

 Please look at my project workspace that I posted in my previous post.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You would add an I2C Slave to your project.

   

 

   

There is an example project you can look at that transfers

   

data to a PSOC over I2C - the SCB_I2cCommSlave or SCB_EzI2cCommSlave projects

   

 

   

0 Likes
Anonymous
Not applicable

ok after reading some material. I wrote some code  I am not sure It will work

   

include <device.h>

extern uint8 const CYCODE LCD_customFonts[];

*******************************************************************************/
void main()
{  
 
    
       
    /* Enable global interrupts - required for I2C */
    CyGlobalIntEnable;
   
   /* The I2C will start */
    I2C_1_Start();
 
  LCD_Start();
 
  LCD_Position(0,0);

  
 
  LCD_PrintString("cypress");

  LCD_Position(1,0);
  
  
 
    LCD_PrintString("Read Regs");
 
          
  for(;;)
  {}
}


/* [] END OF FILE */

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

What device are you interfacing to that has an I2C output? 

0 Likes
Anonymous
Not applicable

I am sending data on LCD via i2c. 

   

   

 

   

   

I have connected all pins. 

   

I don't understand where to connect SDLP4[ 0]and SCL P4[1] ?

   

also tell me about program that I have been posted ?

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Vead I do not think you understand what I2C is.  I2c is a communications buss from a master unit to a Slave unit. .  You do not have  a device connected to you I2C buss that is transmitting the data.  Such as a DS1307 serial real-time clock (RTC) or some other device that is outputting data and then it is sent to the PSOC 4 and the PSOC 4 receives the data and then displays it on the LCD.  You need to have the  addresses  for the I2C devices and that has to be in the program.

   

Here are some I2C devices  are you using any of these in your project? You also need the data sheet for your device so you can get the address and other commands and data information.

   

MAXIM

I/O expanders:
MAX6956 20-Port LED Display Driver and digital I/O Expander constant current sink, up to 16 Devices, Interrupt

LED Driver:
MAX6953 4 Digit Matrix LED Driver, up to 140 LEDs

Data Converters:
MAX127/MAX128 octal 12 Bit DAC
MAX521 Octal 8 Bit DAC
MAX 1036/1037 4-channel 8-bit ADC, single supply (5V / 3.3V)
MAX 1038/1039 12-channel 8-bit ADC, single supply (5V / 3.3V)

Microchip

Expanders:
MCP23016 16-bit I/O Port Expander
MCP23017 16-bit I/O Port Expander
MCP23008 8-bit I/O Port Expander

Data converters:
MCP3021 10 bit ADC, one channel
MCP3221 12 bit ADC, one channel
MCP3421 18 bit ADC, one channel
MCP4725 12 bit ADC, one channel
TC1320 8 bit ADC, one channel
TC1321 10 bit ADC, one channel

Serial EEPROMs:
24AA00 128
24C00 128
24LC00 128
24AA01 1K
24LC01B 1K
24C01C 1K
24LC014 1K
24LC21A 1K
24LCS21A 1K
24AA02 2K
24LC02B 2K
24C02C 2K
24LC024 2K
24LC025 2K
24LCS52 2K
24AA04 4K
24LC04B 4K
24AA08 8K
24LC08B 8K
24AA16 16K
24LC16B 16K
24AA32A 32K
24LC32A 32K
24AA64 64K
24LC64 64K
24AA65 64K
24LC65 64K
24AA128 128K
24LC128 128K
24FC128 128K
24AA256 256K
24LC256 256K
24FC256 256K
24AA512 512K
24LC512 512K
24FC512 512K
24AA515 512K
24LC515 512K
24FC515 512K
24AA1025 1024K
24LC1025 1024K
24FC1025 1024K

Niigata Seimitsu

NS73M FM Transmitter (source: sparcfun.com) I2C maybe problematic?

NXP (Philips)

LCD/LED Drivers:
PCA 9533 4-bit LED dimmer (8-bit PWM) suitable for H-Bridges (L293D)
PCA 9531 8-bit LED dimmer (8-bit PWM)
PCA 9532 16-bit LED dimmer (8-bit PWM)
PCF 8566 96 segment LCD driver
PCF 8568 LCD Row driver for dot matrix displays.
PCF 8569 LCD Column driver for DOT matrix displays
PCF 8576 160 segment LCD driver
PCD 8577 64 Segment LCD driver
PCF 8578 LCD Row driver for Dot matrix LCD's
PCD 8579 Column driver for Dot matrix LCD's
SAA 1064 4 Digit Led driver

I/O expanders:
PCF 8574 8 Bit I/O port
PCF 8574A 8 Bit I/O port different address.
SAA 1300 5 Bit high current driver

Data converters:
PCF 8591 4 channel ADC + One DAC (all 8 bits)
TDA 8442 Quad 6 bit DAC
TDA 8444 Octal 6 bit DAC

Memory:
PCF 8570 256 byte static ram
PCf 8571 128 byte static ram
PCF 8581 128 byte EEprom
PCF 8582 256 byte EEprom
PCF 8583 256 byte RAM + Realtime clock and calendar
PCF 8594 512 byte EEprom
PCF 8598 1K byte EEprom

Clocks:
PCF 8573 Clock/Calendar
PCF 8583 Clock/Calendar with 256 byte Ram

Audio / Video:
PCD3311 3312 DTMF / Tone generator
SAA1136 PCM interface
SAA524x Teletext processor
SAA7191 S-VHS decoder
SAA7192 Digital color space converter
SAA7199 Digital encoder
SAA9020 Field memory controller
SAA9051 Digital TV decoder
SAA9068 PIPCO Picture in picture system
SAB3035 3037 Tuning interface
SAF1135 VPS decoder
TDA4680 Video processor
TDA8421 HiFi stereo audio processor
TDA8425 Audio processor with loudspeaker channel
TDA8440 Video switch
TDA8442 Color decoder interface
TDA8443 YUV to RGB unit
TDA8461 PAL / NTSC color decoder
TEA6100 Fm tuning interface
TEA6300 6310 Sound fader control
TSA551x TV Pll synthesizer
TSA6057 Fm Pll synthesizer

Miscellaneous:

SAA1300 5 bit high current driver
UMF1009 Frequency synthesizer

Siemens

Audio Video:
SDA3312 TV PLL synthesizer
SDA2121 TV PLL synthesizer

Memories:
SDA2516 1K bit EEprom
SDA2526 2K bit EEprom
SDA2546 4K bit EEprom
SDA2586 8K bit EEprom
SDA3526 2K bit EEprom with write protection
SDA3546 4K bit EEprom with write protection
SDA3586 8K bit EEprom with write protection


STMicroelectronics

Clocks:
M41T00S RTC w. 64b (8 x 😎
M41T00SC6430 RTC w. Embedded Crystal; 64Kb (8192 x 8); w. EEPROM
M41T11 28 RTC w. BATTERY; 512b (64 x 8);
M41T56 512b RTC w. (64 x 8); SRAM
M41T56C64 RTC w. Embedded Crystal; 64Kb (8192 x 8); w. EEPROM
M41T00 RTC w. 64b (8 x 😎
M41ST84W RTC w. 512b (64 x 8); RTC SUPERVISOR
M41ST85W RTC w. BATTERY; with Embedded Crystal; 512b (64 x 8); RTC SUPERVISOR
M41ST87W RTC w. Embedded Crystal; 1280b (160 x 8); RTC SUPERVISOR
M41ST87Y RTC w. with Embedded Crystal; 1280b (160 x 8); RTC SUPERVISOR
M41T0 RTC w. 64b (8 x 😎
M41T60 RTC w. 64b (8 x 😎
M41T62 RTC w. 128b (16 x 8); with Alarms
M41T65 RTC w. 128b (16 x 8); with Alarms
M41T80 RTC w. 160b (20 x 8); with Alarms
M41T81S RTC w. Embedded Crystal; 160b (20 x 8); with Alarms
M41T82 RTC w. 256b (32 x 8), Battery Switchover
M41T83 RTC w. Embedded Crystal 256b (32 x 8), Battery Switchover
M41T256Y RTC w. BAT Cu wo/socket 256Kb (32K x 😎
M41T81 RTC w. 160b (20 x 😎


Memory:
M24C01-R 1 kbit EEPROM
M24C01-W 1 kbit EEPROM
M24C02-R 2 kbit EEPROM
M24C02-W 2 kbit EEPROM
M24C04-R 4 kbit EEPROM
M24C04-W 4 kbit EEPROM
M24C08-R 8 kbit EEPROM
M24C08-W 8 kbit EEPROM
M24C16-R 16 kbit EEPROM
M24C16-W 16 kbit EEPROM
M24C32-F 32 kbit EEPROM
M24C32-R 32 kbit EEPROM
M24C32-W 32 kbit EEPROM
M24C64-R 64 kbit EEPROM
M24C64-W 64 kbit EEPROM
M34D64-W 64 kbit EEPROM
M24128-BR 128 kbit EEPROM
M24128-BW 128 kbit EEPROM
M24256-BR 256 kbit EEPROM
M24256-BW 256 kbit EEPROM
M24512-R 512 kbit EEPROM
M24512-W 512 kbit EEPROM
M24M01-R 1000 kbit EEPROM

Misc.:
LIS3LV02DL Linear Accelerometer 3-Axis ±2g/ ±6g with digital interface
LIS3LV02DQ Linear Accelerometer 3-Axis ±2g/ ±6g Full Scale with digital interface


Texas Instruments

Audio/Video:
TLV320AIC3101 6 Inputs, 6 Outputs, Speaker & Headphone Amp., Enh. Digital Effects, PowerTune

Buffers:
P82B96 Dual Bidirectional Bus Buffer

Expanders:
PCA6107 Remote 8-Bit Low-Power I/O Expander With Interrupt Output, Reset, and Config Registers
PCA9534 Remote 8-Bit Low-Power I/O Expander with Interrupt Output and Configuration Registers
PCA9534A Remote 8-Bit Low-Power I/O Expander with Interrupt Output and Configuration Registers
PCA9535 Remote 16-Bit Low-Power I/O Expander With Interrupt Output and Config Registers
PCA9536 Remote 4-Bit I/O Expander with Configuration Registers
PCA9538 Remote 8-Bit Low-Power I/O Expander With Interrupt Output, Reset, and Config Registers
PCA9539 Remote 16-Bit Low-Power I/O Expander With Interrupt Output, Reset & Config. Registers
PCA9554A Remote 8-Bit I/O Expander with Interrupt Output and Configuration Registers
PCA9555 Remote 16-Bit I/O Expander With Interrupt Output And Configuration Registers
PCA9557 Remote 8-Bit Low-Power I/O Expander with Reset and Configuration Registers
PCF8574 Remote 8-Bit I/O Expander
PCF8574A Remote 8-Bit I/O Expander
PCF8575 Remote 16-Bit I/O Expander with Interrupt Output
PCF8575C Remote 16-Bit I/O Expander with Interrupt Output
TCA6408 Low-Voltage 8-Bit I/O Expander With Interrupt Output, Reset, and Config Register

Multiplexers:
PCA8550 Non-Volatile 5-Bit Registered Multiplexer with I2C Interface
PCA9544A 4-Channel I2C And SMBus Multiplexer With Interrupt Logic
PCA9545A 4-Channel I2C And SMBus Multiplexer With Interrupt Logic And Reset Functions
PCA9546A 4-Channel I2C And SMBus Multiplexer With Reset Functions

Levelshifters:
PCA9306 Dual Bi-Directional I2C-Bus and SMBus Voltage Level-Translator

Repeaters:
PCA9515A Dual Bidirectional I2C Bus and SMBus Repeater

Hubs/switches:
PCA9518 Expandable Five-Channel I2C Hub
PCA9543A Two-Channel I2C-Bus Switch With Interrupt Logic and Reset
PCA9548A 8-Channel I2C Switch With Reset

LED-Drivers:
TCA6507 Low-Voltage 7-Bit I2C and SMBus LED Driver With Intensity Control and Shutdown


Xicor

Memories:
X24C01 1k bit EEprom
X24012 1k bit EEprom
X24C02 2k bit EEprom
X24022 2k bit EEprom
X24C04 4k bit EEprom
X24042 4k bit EEprom
X24C08 8k bit EEprom
X24C16 16k bit EEprom
X24164 16k bit EEprom
X24X00 128 bit EEprom
X24001 128 bit EEprom

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Vead You do not need the I2C component for the Psoc RTC component as it is all done in software.  The I2c is used for a DS1307 device or RTC board that has an  I2C communication port.  The Psoc RTC does not have a crystal to keep it on time so it looses about 5 minutes a day. The DS1307 has the crystal clocks and is very accurate. So if you are using the PSOC RTC component you do not need the I2C component.

0 Likes
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Vead here is a picture of an example

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

If you need more accuracy in the RTC then use an external xtal derived

   

clock and config the RTC to use Systick as the source of its clock.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Vead,

   

there seem to be some lacks of information or understanding of what you want to perform.

   

Can you send us a picture / drawing (Block Diagram) of all the components you want to use (PSocS, LCDs RTCs) and how you want to wire them. This will probably express more easy to understand what you'd like to do.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

1. Psoc 4 (cy8ckit -049-42xx)

   

   

2. LCD JHD 16 2 A

   

   

3. ds1307

   

   

 4. crystal

   

   

*LCD is used to display date , time month year

   

* DS1307 is used to set alarm for second , minute  day month

   

Psoc 4 will receive data form ds1307 and send data to LCD 

   

after that I created design

   

   

 

   

I don't understand why bobgoar said I don't need to use I2c ? I am just turning around and around  so please tell me What I need to do ?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Well, that is more a BoM (Bill of material) than a block diagram.

   

But what I can see instatly is: You have forgotten something:

   

You will need a means to initially set the clock and later specify the alarm-times.

   

When these times are to be changed by a user as in an alarm-clock you will need something like a keypad, when it shall be changed by a machine (computer) you will need an interface between your PSoC4 and the machine. Nonetheless in that configuration there will be a keypad or keyboard connected to that machine.

   

Since the DS1307 is not capable to handling daylight-saving-time you will put some thoughts into that problem, too.

   

Professional developers start by writing a "Functional Specification Document" (FSD) which gives in written form everything the device under construction shall perforn. This document is usually signed with blood as a contract between the customer and the developer. Do not think that this document is not needed for your case, since you haven't got a customer! This document will help you to see the project more clearly, viewing at it from the end-user's side, not from the developer's side only.

   

Next step usually is (when hardware is envolved) a block-diagram showing the connections of the required components. Here you already can specify known facts as the I2C-connection of DS1307 with 0x68 being the slave address of that chip and using PSoC4 pins P4[0] and [1] which additionally will need some pull-up resistors (~5k) for I2C to function correctly.

   

 

   

So, what is your decision: How to enter times for alarm set?

   

 

   

Bob

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You did not comment on

   

Keypad to enter data

   

Daylight saving time (DST)

   

 

   

I can roughly see what you want to do, but what for? Do you want to build an alarm-clock?? An automated garden watering system???

   

Although a buzzer seems to be something very simple, electric connection can be something difficult.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

So to be clear you have two possible approaches.

   

 

   

1) Use software RTC component in PSOC, DS1307 not used.

   

2) Use external RTC with I2C communications between PSOC and DS1307

   

 

   

If battery life is paramount then using PSOC with internal osc and using sleep

   

mode way to go with external DS1307 managed over I2C link.

   

 

   

If cost paramount then PSOC only using RTC component. DS1307 not used.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

1) Use software RTC component in PSOC, DS1307 not used.

   

Ans:

   

   

does it work without ds1307. can we generate log delay for month year without ds1307 (hardware Ic)

   

 

   

 

   

2. 2) Use external RTC with I2C communications between PSOC and DS1307

   

   

 

   

 

   

pin 1 is output pin for valve 

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Yes, that's it.

   

PSoC may be able to run for years, but will your power-supply be stable for all the time?

   

External RTC will run on batt when power loss, to have PSoC batt buffered there is a bit more electronic needed.

   

 

   

Bob

   

PS: When your Pin_1 is controlling the valve, why don't you name that pin "WaterValve" or something meaningful?

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Vead I don't see anyway out of not using a keyboard to set the alarm time. . If you do not want to have a mechanical keyboard use a Capsense keyboard or a touch screen LCD and it can server a dual purpose of  display and keyboard entry . The Capsense would be best as it is not affected by water droplets as this is a watering device. Bob is right a block diagram and schematic would be very helpful for starting the design.This project will require quite a lot of code.

0 Likes
Anonymous
Not applicable

Hi vead 🙂

I have tried project with i2c communication. The PSoC master read an ADC and the PSoC slave display the ADC count in LCD. I will post it soon in this thread to show a complete step about my project.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Vijendra,

   

you may look at the "Notice" tab to get explanations for the error, in your case "Invalid number of parameters". So look into the RTC-datasheet and find the appropiate API to see what and what kind of parameters are expected.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

here are the function of RTC datasheet

   

of this datasheet for more information, as needed.

Function                                        Description
RTC_Start()                                    // Starts the RTC_P4 component by initializing all the parameters and registers
RTC_Stop()                                    // Stops RTC_P4 component operation
RTC_SetDateAndTime()                 //Sets time and date values
 RTC_SetAlarmDateAndTime()  //  Sets the alarm time and date values

   

 

   

I put the same function in program

   

  /* Set date and time */
    RTC_SetDateAndTime();
  
    /* Set alarm date and time */
    RTC_SetAlarmDateAndTime();
   
    /* Set alarm mask */
    RTC_SetAlarmMask();

   

 

   

 Build error: too few arguments to function 'RTC_SetDateAndTime'

   

Build error: too few arguments to function 'RTC_SetAlarmDateAndTime'

   

Build error: too few arguments to function 'RTC_SetAlarmMask'

   

what ismeaning of ''too few arguments to function'' also I am reading some forum post and I am trying to understand where I am doing mistake

   

 

   

Vead

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Build error: too few arguments to function 'RTC_SetDateAndTime'

   

Build error: too few arguments to function 'RTC_SetAlarmDateAndTime'

   

Build error: too few arguments to function 'RTC_SetAlarmMask'

   

 

   

 

   

The corresponding typing has to have paramterers -

   

 

   

 

   

void RTC_SetDateAndTime(uint32 time, uint32 date)
void RTC_SetAlarmDateAndTime(const RTC_date_time * alarmTime)
void RTC_SetAlarmMask(uint32 mask)

   

 

   

 

   

Look at API section of component datasheet for further info.

   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

I saw some sample project after that I wrote program. please look at this program and tell me whats wrong

   


#include <project.h>
#include <stdio.h>

/* Time: 02:59:50 */
#define TIME_HOUR           (0x02u)
#define TIME_MIN            (0x59u)
#define TIME_SEC            (0x50u)
#define HOUR_OFFSET         (16u)
#define MIN_OFFSET          (8u)
#define TIME_HR_MIN_SEC     ((uint32)(TIME_HOUR << HOUR_OFFSET) | \
                            (uint32)(TIME_MIN << MIN_OFFSET)    | \
                             TIME_SEC)
/* Date: 05/16/2015 */
#define DATE_MONTH          (RTC_MARCH)
#define DATE_DAY            (0x16u)
#define DATE_YEAR           (0x2015u)
#define MONTH_OFFSET        (24u)
#define DAY_OFFSET          (16u)
#define DATE_MONTH_DAY_YEAR ((uint32)(DATE_MONTH << MONTH_OFFSET)   | \
                            (uint32)(DATE_DAY << DAY_OFFSET)        | \
                             DATE_YEAR)

/* Alarm Time: 15:44:00 */
#define ALARM_HOUR                  (0x04u)
#define ALARM_MIN                   (0x01u)
#define ALARM_SEC                   (0x30u)
#define ALARM_TIME_HR_MIN_SEC       ((uint32)(ALARM_HOUR << HOUR_OFFSET) | \
                                    (uint32)(ALARM_MIN << MIN_OFFSET)    | \
                                     ALARM_SEC)

/* Alarm Date: 06/16/2015 */
#define ALARM_DATE_MONTH_DAY_YEAR   (DATE_MONTH_DAY_YEAR)



/* Alarm structure declaration */
RTC_DATE_TIME alarmTimeDate;

/* Alarm flag initialization */
uint32 alarmFlag = 0;


int main()
{
   
    /* Alarm structure initialization */
    alarmTimeDate.time = ALARM_TIME_HR_MIN_SEC;
    alarmTimeDate.date = ALARM_DATE_MONTH_DAY_YEAR;
   
    /* Starts RTC component */
    RTC_Start();
   
    /* Set Date and Time */
    RTC_SetDateAndTime(TIME_HR_MIN_SEC,DATE_MONTH_DAY_YEAR);

   
    /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */
    for(;;)
    {
        /* Place your application code here. */
    }
}

/* [] END OF FILE */
 

0 Likes