RF troubles

Go To Last Post
53 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all!
Been a long time lurker, and the site has helped me through some major obsticles in my projects. But now after a few hours of research and forum whoreing I feel I cannot find a good writeup on how to implement rf transmission with an avr.

So for the specs:
microcontroller:ATMega128L
rf circuit: http://www.xenon-tech.com/index_eproduct_view.php?products_id=4 and its datasheet

http://www.xenon-tech.com/member/26398/eshop/RFspec1.pdf

All the device is supposed to do at the moment is read in a temp, convert it with an adc, and send it to my atmega for processing using the rf component.

So heres the rub. The rf interface requires manchester encoding/decoding, and I can not make the darn thing work.

Does anyone either:
1 have some working code that would work with my rf combo
2 have some code that works with a similar combo
3 reccomend me a good compatible encoder decoder combo to interface with the rf component
4 have any general advice

Any help would be greatly appreciated

:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you look at their manchester coding app note?

Its here:
http://www.xenon-tech.com/member/26398/eshop/Manchester.pdf

You are going to need an entire processor to encode your temperature data for the input to the RF link. It is not something that you can do readily with basic logic. Well, you can with some of the manchester formats but not very many.

What is your temperature sensor?

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You might be better off with the nRF24L01. Spark Fun makes little modules using them that are easy to interface to an MCU. I think I have seen some AVR code for them somewhere.

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hey thanks for the replies

ka7ehk: The note helps. But more the realisation that I should just stick a mc on the sending side. Heck it can do the adc for the temp with it too. Thanks

And its a 10k thermistor sitting on a solar water heating unit.

leon: I might have to give up on the 433 mhz and get that snazzy 2.4 ghz, but I feel if I slam my head against it for abit I will figure it out. So heres hopeing.

Ill update my progress just in case someone else has 433 rf communication needs.

plus i bet there is someoe out there that has used these(espically since they are advertised like right to the left of this text box as I write this) (Ya those xenon rf modules for 3.50. Though thats the bulk price)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So I am starting to come along. I have a solid idea of how to get the sender and reciever units to talk to each other.

I have the pulses set up according to this
http://www.xenon-tech.com/member/26398/eshop/RegenNote.pdf

I think my code is conceptually right(dunno about syntaxially...YET)

but im having the damdest time getting delay to work

I have the compiler optimizations to -Os
and I defigned F_CPU at the very top

heres the code

#define F_CPU 8000000UL;
//#include
#include"delay_x.h"
#include


//code to define pins
#define	RFTx 		PORTD ,2	//RF transmit pin
#define	RFrecv		PORTD ,1	//RF receive pin
#define	RF_RecvEN	PORTD ,0	//RF receive enable pin, delay 700mS after first power on

#ifndef _AVR035_H_ 
#define _AVR035_H_ 

// from AVR035: Efficient C Coding for AVR 
//quick pin change macros
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT)) 
#define CLEARBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT)) 
#define FLIPBIT(ADDRESS,BIT) (ADDRESS ^= (1<<BIT)) 
#define CHECKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT)) 

#define SETBITMASK(x,y) (x |= (y)) 
#define CLEARBITMASK(x,y) (x &= (~y)) 
#define FLIPBITMASK(x,y) (x ^= (y)) 
#define CHECKBITMASK(x,y) (x & (y)) 

#define VARFROMCOMB(x, y) x 
#define BITFROMCOMB(x, y) y 

#define C_SETBIT(comb) SETBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#define C_CLEARBIT(comb) CLEARBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#define C_FLIPBIT(comb) FLIPBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#define C_CHECKBIT(comb) CHECKBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 

#endif 

//global varibles
int ReceivedData[4];		//receiver buffer, last byte is checksum
int Txdata[3];				//buffer for transmission
int Recv_error_flag;		//receive data error flag, no cofigureable data
int recvtimeout; 			//receiver timeout variable, no configurable data      
   

//*******************Function to get a bit in a data, return 0xFF if received bit length is incorrect*****
//when tx sends 300ms H pulse and 300ms L pulse, the flowing counter should read:
//Hpulse = 30 is data bit 1
//Hpulse = 12 is data bit 0
int get_bit()							//1ms per call on this route
{
	int Hpulse, i;
	Hpulse = 0;
	while(!C_CHECKBIT(RFrecv))		//wait for high pulse to occur
	{
	}//while
	for(i = 0; i <35; i++)		//now sample pulse for about 800us
	{
		if(C_CHECKBIT(RFrecv))
		{
			Hpulse ++;
		}//if
		_delay_us(10);
	}//for

	if((Hpulse > 25) && (Hpulse < 35))
	{
		return 1;
	}//if
	if((Hpulse > 7) && (Hpulse < 17))
	{
		return 0;
	}//if
	else
	{
		Recv_error_flag = 1;
	}//else   
}//get_bit


