FM Radio 27984
davi_c
Posts: 3
Hello,
Is there any one that I've built code using Hi-Tech software to interact with the FM receiver 27984? The main reason is that I've learn C coding with Hi-Tech software and the MCU that I'm using is PIC16F887. I've been able to "decode" a part of the propelller code but it gives me a lot of headaches. Any help or small piece of code in C from which I can start from will be greatly appreciated.
Is there any one that I've built code using Hi-Tech software to interact with the FM receiver 27984? The main reason is that I've learn C coding with Hi-Tech software and the MCU that I'm using is PIC16F887. I've been able to "decode" a part of the propelller code but it gives me a lot of headaches. Any help or small piece of code in C from which I can start from will be greatly appreciated.
Comments
I was just looking at the code for the radio and I think I understand it well enough to answer any question you might have. If you want to continue to translate to C you're welcome to ask questions about parts of the program you don't understand.
It looks like the radio is an I2C device so you may want to use an I2C library to communicate with it.
I recently worked on an I2C device and I was surprised to see many examples of Spin I2C code not perform I2C transactions correctly. I just checked the radio code and it does look correct though the I2C lines are driven high and low rather than just driven low.
Is there a specific section of code giving you trouble?
https://www.sparkfun.com/products/10663
Tom
Edit I did a project in Spin using that radio, you can also look at
http://forums.parallax.com/showthread.php/141657-Sparkfun-Si4703-FM-Radio?highlight=radio
0x40 shift one to the right is 0x20.
The last bit of the address indicates if the device is to be read from or written to. If you leave off this bit (by shifting one to the right) then the addresses are the same (but I don't know if this is how your documentation come up with 0x20).
My short experience using I2C with other microcontrollers left me rather confused about addresses. When I watched the I2C transaction with my logic analyzer (LA), it gave a different address than indicated within the source code (Arduino code). When I translated the code to Spin, I had to use the number read from the LA rather than using the address from the source code.
I'm still puzzled about how different microcontrollers define and use I2C addresses.
David.
The Ardunio I2C lib only wants the 7bit device address ignoring the read write bit.
It handles the read write bit internally. Others will have two
separate 8 bit addresses one for read and one for write with the same 7 bits and the read write bit attached.
A logic analyzer will always see the 8 bit version as expected. I2C does not care how humans want to define it
just wants a 7bit device address and a 1 bit read or write bit.
Data sheets use both methods some give a 7bit device address and some the two read and write addresses
with the devices 7bit address and a read write bit tacked on. I bet there is even
a device data sheet that uses both ways in different parts of the data sheet.
Tom