Search the Community

Showing results for tags 'read_register'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • Add-on Boards
    • Scopes & Instruments
    • LabVIEW
    • FRC
    • Other
  • General Discussion
    • Project Vault
    • Learn
    • Suggestions & Feedback
    • Buy, Sell, Trade
    • Sales Questions
    • Off Topic
    • Educators
    • Technical Based Off-Topic Discussions

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. I'm using the ASF in Atmel Studio for i2c interface which works fine, but when I want to read data from any register the slave generates 0x00. Plus, I connect the MCLK pin to external 1MHz frequency. This is my code for temperature measurement: //sets the register pointer void setPointer(unsigned char address) { uint8_t buffer[2] = { 0xB0, address }; //0xB0: pointer command, address: the address that master point to twi_package_t packet_write = { .chip = 0x0D, .buffer = buffer, .length = 2, .no_wait = false }; twi_master_write(&TWIC, &packet_write); while(slave.result != TWIS_RESULT_OK); } //sends the address register and data register void sendByte(unsigned char address, unsigned char data) { uint8_t buffer[2] = { address, data }; twi_package_t packet_write = { .chip = 0x0D, .buffer = buffer, .length = 2, .no_wait = false }; twi_master_write(&TWIC, &packet_write); while(slave.result != TWIS_RESULT_OK); } //read a byte from AD5933 unsigned int getByte(unsigned char reg_loc) { setPointer(reg_loc); uint8_t buffer[1]; twi_package_t packet_read = { .chip = 0x0D, .buffer = buffer, .length = 1, .no_wait = false }; while (twi_master_read(&TWIC, &packet_read) != TWI_SUCCESS); return slave.receivedData[TWIS_RECEIVE_BUFFER_SIZE]; } void main() { init_i2c(); sendByte(0x80, 0x90); // put the 0x90 value into the control register (0x80) delay_ms(50); while(1) { getByte(0x80)//I expect it returns 0x90 but it returns 0x00 //data processing for temperature value } } But it always stays at while(getByte(0x8F) != 0x01);