//************************************get 1 byte from the receiver******************************************
int get_byte()
{
	int bits = 0;
	bits = (bits | get_bit()) << 1;			//get MSB bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 7 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;			//get 6 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 5 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 4 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;			//get 3 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 2 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit());		//get LSB bit of a byte (or bits with get_bit(), then shift left 1)
	return bits;
}//get_byte

//Find Sync. Pulse
int Sync()								//find 2ms low then high Sync. pulse
{
	int i;
	i = 0;
	while(!C_CHECKBIT(RFrecv))
	{
	}//while
	while(C_CHECKBIT(RFrecv))
	{
	}//while
	while(!C_CHECKBIT(RFrecv))			//Find 1500us low pulse
	{
		i++;
		_delay_us(10);
		if(i > 70)						//1500us reached
		{
			for(i = 0; i < 60; i++)	//within ~600us, if find high pulses, sync. successful
			{
				_delay_us(10);
				if(C_CHECKBIT(RFrecv))							//now get data
				{
					return 1;
				}//if
			}//for
			return 0;
		}//if
	}//while
}//Sync



/*	
int get_data(int time)
				1)	initally turn on receiver
				2)	time = # of secs to wait for data packet, max. is 127 sec.,
										return 1 if data valid, data will be stored at receiveddata[0~9] arary, 
				3)	at the end of the function, receiver will be turned off to save power
*/
int get_data(int time)
{
	int i,checksum;					//counter varibles
	
   //this section of code was origionally written by the manufacturers (dont know if need)
   //setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);  //524 ms overflow, reserved for RF transmission timing
   //set_timer1(0);


	C_SETBIT(RFTx);					//disable transmitter		
	C_CLEARBIT(RF_RecvEN);			//enable RF receiver
	recvtimeout=0;					//reset timeout flag
	_delay_ms(100);
	time = time * 2;
	while(recvtimeout <= time)				//while time is not expired
	{
		if(Sync())
		{
			Recv_error_flag = 0;				//reset receive error flag
			for(i = 0; i < 4; i++)
			{
				ReceivedData[i] = get_byte();		//try get 11 bytes
				if(Recv_error_flag == 1)			//if something wrong, exit get bytes loop
				{
					i = 4;
				}//if
			}//for
			if(Recv_error_flag == 0)			//after getting 11 bytes, if bits recieved OK, verify checksum
			{
				checksum = ReceivedData[0];	//calculate checksum                               
				for(i = 1; i < 3; i++)
				{
					checksum = ReceivedData[i] ^ checksum;
				}//for
				
				if(checksum == ReceivedData[3])		//if checksum is correct
				{
				   //disable_interrupts(INT_TIMER1); 	//disable timer 1
			   	C_SETBIT(RF_RecvEN);			//disable RF receiver
					return 1;							
				}//if
				else										//if checksum is incorrect
				{
//					disable_interrupts(INT_TIMER1); 	//disable timer 1
				   	C_SETBIT(RF_RecvEN);			//disable RF receiver
//					return 0;
				}//else
			}//if
		}//if
	}//while
	//disable_interrupts(INT_TIMER1);	//disable timer 1;
	C_SETBIT(RF_RecvEN);			//disable RF receiver
	return 0;										//cannot get data
}//get data



int main()
{
	
   	_delay_ms(1000);		//ititial delay to get things initialized
  
  	while(1)
  	{
		if(get_data(127))	//127sec delay to get data
		{

		}//if
  	}//while
	return(1);
}//main


and here is the build output

Build started 12.11.2007 at 13:46:49
avr-gcc.exe -mmcu=atmega128 -Wall -gdwarf-2 -Os -fsigned-char -MD -MP -MT Trendsetterreciever.o -MF dep/Trendsetterreciever.o.d -c ../Trendsetterreciever.c
../Trendsetterreciever.c: In function 'get_bit':
../Trendsetterreciever.c:61: error: expected ')' before ';' token
../Trendsetterreciever.c: In function 'Sync':
../Trendsetterreciever.c:108: error: expected ')' before ';' token
../Trendsetterreciever.c:113: error: expected ')' before ';' token
../Trendsetterreciever.c: In function 'get_data':
../Trendsetterreciever.c:145: error: expected ')' before ';' token
../Trendsetterreciever.c: In function 'main':
../Trendsetterreciever.c:200: error: expected ')' before ';' token
make: *** [Trendsetterreciever.o] Error 1
Build failed with 5 errors and 0 warnings...

Basically its erroring the exact same way every delay call...So what am I doing stupid?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

