USB Thermostat

Home

About

Hardware

Data Transfer

Software

Downloads

Links

 

Data Transfer


Structures were created to hold both time and temperature data. These structures made it much simpler to interface the Windows code with the PIC, as the data structures themselves could be used by both programs.

Three different commands were created to interact with the PIC microcontroller:

  • Time Set/Receive -- 0x40
  • Clear Temperature Data -- 0x41
  • Temperature Set/Receive -- <Starting Address>

Read and write commands are shared, as the I2C standard uses the 8th bit of the I2C address to indicate whether the transfer is a read, or a write operation.

For each command, the command itself is transferred as the data portion of an I2C write operation, and then the actual data transfer occurs in a separate transaction.

Since the UsbI2cIo board only supports 32-byte I2C transfers, only 8 temperature change entries can be transffered during a single transaction. But, multiple transactions can occur back-to-back to transfer the entire 64-entry table.