Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] MikroC PIC Error Pointer Required

Status
Not open for further replies.

asking

Full Member level 5
Full Member level 5
Joined
Sep 21, 2010
Messages
279
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Visit site
Activity points
3,377
In the example code given below when i try to compile it i get error "datain = spi_transfer(dataout);" pointer required. Can anyone help whats wrong with this ?


Code:
/* software spi routine */
unsigned short spi_transfer(unsigned short tx)
{
    unsigned short i = 0;
    short int rs = 0;

    nrf24_sck_digitalWrite(LOW);

    for(i=0;i<8;i++)
    {

        if(tx & (1<<(7-i)))
        {
            nrf24_mosi_digitalWrite(HIGH);
        }
        else
        {
            nrf24_mosi_digitalWrite(LOW);
        }

        nrf24_sck_digitalWrite(HIGH);

        rs = rs << 1;
        if(nrf24_miso_digitalRead())
        {
            rs |= 0x01;
        }

        nrf24_sck_digitalWrite(LOW);

    }

    return rs;
}

/* send and receive multiple bytes over SPI */
void nrf24_transferSync(unsigned short dataout,unsigned short datain,unsigned short len)
{
    unsigned int i;

    for(i=0;i<len;i++)
    {
       [B]datain[i] = spi_transfer(dataout[i]);[/B]
    }

}

//send multiple bytes over SPI
void nrf24_transmitSync(unsigned short dataout,unsigned short len)
{
    unsigned int i;

    for(i=0;i<len;i++)
    {
      spi_transfer(dataout[i]);
    }

}
 


Code C - [expand]
1
datain[i] = spi_transfer(dataout[i]);



replace

Code C - [expand]
1
dataout[i]

with a single character and see.

What do you mean by single character ? can you be more clear on this ? thanks...

- - - Updated - - -

Code:
void nrf24_transferSync(unsigned short dataout,unsigned short datain,unsigned short len)
{
    unsigned int i;

    for(i=0;i<len;i++)
    {
     dataout[i];
    }

}

I did something like above and still i am getting error.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top