oh ya and i tried both utils/delay.h
and the delay_x.h libraries(as shown in the top of the code commented out

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the error specifically talks about this line in delay.h

double __tmp = ((F_CPU) / 3e6) * __us;

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rubix,
just a quick note, try the linx devices, they are a few bucks cheaper, have better range, support higher data rates and do not use manchester. I hooked up the uart pins directly and the things work great

You can get them at

www.digikey.com

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks JGM. they actually look to be around the same price or more(unless i looked at the wrong ones http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=TXM-433-LC-ND ) ...but now I feel I must try to get these to at least compile and test just outta the principle that I've been screwing with this code for a day and a half now and dont want to scrap it

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I understand wanting to get it to work on principle, but you should also look at the logistics as well, decoding manchester in an avr is not terribly difficult, just processor cycle hungry. Also, is there a timeframe on completion for this thing? If you do, then sometimes it's best to bite the bullet.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well it might be time to admit im wrong...i screwd with this thing forever and can not get it to work for me...

that linx is lookin mighty good right now...

heres the code for both sides

transmitter

Description:
	1. Takes an input from a temperature sensor
	2. Performs an analog to digital conversion
	3. Transmits the temp to a remote display

RF transmission is done via standard Manchester transmission outlines
The code also takes into account power saving techniques via:
		1 turns off tranciever once data has sent
		2 limits the frenquency of sending data


PORTS--------Type--------Description

PORTD:		Mixed		Pins for communicating with the RF transmitter
PORTC:		Output		LED outputs for status check and sending notification
PORTF:		Input		Pins for getting temp and performing ADC
*/

#define F_CPU 8000000
//#include
#include"delay_x.h"
#include
#include 

//code define pins
#define	RFTx 		PORTD ,1	//RF transmit pin
#define SendLed		PORTC ,3	//output LED
#define testled		PORTC ,2	//test led

// from AVR035: Efficient C Coding for AVR 
//quick pin value change macros
#ifndef _AVR035_H_ 
#define _AVR035_H_ 
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT)) 
#define CLEARBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT)) 
#define FLIPBIT(ADDRESS,BIT) (ADDRESS ^= (1<<BIT)) 
#define CHECKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT)) 
#define SETBITMASK(x,y) (x |= (y)) 
#define CLEARBITMASK(x,y) (x &= (~y)) 
#define FLIPBITMASK(x,y) (x ^= (y)) 
#define CHECKBITMASK(x,y) (x & (y)) 
#define VARFROMCOMB(x, y) x 
#define BITFROMCOMB(x, y) y 
#define C_SETBIT(comb) SETBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#define C_CLEARBIT(comb) CLEARBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#define C_FLIPBIT(comb) FLIPBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#define C_CHECKBIT(comb) CHECKBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#endif 


//global varibles
int ReceivedData[4];			//receiver buffer, last byte is checksum
int Txdata[3];					//buffer for transmission
int Recv_error_flag;			//receive data error flag, no cofigureable data
int recvtimeout; 				//receiver timeout variable, no configurable data
int MAX_RESEND=3;				//max number of times data is resent

/*
This function localizes all data direction register assginments
*/
void Port_reg_setup(){
	DDRC=0xFF;							//sets port C pins 1-8 to output
	DDRD=0x0F;							//sets port D pin 1-4 to output
}


/*
Init loop is used for sending sync. pulse, must call before sending data
*/
void txinit()
{
	int i;
	for(i = 0; i <= 40; i++)					//send lot of hi/lo transistion pulse to ack. the receiver
	{
		C_CLEARBIT(RFTx);
		_delay_us(300);
		C_SETBIT(RFTx);
		_delay_us(300);
	}
	C_CLEARBIT(RFTx);						//2ms low bits as sync. pulse
	_delay_ms(2);
}//txinit

/*
end loop is called after sending data, to turn off the transmitter
*/
void txend()
{
	C_CLEARBIT(RFTx);							//low pulse to terminate the tx.
	_delay_ms(20);
}//txend

/* Write data
send the individual 8 bits of 1 byte(data) to the transmitter for sending
the pulse duty cycle uses the manchester encoding technique
*/
void txwrite(int data)			
{
	int j;											//loop counter
	int Result;										//for storing bits of the data

	for(j = 0; j <= 7; j++)							//sends 8 bits out to the tx with MSB being transmitted first
	{
		Result = data & 0b10000000;					//get the MSB of data and store in result
		if(Result == 0)								//if the tested bit is 0
		{
			C_SETBIT(RFTx);							//generate duty cycle
			_delay_us(300);
			C_CLEARBIT(RFTx);
			_delay_us(700);
		}//if
		else										//if the tested bit is 1
		{
			C_SETBIT(RFTx);							//generate duty cycle
			_delay_us(700);
			C_CLEARBIT(RFTx);
			_delay_us(300);
		}//else
		data=data<<1;								//bit shifts next bit to the MSB 
	}//for
}//txwrite


/*
Transmits data to reciever using manchester encoding technique
for checksum generation

Current tranfer size = 4 bytes = 24 bits
*/
void RF_Transmit()
{
	int i,j;
	int checksum;
	checksum = Txdata[0];
	C_FLIPBIT(SendLed);
	for(i = 1; i < 3; i++)
	{
		checksum = Txdata[i] ^ checksum;
	}//for
	for(j = 0 ; j <5; j++)
	{
		txinit();
		txwrite(Txdata[0]);
		txwrite(Txdata[1]);
		txwrite(Txdata[2]);
		txwrite(checksum);
		txend();
	}//for
}//RF_Transmit

