Porting Manchester RF to Attiny84

ive been working on trying to get the attiny84 to use the manchester library that was written for the attiny85. I assumed it would be straightforward but it doesnt seem to be that way.

this is the library that i am trying to use GitHub - mchr3k/arduino-libs-manchester

but when i try to compile the code on the attiny84 it gives me errors about the various register definitions.

so i added some code for the ATtiny84

MANCHESTERClass::MANCHESTERClass()  //constructor
{
 TxPin = TxDefault;
 pinMode(TxPin, OUTPUT);      // sets the digital pin 4 default as output 
 RxPin = RxDefault;  //sets the digital pin 4 default as input 
 pinMode(RxPin, INPUT);      // default digital pin as output
 TimeOut = TimeOutDefault; //default is to block

 #if defined( __AVR_ATtinyX5__ )
  #define TimerCount TCNT1   //ATtiny84 timer 1  
 #endif
[b] #if defined( __AVR_ATtinyX4__ )
  #define TimerCount TCNT1   //ATtiny85 timer 1  [/b]
 #else
   //ATMega328 timer 2
   #define TimerCount TCNT2   //ATMega328 timer 2
   TCCR2A = 0x00;
   TCCR2B = 0x06; //counts every 16 usec with 16 Mhz clock
   TIMSK2 = 0x00;
 #endif   
}//end of constructor

/*
The 433.92 Mhz receivers have AGC, if no signal is present the gain will be set 
to its highest level.

In this condition it will switch high to low at random intervals due to input noise.
A CRO connected to the data line looks like 433.92 is full of transmissions.

Any ASK transmission method must first sent a capture signal of 101010........
When the receiver has adjusted its AGC to the required level for the transmisssion
the actual data transmission can occur.

We send 14 0's 1010...    It takes 1 to 3 10's for the receiver to adjust to 
the transmit level.

The receiver waits until we have at least 10 10's and then a start pulse 01.
The receiver is then operating correctly and we have locked onto the transmission.
*/
unsigned int MANCHESTERClass::Receive(void)
{
#if defined( __AVR_ATtinyX5__ )
  TCCR1 = 0x08;  //counts every 16 usec with 8Mhz clock
  TIMSK = 0;
#endif
[b]#if defined( __AVR_ATtinyX4__ )
  TCCR1A = 0x08;  //counts every 16 usec with 8Mhz clock
  TIMSK0 = 0;
#endif[/b]

but it doesnt look like its working. can someone look over what i did (i bolded what i added) and maybe tell me what i should be doing to port it to the ATTINY84 that would be great

thanks,
Din See

MANCHESTER.cpp (6.84 KB)

well bolding didnt work correctly but hopefully you can see what i did

Which core are you using?

this is the core I am using

http://code.google.com/p/arduino-tiny/

Bump? I understand not many people use the attiny84 but porting a rf library to it will surely help others when/if they end up using the attiny84 for simple wireless communication.

sorry guys, I am going to bump this one more time.

Try this. The version attached to this post is a modified version on that found on github page you posted.

I can't test it, but it does now compile as the registers are setup correctly.

Manchester.zip (5.02 KB)

Where exactly is this revised code? I can't find it on the github.

It appears to be attached to the post.

Got it. Forgot to log in. Will test when I get home and report back.