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)