/*
Gets the temperature from the sensor and loads it into Txdata
Currently Temp is sent as a 16 bit number (Its mad big for how accurate it is
but the device likes to send a 20-40 bit string anyway so I sent a standard C int 
byte style
*/
void Get_Temp(){
	int temp=75;//?? gotta spec the temp reader (for debugging purposes ill set it to a known value :75)
	Txdata[0]=temp & 0x00FF;
	Txdata[1]=(temp & 0xFF00) >> 8;
	Txdata[2]=0;						//ensures for a proper checkbit
}//Get_Temp


//txdata is 4 long(just a note for remembering)
int main()
{
	Port_reg_setup();
	
	int i=0;							//resend counter
 	_delay_ms(1000);					//ititial delay to get things initialized
	
	for(i = 0; i <= 2; i++)				//init to make the reciever aware
	{
		Txdata[i] = 0xAA;
	}//for
	RF_Transmit();
	while(1)
  	{
		Get_Temp();
		for(i = 0; i <= MAX_RESEND; i++)
		{
			RF_Transmit();
		}//for
		_delay_ms(500);					//wait awhile to send another update (saves battery)
  	}//while
	

}//main

reciever side

Description:
	1. Recieves Manchester encoded wireless RF input
	2. Converts encoded data back to actual temperature sent from remote unit
	2. outputs LED's according to temperature

	RF transmission is done via standard Manchester transmission outlines
	Transmitted value is a 16bit integer 

PORTS--------Type--------Description

PORTD:		Mixed		Pins for communicating with the RF transmitter
PORTE:		Output		LED outputs for status check and sending notification
PORTF:		Input		Pins for getting temp and performing ADC

*/

#define F_CPU 8000000
//#include
#include
#include"delay_x.h"
#include
#include


//code to define pins
#define	RFrecv		PORTD ,1	//RF receive pin
#define	RF_RecvEN	PORTD ,0	//RF receive enable pin, delay 700mS after first power on
#define Led			PORTE ,3	//LED output pin
#define testled		PORTE, 0


// from AVR035: Efficient C Coding for AVR 
//quick pin change macros

#ifndef _AVR035_H_ 
#define _AVR035_H_ 
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT)) 
#define CLEARBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT)) 
#define FLIPBIT(ADDRESS,BIT) (ADDRESS ^= (1<<BIT)) 
#define CHECKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT)) 
#define SETBITMASK(x,y) (x |= (y)) 
#define CLEARBITMASK(x,y) (x &= (~y)) 
#define FLIPBITMASK(x,y) (x ^= (y)) 
#define CHECKBITMASK(x,y) (x & (y)) 
#define VARFROMCOMB(x, y) x 
#define BITFROMCOMB(x, y) y 
#define C_SETBIT(comb) SETBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#define C_CLEARBIT(comb) CLEARBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#define C_FLIPBIT(comb) FLIPBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#define C_CHECKBIT(comb) CHECKBIT(VARFROMCOMB(comb), BITFROMCOMB(comb)) 
#endif 


//global varibles
int ReceivedData[4];		//receiver buffer, last byte is checksum
int Txdata[3];				//buffer for transmission
int Recv_error_flag;		//receive data error flag, no cofigureable data
int recvtimeout; 			//receiver timeout variable, no configurable data      
   
// Interrupt occurs once per millisecond once timer has been setup
ISR(TIMER1_COMPA_vect)
{
	recvtimeout++;
	TCNT1=0x00;
}

/*
This function localizes all data direction register assginments
*/
void Port_reg_setup(){
	DDRE=0xFF;							//sets port E pins 1-8 to output
	DDRD=0x00;							//sets port D pin 1-8 to input and pin 1 to output
}//Port_reg_setup()



/*Function to get a bit in a data, return 0xFF if received bit length is incorrect*****
when tx sends 300ms H pulse and 300ms L pulse, the flowing counter should read:
Hpulse = 30 is data bit 1
Hpulse = 12 is data bit 0
*/
int get_bit()						//1ms per call on this route
{
	int Hpulse, i;
	Hpulse = 0;
	while(!C_CHECKBIT(RFrecv))		//wait for high pulse to occur
	{
	}//while
	for(i = 0; i <35; i++)			//now sample pulse for about 800us
	{
		if(C_CHECKBIT(RFrecv))
		{
			Hpulse ++;
		}//if
		_delay_us(10);
	}//for

	if((Hpulse > 25) && (Hpulse < 35))
	{
		return 1;
	}//if
	if((Hpulse > 7) && (Hpulse < 17))
	{
		return 0;
	}//if
	else
	{
		Recv_error_flag = 1;
	}//else   
	return 0;
}//get_bit


