1 Reply Latest reply on Aug 7, 2014 7:21 AM by JoMe_264151

    Having trouble with Control Reg

    DaHu_285096
              I have set up a control reg for selecting CS on a couple of SPI devices but when I attempt to compile the code, I get error that reference not found. I have attached my project. Thanks for your help   
        • 1. Re: Having trouble with Control Reg
          dakn_263916

          This code looks like you have an attempt to define a structure

             

          and a f() mistypped, ie. seperate deliniation between structure

             

          and f()....?

             

           

             

          struct Timetype GetTime(void)
          {
              struct Timetype t;
              unsigned char tbuf[8];
              unsigned char i;

            SPI_SELECT_Write(RTC_SEL);
            writeSPI( RTCREAD + regSECOND); // write command
            for (i = 0; i<7; i++)
            {
              tbuf[i] = writeSPI(0);  
            }
            SPI_SELECT_Write(RTC_SEL);
            t.Second = tbuf[0] & 0x7f;
            t.Minute = tbuf[1] & 0x7f;
            t.Hour = tbuf[2] & 0x3f;
            t.Day = tbuf[3] & 0x3f;
            t.Month = tbuf[5] & 0x1f;
            t.Year = tbuf[6];
            return t;
          }

          • 2. Re: Having trouble with Control Reg
            JoMe_264151

            Thread was answered here secure.cypress.com/

               

             

               

            Bob