Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / psoc1 I2C to arduino on: March 19, 2013, 12:56:22 am
Hi ,

I have a big problem.Before,I wrote about this subject  to forum but i didn't get answer. I try to psoc1 to arduino I2C.

How to comminicate with the following program arduino? I think to use wire.h slave_receiver. But i don't know how to write code slave_receiver.Waiting for help thank you..

#include <m8c.h>       
#include "PSoCAPI.h"   
#include "psocgpioint.h"
#include "main.h"
#include "display.h"

I2C_REGS SRegInfo;

void main(void)
{
    // Enable global interrupts
    M8C_EnableGInt;

    ClearAllLEDs();

    // I2C initialization
   
    // Set the location and size of the RAM buffer. It is required to call
    // this function before calling EzI2Cs_Start().
    EzI2Cs_SetRamBuffer(sizeof(SRegInfo), 1, (BYTE *) &SRegInfo);

    // Initialize I2C and enable I2C interrupts
    EzI2Cs_Start();
   
    SRegInfo.bSensorID = 0; //On reset store 0 as sensor id

    // Capsense initialization
   
    CSD_Start();

    CSD_InitializeBaselines();

    // Set finger thresholds according to parameter value
    CSD_SetDefaultFingerThresholds();
   
   while (1)
    {
       
        // Scan each CapSense sensor
         CSD_ScanAllSensors();

        // Update sensor baseline
        CSD_UpdateAllBaselines();

        // Check for on/off state of each sensor
        // Return value of 1 if active, 0 if not active
        CSD_bIsAnySensorActive();

        // Update sensor data registers
        UpdateI2CBuffer();

        // Display slider position and button state
        SetSliderButtonStatusAndUpdateLEDs(SRegInfo.bSliderPos, CSD_baSnsOnMask[0]);
    }
}
   
  void UpdateI2CBuffer(void)
{
   
    M8C_DisableGInt;

   
    SRegInfo.wSensorRawCount = CSD_waSnsResult[SRegInfo.bSensorID];

   
    SRegInfo.wSensorBaselineCount = CSD_waSnsBaseline[SRegInfo.bSensorID];

   
    SRegInfo.wSensorDifferenceCount = CSD_waSnsDiff[SRegInfo.bSensorID];

     
    SRegInfo.wSensorMaskInfo = CSD_baSnsOnMask[1];
    SRegInfo.wSensorMaskInfo = SRegInfo.wSensorMaskInfo << 8 ;
    SRegInfo.wSensorMaskInfo |= CSD_baSnsOnMask[0];
   
   if( ( CSD_baSnsOnMask[0] & BUTTON_MASK ) != 0x00 )
    {
        if(CSD_baSnsOnMask[0] & BUTTON0_MASK)
        {
            SRegInfo.bPhysicalButtonNum = 0x00;
            LED_ON(Digital1_Data_ADDR, Digital1_MASK);
      }

       
   }

   else
    {
        // Store NO_FINGER as default data if button is not active
        SRegInfo.bPhysicalButtonNum = NO_FINGER;
    }

    // Get slider position, validate and store the data into I2C buffer.
    SRegInfo.bSliderPos = (BYTE)CSD_wGetCentroidPos(1);
    if (SRegInfo.bSliderPos == NO_FINGER)
    {
        // Store '0' as default data if slider is not active
        SRegInfo.bSliderPos = NO_FINGER_PRESENT;
    }

    M8C_EnableGInt;
}
2  Using Arduino / Programming Questions / PSoC1 I2C Slave - Arduino I2C Master on: March 14, 2013, 05:02:50 am
Hi,

I'm trying to make a psoc1 as a i2c slave, to be able to read and write to it over i2c with Arduino as a master device.But I can't do this. How to be a program for psoc and arduino?
3  Using Arduino / Programming Questions / Re: WProgram.h: No such file or directory on: February 08, 2013, 05:01:01 pm
i fixed problem.I would like to thank all of you
4  Using Arduino / Programming Questions / Re: WProgram.h: No such file or directory on: February 08, 2013, 04:49:44 pm
ok.thanks.
5  Using Arduino / Programming Questions / Re: WProgram.h: No such file or directory on: February 08, 2013, 04:46:43 pm
awol i tried reply #8 probably max6675.h have a error.Can you try to max6675.h
6  Using Arduino / Programming Questions / Re: WProgram.h: No such file or directory on: February 08, 2013, 04:40:52 pm
i tried to change WProgram.h to Arduino.h but i still get a error. i dont know, What else I need to change?
7  Using Arduino / Programming Questions / max6675 library compile error... on: February 08, 2013, 04:10:11 pm
Hi,

I want to use max6675 library but ı have compile error.
this error:

In file included from Single_Temp.ino:6:
C:\Users\f\Documents\Arduino\libraries\max66library/MAX6675.h:9:22: error: WProgram.h: No such file or directory

Can you help me?
8  Using Arduino / Programming Questions / Re: WProgram.h: No such file or directory on: February 08, 2013, 11:03:58 am
i'm sorry awol. I didn't know. Can we solve this problem?
9  Using Arduino / Programming Questions / Re: WProgram.h: No such file or directory on: February 08, 2013, 10:43:35 am
i  fixed this problem but This time I'm getting the following error:


Single_Temp:19: error: 'MAX6675' does not name a type
Single_Temp.pde: In function 'void loop()':
Single_Temp:31: error: 'temp0' was not declared in this scope

.cpp file:

Code:

/*
  MAX6675.cpp - Library for reading temperature from a MAX6675.
  Created by Ryan McLaughlin <ryanjmclaughlin@gmail.com>
*/

#include <Arduino.h>
#include <MAX6675.h>

MAX6675::MAX6675(int CS_pin, int SO_pin, int SCK_pin, int units, float error)
{
  pinMode(CS_pin, OUTPUT);
  pinMode(SO_pin, INPUT);
  pinMode(SCK_pin, OUTPUT);
  
  digitalWrite(CS_pin, HIGH);
  
  _CS_pin = CS_pin;
  _SO_pin = SO_pin;
  _SCK_pin = SCK_pin;
  _units = units;
  _error = error;
}

float MAX6675::read_temp(int samples)
{
  int value = 0;
  int error_tc = 0;
  float temp = 0;
  
  for (int i=samples; i>0; i--){

    digitalWrite(_CS_pin,LOW); // Enable device

    /* Cycle the clock for dummy bit 15 */
    digitalWrite(_SCK_pin,HIGH);
    digitalWrite(_SCK_pin,LOW);

    /* Read bits 14-3 from MAX6675 for the Temp
       Loop for each bit reading the value and
       storing the final value in 'temp'
    */
    for (int i=11; i>=0; i--){
      digitalWrite(_SCK_pin,HIGH);  // Set Clock to HIGH
      value += digitalRead(_SO_pin) << i;  // Read data and add it to our variable
      digitalWrite(_SCK_pin,LOW);  // Set Clock to LOW
    }
  
    /* Read the TC Input inp to check for TC Errors */
    digitalWrite(_SCK_pin,HIGH); // Set Clock to HIGH
    error_tc = digitalRead(_SO_pin); // Read data
    digitalWrite(_SCK_pin,LOW);  // Set Clock to LOW
  
    digitalWrite(_CS_pin, HIGH); //Disable Device
  }
  
  value = value/samples;  // Divide the value by the number of samples to get the average
  
  /*
     Keep in mind that the temp that was just read is on the digital scale
     from 0ËšC to 1023.75ËšC at a resolution of 2^12.  We now need to convert
     to an actual readable temperature (this drove me nuts until I figured
     this out!).  Now multiply by 0.25.  I tried to avoid float math but
     it is tough to do a good conversion to ËšF.  THe final value is converted
     to an int and returned at x10 power.
    
   */
  
  value = value + _error;                  // Insert the calibration error value
  
  if(_units == 0) {                        // Request temp in ËšF
    temp = ((value*0.25) * (9.0/5.0)) + 32.0;   // Convert value to ËšF (ensure proper floats!)
  } else if(_units == 1) {                  // Request temp in ËšC
    temp = (value*0.25);                  // Multiply the value by 0.25 to get temp in ËšC
  }
  
  /* Output -1 if there is a TC error, otherwise return 'temp' */
  if(error_tc != 0) {
    return -1;
  } else {
    return temp;
  }
}


thanks for your helps...

Moderator edit: [code] ... [/code] tags added. (Nick Gammon)
10  Using Arduino / Programming Questions / Re: WProgram.h: No such file or directory on: February 08, 2013, 09:45:29 am
I've tried everything.Please help the library users
11  Using Arduino / Programming Questions / Re: WProgram.h: No such file or directory on: February 08, 2013, 08:01:54 am
I tried, but nothing can be changed
12  Using Arduino / Programming Questions / WProgram.h: No such file or directory on: February 08, 2013, 07:27:48 am
I want to download MAX6675 library.But I'm getting the following error:

In file included from Single_Temp.pde:6:
C:\Users\salim\Documents\Arduino\libraries\max6675arduinolibrary/MAX6675.h:9:22: error: WProgram.h: No such file or directory
Single_Temp.pde:21:4: error: #else without #if
Single_Temp.pde:23:4: error: #endif without #if
Single_Temp:11: error: conflicting declaration 'int SCK'
C:\Program Files\arduino-1.0.3\hardware\arduino\variants\mega/pins_arduino.h:38: error: 'SCK' has a previous declaration as 'const uint8_t SCK'
Single_Temp:19: error: 'CS0' was not declared in this scope

How I can fix this problem?
13  Using Arduino / Displays / TFT-LCD photo on: January 22, 2013, 04:36:31 am
Hi,
How do I adjust the speed  transition of photo in TFT-LCD?  Which command should I use?
14  Using Arduino / Displays / TFT-LCD and SD CARD on: January 21, 2013, 10:59:49 am
Hi,
I have itdb02 shield 3.2'' tftlcd.Using the sd card, i want to  install the picture to TFT LCD.But i get an error.
I am writing program this way:  myGLCD.loadBitmap(0, 0, 320, 240, "images1.RAW");


tflcd_devre.ino: In function 'void loop()':
tflcd_devre:96: error: 'class UTFT' has no member named 'loadBitmap'

Please Help Me..
Pages: [1]