/* gets 1 byte (8bits)from the data transmission
*/
int get_byte(){
	int bits = 0;
	bits = (bits | get_bit()) << 1;		//get MSB bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 7 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 6 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 5 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 4 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 3 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit()) << 1;		//get 2 bit of a byte (or bits with get_bit(), then shift left 1)
	bits = (bits | get_bit());			//get LSB bit of a byte (or bits with get_bit(), then shift left 1)
	return bits;
}//get_byte

/* Sync() finds Sync Pulse and allows for initial transmitter reciever handshake

*/
int Sync()								//find 2ms low then high Sync. pulse
{
	int i;
	i = 0;
	C_SETBIT(testled);
	while(!C_CHECKBIT(RFrecv))
	{
	}//while
	C_CLEARBIT(testled);	
	while(C_CHECKBIT(RFrecv))
	{
	}//while
	while(!C_CHECKBIT(RFrecv))			//Find 1500us low pulse
	{
		i++;
		_delay_us(10);
		if(i > 70)						//1500us reached
		{
			for(i = 0; i < 60; i++)		//within ~600us, if find high pulses, sync. successful
			{
				_delay_us(10);
				if(C_CHECKBIT(RFrecv))	//now get data
				{
					return 1;
				}//if
			}//for
			return 0;
		}//if
	}//while
	return 0;
}//Sync



/*	
int get_data(int time)
				1)	initally turn on receiver
				2)	time = # of secs to wait for data packet, max. is 127 sec.,
										return 1 if data valid, data will be stored at receiveddata[0~9] arary, 
				3)	at the end of the function, receiver will be turned off to save power
*/
int get_data(int time)
{
	int i,checksum;		//counter varibles
	
   	//this section of code was origionally written by the manufacturers (dont know if need)
   	//setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);  //524 ms overflow, reserved for RF transmission timing
   	//set_timer1(0);
  
	sei();
	recvtimeout=0;
	TIMSK=(1<<OCIE1A);			//sets up output compare register 1 a
	OCR1A= 1000;					//sets to compare at 524
	
	TCCR1B=(1<<WGM12)|(1<<CS11);
		
	C_CLEARBIT(RF_RecvEN);								//enable RF receiver
											//reset timeout flag
	_delay_ms(100);
	time = time * 2;
	while(recvtimeout <= time)							//while time is not expired
	{
		if(Sync())
		{
			Recv_error_flag = 0;						//reset receive error flag
			for(i = 0; i < 4; i++)
			{
				ReceivedData[i] = get_byte();			//try get 11 bytes
				if(Recv_error_flag == 1)				//if something wrong, exit get bytes loop
				{
					i = 4;
				}//if
			}//for
			if(Recv_error_flag == 0)					//after getting 11 bytes, if bits recieved OK, verify checksum
			{
				checksum = ReceivedData[0];				//calculate checksum                               
				for(i = 1; i < 3; i++)
				{
					checksum = ReceivedData[i] ^ checksum;
				}//for
				
				if(checksum == ReceivedData[3])			//if checksum is correct
				{
				   cli(); 								//disable timer by disabling all interrupts
			   	C_SETBIT(RF_RecvEN);					//disable RF receiver
					return 1;							
				}//if
				else									//if checksum is incorrect
				{
					cli(); 								//disable timer by disabling all interrupts
				   	C_SETBIT(RF_RecvEN);			//disable RF receiver
					return 0;
				}//else
			}//if
		}//if
	}//while
	//sei();
	C_SETBIT(RF_RecvEN);			//disable RF receiver
	return 0;										//cannot get data
}//get data


/*real_temp
This function takes the recieved byte array and converts it back to an int with
some clever bit shifting
*/
int real_temp(){
	return (ReceivedData[0] + (ReceivedData[1] << 8));

}//real temp


/*LED Output
	1 Takes input RF signal stored in ReceivedData 
	2 converts it to an int
determines 
*/
void LED_out(){
	if (real_temp()<70){
	//led output to be determined by vote
	}//if
	else if(70 < real_temp() && real_temp() < 100)
	{
	C_SETBIT(Led);
	//led output to be determined by vote
	}//else if
	else
	{
	//led output to be determined by vote
	}//else
}//LED_out


int main()
{
	Port_reg_setup();
	
   	_delay_ms(1000);		//ititial delay to get things initialized
	while(1)
  	{
		if(get_data(127))	//127sec delay to get data
		{
			LED_out();
		}//if
  	}//while
	return(1);
}//main


  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
#define RFrecv PORTD ,1   //RF receive pin 

You can't C_CHECKBIT with this define since you must read a pin state using the PINx register. So

#define RFrecv PIND ,1   //RF receive pin 

/Lars

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also, PD0 is not made an output here (and the comment is confusing).

DDRD=0x00; //sets port D pin 1-8 to input and pin 1 to output

So I guess you need

DDRD=0x01; //sets port D pin 1-7 to input and pin 0 to output

Edit: Fixed pin numbering, better learn to refer to the pins/bits as 0-7.
/Lars

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did make those changes and gave it a try..the reciever still is hanging at sync()...even If I set the transmitter to just constantly send out a sync pulse it never makes it past the first while to test for a low

