(PIC 18F2550 ---- Xtal 8Mhz)
sbit LCD_RS at RA5_bit;
sbit LCD_EN at RA4_bit;
sbit LCD_D4 at RA0_bit;
sbit LCD_D5 at RA1_bit;
sbit LCD_D6 at RA2_bit;
sbit LCD_D7 at RA3_bit;
sbit LCD_RS_Direction at TRISA5_bit;
sbit LCD_EN_Direction at TRISA4_bit;
sbit LCD_D4_Direction at TRISA0_bit;
sbit LCD_D5_Direction at TRISA1_bit;
sbit LCD_D6_Direction at TRISA2_bit;
sbit LCD_D7_Direction at TRISA3_bit;
char texto2[10], texto1[]="Data Receiver";
unsigned char rxdat[10]; // (global var) holds received RF bytes
//=============================================================================
// RECEIVE_RF_PACKET
//=============================================================================
void main(void)
{
//-------------------------------------------------------
// This function receives an RF packet of bytes in my pulse period
// encoded format. The packet must have 10 valid contiguous bytes
// or the function will not exit. There is no timeout feature, but could be added.
// global variable; unsigned char rxdat[10] holds the 10 byte result.
// Note! TMR0 is running at 500kHz, so 200uS = 100 TMR0 ticks
//-------------------------------------------------------
unsigned char rrp_data;
unsigned char rrp_period;
unsigned char rrp_bits;
unsigned char rrp_bytes;
TRISC.RC6 = 0; // TX pin, works fine with/without setting this I/O in proteus
TRISC.RC7 = 1; // RX pin, works fine with/without setting this I/O in proteus
CMCON = 0x07;
ADCON1 = 0x0F;
Lcd_Init(); //Inicializa el LCD.
Lcd_Cmd(_LCD_CLEAR); //Borra el display.
Lcd_Cmd(_LCD_CURSOR_OFF); //Apaga el cursor.
Lcd_Out(1,6,texto1); //Escribe el texto1.
rrp_bytes = 0;
while(rrp_bytes < 10) // loop until it has received 10 contiguous RF bytes
{
//-----------------------------------------
// wait for a start pulse >200uS
while(1)
{
while(!PORTC.F7) continue; // wait for input / edge
while(PORTC.F7) continue; // wait for input \ edge
rrp_period = TMR0L; // grab the pulse period!
TMR0L = 0; // and ready to record next period
if(rrp_period < 100) rrp_bytes = 0; // clear bytecount if still receiving noise
else break; // exit if pulse was >200uS
}
//-----------------------------------------
// now we had a start pulse, record 8 bits
rrp_bits = 8;
while(rrp_bits)
{
while(!PORTC.F7) continue; // wait for input / edge
while(PORTC.F7) continue; // wait for input \ edge
rrp_period = TMR0L; // grab the pulse period!
TMR0L = 0; // and ready to record next period
if(rrp_period >= 100) break; // if >=200uS, is unexpected start pulse!
if(rrp_period < 61) rrp_data.F0 = 0; // 61 = 122uS
else rrp_data.F0 = 1;
rrp_data = (rrp_data << 1); // save the good bit into rrp_data
rrp_bits--; // and record 1 more good bit done
}
//-----------------------------------------
// gets to here after 8 good bits OR after an error (unexpected start pulse)
if(rrp_bits) // if error
{
rrp_bytes = 0; // reset bytes, must run from start of a new packet again!
}
else // else 8 good bits were received
{
rxdat[rrp_bytes] = rrp_data; // so save the received byte into array
rrp_bytes++;
// record another good byte was saved
bytetohex(rrp_data,texto2);
lcd_out(2,1,texto2);
delay_ms(50);
}
}
}
//-----------------------------------------------------------------------------
key fobs, garage doors, gates, remote doorbells, remote temperature/weather stations, remote telemetry, dog training, etcWhat every day life purpose is the transmitter & receiver good for?
They are license-free (ISM) bands for just this purpose. Only infrequent, very low power, short duration transmissions allowed, no voice, no continuous broadcasts.What is 433 MHz and 315 MHz used for in every day life?
With good antennas, a few hundred feet. With crummy or no antennas, a few feet.What distance will it transmit?
{
//-----------------------------------------
// wait for a start pulse >200uS
while(1)
{
while(!PORTC.F7) continue; // wait for input / edge
while(PORTC.F7) continue; // wait for input \ edge
rrp_period = TMR0L; // grab the pulse period!
TMR0L = 0; // and ready to record next period
if(rrp_period < 100) rrp_bytes = 0; // clear bytecount if still receiving noise
else break; // exit if pulse was >200uS
}
Thanks for educating me. The priceless attitude of who takes time and dedication to teach us.
Am after modifying these 315MHz receiver units to work OOK at half or less the receiver frequency. Do you see reasons that by tweaking the tuning components will not be enough to make them work around 140MHz even at somewhat reduced performance ?
There is a few types and in superheterodyne and regenerative modes. If some have schematic showing more hack friendly, well, that one.
Any guidance or link to someone doing that will be appreciated.
¿? What is 'wiping out' the 2m band by modifying a receiver, and what is obviously illegal there, even if would not have my two amateur radio licenses ?
The "masses of interference" emitted by those receivers are then "covered the use of such crude and nasty devices" available to the general public with no licenses as am aware of that buy these units to play with, but not for our amateur radio activity ?
Am not modifying any transmitters, do not care about them, and the operation is for OOK presence detection, and still see nothing illegal.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?