I ended up taking jgmdegins advice and went with linx. I got their 433 mhz LR series with 1/4 whips. They were right cheap.

Anyone have a coded linx transmitter library working?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

TYhere is nothing to code to them really
All you do is connect the AVR's uart pins to the devices, configure the uart, and then send or recieve the data from the uart. All the linx devices do is convert the data to/from RF. I do admit they are a tad slow, but they do work.

Incidentally, they can be soldered thru-hole, but you need to do a little work.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

one thing I forgot to mention is that if you need to do bidirectional, then you need to buy one pair at one frequency and the other pair at another.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nope single diection is all i need

thanks for the reccomendation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Grr comon digikey ... I paid you $40 to overnight me those linx modules:p

Thanks for all yalls help in the last couple days. Ive been slammin questions up here left and right. I was recently givin a project that required a uC. Though till this particular project I never tried to really develop a polished device using atmel uPs (I just had played with the butterfly a few times for proof of concept projects.) So Its been a lerning process for sure.

BUT THATS THE FUN PART. Gettin paid to learn is sweet.

Besides, hardware design is my sthick. All of my late EE/CSE college time was spent coding vhdl for FPGAs, and useing cadence to make processos. So when I was given my first uC project at my first job out of college(and I wasnt hired as an EE, they just knew I had it under my belt,) I felt I should produce. I feel the vibe I get from my boss and I think if I can keep up my productivity I'll become the defacto EE uC dept for the company!!(something they outsourced before cause who wants to program uC's....US!!! :-P )

So I've been losing sleep to say the least tryin to make sure I come up to speed.

Sacrificed a few reams of paper and printed me a mega 128 datasheet...and choice atmel notes. Its my nightly reading.

which reminds me! I found the warning about atmel shipping in at103 compatibility mode...took me 4 hours to fig out when first screwin with my stk501! whish I had read beforehand.

Either way, Just alittle introduction and thanks. ....now where are theose darn linx modules mr fed ex dude.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Thanks for all yalls help in the last couple days. Ive been slammin questions up here left and right.

You are welcome, that's what we are here for.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you get the modules, or did you off the fedex guy?

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lol I got em. Coded what I believe will work for usart got it all ready to solder, and left for the weekend. I feel it should work by 3 compiles or so :p . (Here's hoping)

Once that works I guess I should encode/decode in some way. I mean I think a basic checksum is all I need....

But why do it when you can OVER DO IT!!!

What would be nice is an encoding scheme that will virtually make it impossible for random rf noise to look like valid data.like I don't want any old wireless phone setting this thing into convultions. Any thoughts anyone?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup I got the modules! Flat contacts so I have to do a lil soldering this morning, but I think I got the code to where Ill see em work in a compile or 2.

I guess once it works I should implement some kinda encode/decode. Prob just a checksum would work....

But why do it when you can over do it!!!

Does anyone know a encoding method or methodology even that should block any intereference and make sure it generates no false data positives? 433mhz is a noisy frequency range.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One possible way is to send a byte of data, then wait for a certain time and send the byte again.
The rx in turn after receiving the first byte waits for the same time and then loads in the second byte and compares the both of them. If they do not match, then the RX flushes the data. If they do then it is considered valid and process it accordingly.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

so i connected em and trying to figure out what I have to do to get em working ....I have the transmit side o the txd pin of my stk 501...looks like it is working
I dont have any test device hooked up at the moment so I dont know that its sending ...only that it gets past the sending bacause a led light up I had set to happen after it sent something to the usart

the reciever side looks less hopeful as none of my test lights are coming up n the recieve

txd pin on send side and
rxd pin on recieve right????

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
One possible way is to send a byte of data, then wait for a certain time and send the byte again.
The rx in turn after receiving the first byte waits for the same time and then loads in the second byte and compares the both of them. If they do not match, then the RX flushes the data. If they do then it is considered valid and process it accordingly.

Jim

i like that idea...i bet itll work fine

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

your connections are correct. you could try sending a square wave through the link and scope the rx output to see that the RF is working. Once that is confirmed check your source code for the usart being set up properly.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So here is my usart code for the recieve side

[code]

//USART DEFINES
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)

//usart stuff
void Usart_Init(){
UBRR0L=BAUD_PRESCALE; //for this one the define calc will give 51 or 0x33
UBRR0H=BAUD_PRESCALE >> 8;
UCSR0B=0x08; //sending only
UCSR0C=0x06; //asynchronous - no parity - 8bit
}//Usart_Setup

void Usart_Send(char data){
while ((UCSR0A & (1 << UDRE0)) == 0) {}; // Do nothing until UDR is ready for more data
UDR0 = data ; // Send out the byte value
}//Usart_Send

int Usart_Recieve(){
while ((UCSR0A & (1 << RXC0)) == 0) {}; // Do nothing until data have been received and is ready
return UDR0; // Fetch the received byte value
}//Usart_Recieve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

heres the send side

[code]

//USART DEFINES
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)

//usart stuff

void Usart_Init(){
UBRR0L=BAUD_PRESCALE; //for this one the define calc will give 51 or 0x33
UBRR0H=BAUD_PRESCALE >> 8;
UCSR0B=0x08; //sending only
UCSR0C=0x06; //asynchronous - no parity - 8bit
}//Usart_Setup

void Usart_Send(char data){
while ((UCSR0A & (1 << UDRE0)) == 0) {}; // Do nothing until UDR is ready for more data
UDR0 = data ; // Send out the byte value
}//Usart_Send

int Usart_Recieve(){
while ((UCSR0A & (1 << RXC0)) == 0) {}; // Do nothing until data have been received and is ready
return UDR0; // Fetch the received byte value
}//Usart_Recieve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hahaaha i think i figured it out
the sending only parts...omfg i suq:-P

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sigh still nothing

heres my new reciever side usart code

//usart stuff
void Usart_Init(){
	UBRR0L=BAUD_PRESCALE;			//for this one the define calc will give 51 or 0x33
	UBRR0H=BAUD_PRESCALE >> 8; 
  	UCSR0B=0x10; 		//recieving only
	UCSR0C=0x06;		//asynchronous - no parity - 8bit
}//Usart_Setup

void Usart_Send(char data){
while ((UCSR0A & (1 << UDRE0)) == 0) {}; // Do nothing until UDR is ready for more data
UDR0 = data ; // Send out the byte value
}//Usart_Send

int Usart_Recieve(){
while ((UCSR0A & (1 << RXC0)) == 0) {}; // Do nothing until data have been received and is ready
return UDR0; // Fetch the received byte value
}//Usart_Recieve
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok here are two ideas to try.

1) send the square wave into the transmitter and look for it on the reciever output. That confirms the linx modules are working.

2) connect the tx out of the send micro to the rx input of the receive micro and see if they communicate. While you are at it, hang your scope probe on the line and look for a data burst.

I also noticed you are not using an interrupt on the RX side to indicate that new data is available. You might want to try that, or poll the receive flag. I do not read 'c' well so forgive me if I missed that.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

YES! it sent stuff..dosent seem to be the right value but def a step in the right direction!!

So I am sending type int and recieving type int but not getting the same number..is is getting messed up because int is 16 bit????

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alright im getting hella close...i get data transmission, but I can't get what I send. I know it has to be another one of my dinky goofs.....i just cant see it yet

ok here is the sender side

//usart stuff

void Usart_Init(){
	UBRR0L=BAUD_PRESCALE;			//for this one the define calc will give 51 or 0x33
	UBRR0H=BAUD_PRESCALE >> 8; 
  	UCSR0B=0x08; 		//sending only
	UCSR0C=0x06;		//asynchronous - no parity - 8bit
}//Usart_Setup

void Usart_Send(int data){
while ((UCSR0A & (1 << UDRE0)) == 0) {}; // Do nothing until UDR is ready for more data
UDR0 = data ; // Send out the byte value
}//Usart_Send


int main(){
	DDRC=0xFF;
	Initialize_Ports();
	Usart_Init();
	int temp=1;

	while(1){
		reset ();
		wait_ready ();
		//temp=read_byte();
		Usart_Send(temp);
		_delay_ms(10);
	}//while
}//main


here is the reciever side

//usart stuff
void Usart_Init(){
	UBRR0L=BAUD_PRESCALE;			//for this one the define calc will give 51 or 0x33
	UBRR0H=BAUD_PRESCALE >> 8; 
  	UCSR0B=0x10; 		//recieving only
	UCSR0C=0x06;		//asynchronous - no parity - 8bit
}//Usart_Init
int Usart_Recieve(){
while ((UCSR0A & (1 << RXC0)) == 0) {}; // Do nothing until data have been received and is ready
return UDR0; // Fetch the received byte value
}//Usart_Recieve



int Error_Correction(){
	int checker=0;
	int checker2=0;
	while(1){
		checker=Usart_Recieve();
		checker2=Usart_Recieve();
		if (checker==checker2){
			if(checker==Usart_Recieve()){
				return checker;
			}
		}//if
	}//while 
}//Error_Correction

//main

int main(){
	int temp=0;
	Initialize_Ports();
	//Timer_Init();
	Usart_Init();
	while(1){
		temp=Error_Correction();
		if (temp==1){
			C_SETBIT(r22);	
			C_SETBIT(r23);
			C_SETBIT(r24);
			C_SETBIT(r25);
		}
		else if (temp<1){
			C_SETBIT(r24);
		}
		else if (temp>1){
			C_SETBIT(r25);
	}//while

I set the sender side to only send a int of 1...the reciever side, despite my error correction is all over the place...

I can taste it....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

grr...it illudes me still....i tried to change my check to use a checksum and still got nowhere..

.i guess im calling it a night...my best next guess is that the rf sends the bits in the reverse order or something ...like lsb first....but it wouldnt think i would hit the problem usng the usart protocol

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you try any of my ideas? You are chasing possibilities rather than diagnosing what is exactly wrong.

Send a square wave through the link and scope the RX output and see if there is a good reproduction of the input.

Then connect the two AVR's together. One jumper to connect the tx and rx pins togetherr, and another jumper to connect the grounds together. Send some data and see if the rx decodes it.

At least this way you have isolated both components of your system and can see where your issue truly is.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yup your right...when I connected the txd pins of the transmitter to the rxd of the reciever I dont get out the same thing I put in.

Perhaps thats worth a new thread specific to usarts

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

no it means your code has issues
as I mentioned before, I don't read 'c' very well, but I did notice you are not using interrupts to tell the processor when it has recieved a charachter.

Ok, first, what processor are you using and at what speed?

I recall your baud rate is 9600

Have you checked the wireless link using the square wave? If not do it. It will save you grief later.

Also, if I am correct you mentioned an STK501. Does that mean you are using AVRStudio? If so, based on the parameters you can provide on the processor and speed I could send you assembler code that can send the status of a port and on the receive side replicate it. Only problem is that I recall you are getting paid to do this so where would I send the bill :lol:

Based on the info you gave, it does sound like the issue is your code. But properr design flow would be to examine everything anyway....ONE PIECE AT A TIME

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did not think I needed interrupts, as long as I waited for the flag for data recieved to come.

this line

while ((UCSR0A & (1 << RXC0)) == 0) {}; // Do nothing until data have been received and is ready 

-im using a mega128 at 8 mhz
-The link works, I get a solid square wave from it

I really think I goofed somewhare in the understanding of usart transmission

like according to what I thought, if I send a unsigned char (8bits) to the usart on the send side I should be able to get the same unsigned char on the reciever side

Like when i read the usart tut thats what I got out of it.

Again thanks for your help. You have been really patient. AND HELPFUL!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yup and im using avrstudio

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

this is my defne for making the baud rate ...is it wrong?

//USART DEFINES
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I sent you a PM, read it

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you sure you sent it? there is no pm's in my forum inbox

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

my firewall is blocking it

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Wed. Nov 21, 2007 - 06:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sir i am so sorry...I don't know what I did wrong..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i have been spending sleepless nights learning this stuff...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To all,
To live and to learn

I really extended myself on this one and I got burned.
I posted a personal telephone number and he called me. It took three minutes to find out that this IDTENT is not who he says he is. He has apparently extracted solutions without informing anyone of his intentions until now.

I was informed that he has "expertly" codes two other sub systems using motor controllers and temperature sensors. If theis is the case, why the hell is he having trouble with a simple usart?

Troll,

I thank for the opportunity to vent.
Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok I'm at my wits end. I have been trying to get this to work for a week. I took on this project to help out my company. I've worked 12hour days trying to learn the datasheet, and the esoteric parts of coding for atmel processors. I have asked alot of questions and done a lot of reading....

But JGMdesign just called me a troll!
Well buddy I'm killing myself to come up to speed with this stuff. I ironed out so many other parts on my own and then hit a wall with rf. Which I will overcome! And if you dont want to help then don't. BUT EVERY PEICE OF CODE IVE PAINSTAIKINGLY RESEARCHED AND CODED MYSELF.

You made me feel like a piece of shit when Ive been putting everything I have into this

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You informed me that you "expertly" coded a motor controller and a sensor, .

A usart should be of no sweat with your 'expert' capabilities.

Since you obviously know better than simple de-bugging principle, that was clearly explained by yourself from our telephone conversation, you do not need this site. Please do those of us and fill the hole you dug for yourself a favor and admit that you really have no clue.

I learn from my mistakes, I learned that I put a little faith on this one.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
IT WAS OSCCAL!!!!!! All my Usart problems were coming from the reciever getting a slightly erronous clock between the two!

Does that sound like Im a fool?! Dosent that sound like a reasonable problem??(that could be noticed by a more seasoned programmer looking at it)

How dare you belittle all the effort Ive put into learning this. Im sorry if I said it was for work. But my boss didnt ask me to do it thinking i knew what i was doing...they asked me to do it betting that i could learn...

You really really hurt my feelings sir.

I'm sorry for everything, except for asking questions..

The point is that you made it clear to me that you are an expert 'c' programmer, but you got the code to accomplish this task without telling anyone what you are up to.

You asked questions, that is good. But be forthcomming and be honest. As I said before, if you are so good at programming in 'c' this was a no brainer.

Now, that that bullS*&^ is out of the way, did you try the wireless link :wink:

I am tough, but I do like to see a project through

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yup it sends

im sending 16 bit integers
by bit shifting down the byte of high bits and sending them
then sending the byte of low bits
and then I send a checksum of the 2 added

its working out well...im starting to test range

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good luck in your quest

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Pages